@dcl/jump-site 0.0.3 → 0.0.4-15334308896.commit-14f6c47

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,12 @@
1
+ import{f as Z,k as jn,i as nt,h as Hr,l as Un,r as Zc,t as _d,j as md}from"./index-CyAwJUFH.js";function bd(e,t){for(var r=0;r<t.length;r++){const n=t[r];if(typeof n!="string"&&!Array.isArray(n)){for(const i in n)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(n,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>n[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var go={},$r={},Hn={};Object.defineProperty(Hn,"__esModule",{value:!0});Hn.walletLogo=void 0;const yd=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Hn.walletLogo=yd;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.LINK_API_URL=void 0;Wn.LINK_API_URL="https://www.walletlink.org";var W={},Wr={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.errorValues=St.standardErrorCodes=void 0;St.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}};St.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 Vn={},zn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=St,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(g,_=r){if(g&&Number.isInteger(g)){const E=g.toString();if(f(t.errorValues,E))return t.errorValues[E].message;if(l(g))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return _}e.getMessageFromCode=n;function i(g){if(!Number.isInteger(g))return!1;const _=g.toString();return!!(t.errorValues[_]||l(g))}e.isValidCode=i;function s(g){var _;if(typeof g=="number")return g;if(a(g))return(_=g.code)!==null&&_!==void 0?_:g.errorCode}e.getErrorCode=s;function a(g){return typeof g=="object"&&g!==null&&(typeof g.code=="number"||typeof g.errorCode=="number")}function o(g,{shouldIncludeStack:_=!1}={}){const E={};if(g&&typeof g=="object"&&!Array.isArray(g)&&f(g,"code")&&i(g.code)){const x=g;E.code=x.code,x.message&&typeof x.message=="string"?(E.message=x.message,f(x,"data")&&(E.data=x.data)):(E.message=n(E.code),E.data={originalError:u(g)})}else E.code=t.standardErrorCodes.rpc.internal,E.message=h(g,"message")?g.message:r,E.data={originalError:u(g)};return _&&(E.stack=h(g,"stack")?g.stack:void 0),E}e.serialize=o;function l(g){return g>=-32099&&g<=-32e3}function u(g){return g&&typeof g=="object"&&!Array.isArray(g)?Object.assign({},g):g}function f(g,_){return Object.prototype.hasOwnProperty.call(g,_)}function h(g,_){return typeof g=="object"&&g!==null&&_ in g&&typeof g[_]=="string"}})(zn);Object.defineProperty(Vn,"__esModule",{value:!0});Vn.standardErrors=void 0;const Ne=St,Kc=zn;Vn.standardErrors={rpc:{parse:e=>qe(Ne.standardErrorCodes.rpc.parse,e),invalidRequest:e=>qe(Ne.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>qe(Ne.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>qe(Ne.standardErrorCodes.rpc.methodNotFound,e),internal:e=>qe(Ne.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return qe(t,e)},invalidInput:e=>qe(Ne.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>qe(Ne.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>qe(Ne.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>qe(Ne.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>qe(Ne.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>qe(Ne.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Xt(Ne.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Xt(Ne.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Xt(Ne.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Xt(Ne.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Xt(Ne.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Xt(Ne.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Xc(t,r,n)}}};function qe(e,t){const[r,n]=Qc(t);return new Yc(e,r||(0,Kc.getMessageFromCode)(e),n)}function Xt(e,t){const[r,n]=Qc(t);return new Xc(e,r||(0,Kc.getMessageFromCode)(e),n)}function Qc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let Yc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))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=t,n!==void 0&&(this.data=n)}},Xc=class extends Yc{constructor(t,r,n){if(!wd(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function wd(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var qn={},Er={};Object.defineProperty(Er,"__esModule",{value:!0});Er.isErrorResponse=void 0;function Ed(e){return e.errorMessage!==void 0}Er.isErrorResponse=Ed;var vr={};Object.defineProperty(vr,"__esModule",{value:!0});vr.LIB_VERSION=void 0;vr.LIB_VERSION="3.9.3";Object.defineProperty(qn,"__esModule",{value:!0});qn.serializeError=void 0;const vd=Er,Sd=vr,Rd=St,Cd=zn;function kd(e,t){const r=(0,Cd.serialize)(Id(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",Sd.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=xd(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}qn.serializeError=kd;function Id(e){return typeof e=="string"?{message:e,code:Rd.standardErrorCodes.rpc.internal}:(0,vd.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function xd(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=St;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=Vn;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=qn;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=zn;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(Wr);var xe={};Object.defineProperty(xe,"__esModule",{value:!0});xe.ProviderType=xe.RegExpString=xe.IntNumber=xe.BigIntString=xe.AddressString=xe.HexString=xe.OpaqueType=void 0;function Vr(){return e=>e}xe.OpaqueType=Vr;xe.HexString=Vr();xe.AddressString=Vr();xe.BigIntString=Vr();function Ad(e){return Math.floor(e)}xe.IntNumber=Ad;xe.RegExpString=Vr();var oa;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(oa||(xe.ProviderType=oa={}));var Td=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(W,"__esModule",{value:!0});W.isMobileWeb=W.getLocation=W.isInIFrame=W.createQrUrl=W.getFavicon=W.range=W.isBigNumber=W.ensureParsedJSONObject=W.ensureBN=W.ensureRegExpString=W.ensureIntNumber=W.ensureBuffer=W.ensureAddressString=W.ensureEvenLengthHexString=W.ensureHexString=W.isHexString=W.prepend0x=W.strip0x=W.has0xPrefix=W.hexStringFromIntNumber=W.intNumberFromHexString=W.bigIntStringFromBN=W.hexStringFromBuffer=W.hexStringToUint8Array=W.uint8ArrayToHex=W.randomBytesHex=void 0;const Tt=Td(jn),Gt=Wr,Qe=xe,el=/^[0-9]*$/,tl=/^[a-f0-9]*$/;function Md(e){return rl(crypto.getRandomValues(new Uint8Array(e)))}W.randomBytesHex=Md;function rl(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}W.uint8ArrayToHex=rl;function Nd(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}W.hexStringToUint8Array=Nd;function Ld(e,t=!1){const r=e.toString("hex");return(0,Qe.HexString)(t?`0x${r}`:r)}W.hexStringFromBuffer=Ld;function Bd(e){return(0,Qe.BigIntString)(e.toString(10))}W.bigIntStringFromBN=Bd;function Pd(e){return(0,Qe.IntNumber)(new Tt.default(qr(e,!1),16).toNumber())}W.intNumberFromHexString=Pd;function Od(e){return(0,Qe.HexString)(`0x${new Tt.default(e).toString(16)}`)}W.hexStringFromIntNumber=Od;function _o(e){return e.startsWith("0x")||e.startsWith("0X")}W.has0xPrefix=_o;function Gn(e){return _o(e)?e.slice(2):e}W.strip0x=Gn;function nl(e){return _o(e)?`0x${e.slice(2)}`:`0x${e}`}W.prepend0x=nl;function zr(e){if(typeof e!="string")return!1;const t=Gn(e).toLowerCase();return tl.test(t)}W.isHexString=zr;function il(e,t=!1){if(typeof e=="string"){const r=Gn(e).toLowerCase();if(tl.test(r))return(0,Qe.HexString)(t?`0x${r}`:r)}throw Gt.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}W.ensureHexString=il;function qr(e,t=!1){let r=il(e,!1);return r.length%2===1&&(r=(0,Qe.HexString)(`0${r}`)),t?(0,Qe.HexString)(`0x${r}`):r}W.ensureEvenLengthHexString=qr;function $d(e){if(typeof e=="string"){const t=Gn(e).toLowerCase();if(zr(t)&&t.length===40)return(0,Qe.AddressString)(nl(t))}throw Gt.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}W.ensureAddressString=$d;function Fd(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(zr(e)){const t=qr(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw Gt.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}W.ensureBuffer=Fd;function sl(e){if(typeof e=="number"&&Number.isInteger(e))return(0,Qe.IntNumber)(e);if(typeof e=="string"){if(el.test(e))return(0,Qe.IntNumber)(Number(e));if(zr(e))return(0,Qe.IntNumber)(new Tt.default(qr(e,!1),16).toNumber())}throw Gt.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}W.ensureIntNumber=sl;function Dd(e){if(e instanceof RegExp)return(0,Qe.RegExpString)(e.toString());throw Gt.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}W.ensureRegExpString=Dd;function jd(e){if(e!==null&&(Tt.default.isBN(e)||ol(e)))return new Tt.default(e.toString(10),10);if(typeof e=="number")return new Tt.default(sl(e));if(typeof e=="string"){if(el.test(e))return new Tt.default(e,10);if(zr(e))return new Tt.default(qr(e,!1),16)}throw Gt.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}W.ensureBN=jd;function Ud(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw Gt.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}W.ensureParsedJSONObject=Ud;function ol(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}W.isBigNumber=ol;function Hd(e,t){return Array.from({length:t-e},(r,n)=>e+n)}W.range=Hd;function Wd(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}W.getFavicon=Wd;function Vd(e,t,r,n,i,s){const a=n?"parent-id":"id",o=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${o}`}W.createQrUrl=Vd;function al(){try{return window.frameElement!==null}catch{return!1}}W.isInIFrame=al;function zd(){try{return al()&&window.top?window.top.location:window.location}catch{return window.location}}W.getLocation=zd;function qd(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}W.isMobileWeb=qd;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.ScopedLocalStorage=void 0;class Gd{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;n<localStorage.length;n++){const i=localStorage.key(n);typeof i=="string"&&i.startsWith(t)&&r.push(i)}r.forEach(n=>localStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}Jn.ScopedLocalStorage=Gd;var hr={},cl={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(l,u,f){this.fn=l,this.context=u,this.once=f||!1}function s(l,u,f,h,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var _=new i(f,h||l,g),E=r?r+u:u;return l._events[E]?l._events[E].fn?l._events[E]=[l._events[E],_]:l._events[E].push(_):(l._events[E]=_,l._eventsCount++),l}function a(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],f,h;if(this._eventsCount===0)return u;for(h in f=this._events)t.call(f,h)&&u.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},o.prototype.listeners=function(u){var f=r?r+u:u,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var g=0,_=h.length,E=new Array(_);g<_;g++)E[g]=h[g].fn;return E},o.prototype.listenerCount=function(u){var f=r?r+u:u,h=this._events[f];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,f,h,g,_,E){var x=r?r+u:u;if(!this._events[x])return!1;var R=this._events[x],b=arguments.length,v,S;if(R.fn){switch(R.once&&this.removeListener(u,R.fn,void 0,!0),b){case 1:return R.fn.call(R.context),!0;case 2:return R.fn.call(R.context,f),!0;case 3:return R.fn.call(R.context,f,h),!0;case 4:return R.fn.call(R.context,f,h,g),!0;case 5:return R.fn.call(R.context,f,h,g,_),!0;case 6:return R.fn.call(R.context,f,h,g,_,E),!0}for(S=1,v=new Array(b-1);S<b;S++)v[S-1]=arguments[S];R.fn.apply(R.context,v)}else{var M=R.length,A;for(S=0;S<M;S++)switch(R[S].once&&this.removeListener(u,R[S].fn,void 0,!0),b){case 1:R[S].fn.call(R[S].context);break;case 2:R[S].fn.call(R[S].context,f);break;case 3:R[S].fn.call(R[S].context,f,h);break;case 4:R[S].fn.call(R[S].context,f,h,g);break;default:if(!v)for(A=1,v=new Array(b-1);A<b;A++)v[A-1]=arguments[A];R[S].fn.apply(R[S].context,v)}}return!0},o.prototype.on=function(u,f,h){return s(this,u,f,h,!1)},o.prototype.once=function(u,f,h){return s(this,u,f,h,!0)},o.prototype.removeListener=function(u,f,h,g){var _=r?r+u:u;if(!this._events[_])return this;if(!f)return a(this,_),this;var E=this._events[_];if(E.fn)E.fn===f&&(!g||E.once)&&(!h||E.context===h)&&a(this,_);else{for(var x=0,R=[],b=E.length;x<b;x++)(E[x].fn!==f||g&&!E[x].once||h&&E[x].context!==h)&&R.push(E[x]);R.length?this._events[_]=R.length===1?R[0]:R:a(this,_)}return this},o.prototype.removeAllListeners=function(u){var f;return u?(f=r?r+u:u,this._events[f]&&a(this,f)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=r,o.EventEmitter=o,e.exports=o})(cl);var Jd=cl.exports,Gr={},Jr={},Sr={};Object.defineProperty(Sr,"__esModule",{value:!0});Sr.EVENTS=void 0;Sr.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 Ke={};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.RelayAbstract=Ke.APP_VERSION_KEY=Ke.LOCAL_STORAGE_ADDRESSES_KEY=Ke.WALLET_USER_NAME_KEY=void 0;const aa=Wr;Ke.WALLET_USER_NAME_KEY="walletUsername";Ke.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";Ke.APP_VERSION_KEY="AppVersion";class Zd{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw aa.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,aa.serializeError)(s,t.method);return i})}}Ke.RelayAbstract=Zd;var Rr={},ll={exports:{}},eo={exports:{}},Zr={},Zn={};Zn.byteLength=Yd;Zn.toByteArray=eh;Zn.fromByteArray=nh;var ft=[],Ze=[],Kd=typeof Uint8Array<"u"?Uint8Array:Array,Ss="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var er=0,Qd=Ss.length;er<Qd;++er)ft[er]=Ss[er],Ze[Ss.charCodeAt(er)]=er;Ze[45]=62;Ze[95]=63;function ul(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function Yd(e){var t=ul(e),r=t[0],n=t[1];return(r+n)*3/4-n}function Xd(e,t,r){return(t+r)*3/4-r}function eh(e){var t,r=ul(e),n=r[0],i=r[1],s=new Kd(Xd(e,n,i)),a=0,o=i>0?n-4:n,l;for(l=0;l<o;l+=4)t=Ze[e.charCodeAt(l)]<<18|Ze[e.charCodeAt(l+1)]<<12|Ze[e.charCodeAt(l+2)]<<6|Ze[e.charCodeAt(l+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=t&255;return i===2&&(t=Ze[e.charCodeAt(l)]<<2|Ze[e.charCodeAt(l+1)]>>4,s[a++]=t&255),i===1&&(t=Ze[e.charCodeAt(l)]<<10|Ze[e.charCodeAt(l+1)]<<4|Ze[e.charCodeAt(l+2)]>>2,s[a++]=t>>8&255,s[a++]=t&255),s}function th(e){return ft[e>>18&63]+ft[e>>12&63]+ft[e>>6&63]+ft[e&63]}function rh(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(th(n));return i.join("")}function nh(e){for(var t,r=e.length,n=r%3,i=[],s=16383,a=0,o=r-n;a<o;a+=s)i.push(rh(e,a,a+s>o?o:a+s));return n===1?(t=e[r-1],i.push(ft[t>>2]+ft[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(ft[t>>10]+ft[t>>4&63]+ft[t<<2&63]+"=")),i.join("")}var mo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */mo.read=function(e,t,r,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,u=l>>1,f=-7,h=r?i-1:0,g=r?-1:1,_=e[t+h];for(h+=g,s=_&(1<<-f)-1,_>>=-f,f+=o;f>0;s=s*256+e[t+h],h+=g,f-=8);for(a=s&(1<<-f)-1,s>>=-f,f+=n;f>0;a=a*256+e[t+h],h+=g,f-=8);if(s===0)s=1-u;else{if(s===l)return a?NaN:(_?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-u}return(_?-1:1)*a*Math.pow(2,s-n)};mo.write=function(e,t,r,n,i,s){var a,o,l,u=s*8-i-1,f=(1<<u)-1,h=f>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,E=n?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=g/l:t+=g*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=f?(o=0,a=f):a+h>=1?(o=(t*l-1)*Math.pow(2,i),a=a+h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+_]=o&255,_+=E,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;e[r+_]=a&255,_+=E,a/=256,u-=8);e[r+_-E]|=x*128};/*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */(function(e){const t=Zn,r=mo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const p=new Uint8Array(1),c={foo:function(){return 42}};return Object.setPrototypeOf(c,Uint8Array.prototype),Object.setPrototypeOf(p,c),p.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');const c=new Uint8Array(p);return Object.setPrototypeOf(c,o.prototype),c}function o(p,c,d){if(typeof p=="number"){if(typeof c=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(p)}return l(p,c,d)}o.poolSize=8192;function l(p,c,d){if(typeof p=="string")return g(p,c);if(ArrayBuffer.isView(p))return E(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Pe(p,ArrayBuffer)||p&&Pe(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe(p,SharedArrayBuffer)||p&&Pe(p.buffer,SharedArrayBuffer)))return x(p,c,d);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const m=p.valueOf&&p.valueOf();if(m!=null&&m!==p)return o.from(m,c,d);const C=R(p);if(C)return C;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return o.from(p[Symbol.toPrimitive]("string"),c,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}o.from=function(p,c,d){return l(p,c,d)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function u(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function f(p,c,d){return u(p),p<=0?a(p):c!==void 0?typeof d=="string"?a(p).fill(c,d):a(p).fill(c):a(p)}o.alloc=function(p,c,d){return f(p,c,d)};function h(p){return u(p),a(p<0?0:b(p)|0)}o.allocUnsafe=function(p){return h(p)},o.allocUnsafeSlow=function(p){return h(p)};function g(p,c){if((typeof c!="string"||c==="")&&(c="utf8"),!o.isEncoding(c))throw new TypeError("Unknown encoding: "+c);const d=S(p,c)|0;let m=a(d);const C=m.write(p,c);return C!==d&&(m=m.slice(0,C)),m}function _(p){const c=p.length<0?0:b(p.length)|0,d=a(c);for(let m=0;m<c;m+=1)d[m]=p[m]&255;return d}function E(p){if(Pe(p,Uint8Array)){const c=new Uint8Array(p);return x(c.buffer,c.byteOffset,c.byteLength)}return _(p)}function x(p,c,d){if(c<0||p.byteLength<c)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<c+(d||0))throw new RangeError('"length" is outside of buffer bounds');let m;return c===void 0&&d===void 0?m=new Uint8Array(p):d===void 0?m=new Uint8Array(p,c):m=new Uint8Array(p,c,d),Object.setPrototypeOf(m,o.prototype),m}function R(p){if(o.isBuffer(p)){const c=b(p.length)|0,d=a(c);return d.length===0||p.copy(d,0,0,c),d}if(p.length!==void 0)return typeof p.length!="number"||ot(p.length)?a(0):_(p);if(p.type==="Buffer"&&Array.isArray(p.data))return _(p.data)}function b(p){if(p>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function v(p){return+p!=p&&(p=0),o.alloc(+p)}o.isBuffer=function(c){return c!=null&&c._isBuffer===!0&&c!==o.prototype},o.compare=function(c,d){if(Pe(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),Pe(d,Uint8Array)&&(d=o.from(d,d.offset,d.byteLength)),!o.isBuffer(c)||!o.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(c===d)return 0;let m=c.length,C=d.length;for(let T=0,N=Math.min(m,C);T<N;++T)if(c[T]!==d[T]){m=c[T],C=d[T];break}return m<C?-1:C<m?1:0},o.isEncoding=function(c){switch(String(c).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(c,d){if(!Array.isArray(c))throw new TypeError('"list" argument must be an Array of Buffers');if(c.length===0)return o.alloc(0);let m;if(d===void 0)for(d=0,m=0;m<c.length;++m)d+=c[m].length;const C=o.allocUnsafe(d);let T=0;for(m=0;m<c.length;++m){let N=c[m];if(Pe(N,Uint8Array))T+N.length>C.length?(o.isBuffer(N)||(N=o.from(N)),N.copy(C,T)):Uint8Array.prototype.set.call(C,N,T);else if(o.isBuffer(N))N.copy(C,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=N.length}return C};function S(p,c){if(o.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Pe(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);const d=p.length,m=arguments.length>2&&arguments[2]===!0;if(!m&&d===0)return 0;let C=!1;for(;;)switch(c){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return le(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return kt(p).length;default:if(C)return m?-1:le(p).length;c=(""+c).toLowerCase(),C=!0}}o.byteLength=S;function M(p,c,d){let m=!1;if((c===void 0||c<0)&&(c=0),c>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,c>>>=0,d<=c))return"";for(p||(p="utf8");;)switch(p){case"hex":return U(this,c,d);case"utf8":case"utf-8":return $(this,c,d);case"ascii":return j(this,c,d);case"latin1":case"binary":return q(this,c,d);case"base64":return pe(this,c,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,c,d);default:if(m)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),m=!0}}o.prototype._isBuffer=!0;function A(p,c,d){const m=p[c];p[c]=p[d],p[d]=m}o.prototype.swap16=function(){const c=this.length;if(c%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<c;d+=2)A(this,d,d+1);return this},o.prototype.swap32=function(){const c=this.length;if(c%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<c;d+=4)A(this,d,d+3),A(this,d+1,d+2);return this},o.prototype.swap64=function(){const c=this.length;if(c%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<c;d+=8)A(this,d,d+7),A(this,d+1,d+6),A(this,d+2,d+5),A(this,d+3,d+4);return this},o.prototype.toString=function(){const c=this.length;return c===0?"":arguments.length===0?$(this,0,c):M.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(c){if(!o.isBuffer(c))throw new TypeError("Argument must be a Buffer");return this===c?!0:o.compare(this,c)===0},o.prototype.inspect=function(){let c="";const d=e.INSPECT_MAX_BYTES;return c=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(c+=" ... "),"<Buffer "+c+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(c,d,m,C,T){if(Pe(c,Uint8Array)&&(c=o.from(c,c.offset,c.byteLength)),!o.isBuffer(c))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof c);if(d===void 0&&(d=0),m===void 0&&(m=c?c.length:0),C===void 0&&(C=0),T===void 0&&(T=this.length),d<0||m>c.length||C<0||T>this.length)throw new RangeError("out of range index");if(C>=T&&d>=m)return 0;if(C>=T)return-1;if(d>=m)return 1;if(d>>>=0,m>>>=0,C>>>=0,T>>>=0,this===c)return 0;let N=T-C,te=m-d;const be=Math.min(N,te),ge=this.slice(C,T),ye=c.slice(d,m);for(let fe=0;fe<be;++fe)if(ge[fe]!==ye[fe]){N=ge[fe],te=ye[fe];break}return N<te?-1:te<N?1:0};function B(p,c,d,m,C){if(p.length===0)return-1;if(typeof d=="string"?(m=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,ot(d)&&(d=C?0:p.length-1),d<0&&(d=p.length+d),d>=p.length){if(C)return-1;d=p.length-1}else if(d<0)if(C)d=0;else return-1;if(typeof c=="string"&&(c=o.from(c,m)),o.isBuffer(c))return c.length===0?-1:K(p,c,d,m,C);if(typeof c=="number")return c=c&255,typeof Uint8Array.prototype.indexOf=="function"?C?Uint8Array.prototype.indexOf.call(p,c,d):Uint8Array.prototype.lastIndexOf.call(p,c,d):K(p,[c],d,m,C);throw new TypeError("val must be string, number or Buffer")}function K(p,c,d,m,C){let T=1,N=p.length,te=c.length;if(m!==void 0&&(m=String(m).toLowerCase(),m==="ucs2"||m==="ucs-2"||m==="utf16le"||m==="utf-16le")){if(p.length<2||c.length<2)return-1;T=2,N/=2,te/=2,d/=2}function be(ye,fe){return T===1?ye[fe]:ye.readUInt16BE(fe*T)}let ge;if(C){let ye=-1;for(ge=d;ge<N;ge++)if(be(p,ge)===be(c,ye===-1?0:ge-ye)){if(ye===-1&&(ye=ge),ge-ye+1===te)return ye*T}else ye!==-1&&(ge-=ge-ye),ye=-1}else for(d+te>N&&(d=N-te),ge=d;ge>=0;ge--){let ye=!0;for(let fe=0;fe<te;fe++)if(be(p,ge+fe)!==be(c,fe)){ye=!1;break}if(ye)return ge}return-1}o.prototype.includes=function(c,d,m){return this.indexOf(c,d,m)!==-1},o.prototype.indexOf=function(c,d,m){return B(this,c,d,m,!0)},o.prototype.lastIndexOf=function(c,d,m){return B(this,c,d,m,!1)};function H(p,c,d,m){d=Number(d)||0;const C=p.length-d;m?(m=Number(m),m>C&&(m=C)):m=C;const T=c.length;m>T/2&&(m=T/2);let N;for(N=0;N<m;++N){const te=parseInt(c.substr(N*2,2),16);if(ot(te))return N;p[d+N]=te}return N}function D(p,c,d,m){return wt(le(c,p.length-d),p,d,m)}function ie(p,c,d,m){return wt(et(c),p,d,m)}function oe(p,c,d,m){return wt(kt(c),p,d,m)}function ae(p,c,d,m){return wt(yt(c,p.length-d),p,d,m)}o.prototype.write=function(c,d,m,C){if(d===void 0)C="utf8",m=this.length,d=0;else if(m===void 0&&typeof d=="string")C=d,m=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(m)?(m=m>>>0,C===void 0&&(C="utf8")):(C=m,m=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const T=this.length-d;if((m===void 0||m>T)&&(m=T),c.length>0&&(m<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");C||(C="utf8");let N=!1;for(;;)switch(C){case"hex":return H(this,c,d,m);case"utf8":case"utf-8":return D(this,c,d,m);case"ascii":case"latin1":case"binary":return ie(this,c,d,m);case"base64":return oe(this,c,d,m);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,c,d,m);default:if(N)throw new TypeError("Unknown encoding: "+C);C=(""+C).toLowerCase(),N=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pe(p,c,d){return c===0&&d===p.length?t.fromByteArray(p):t.fromByteArray(p.slice(c,d))}function $(p,c,d){d=Math.min(p.length,d);const m=[];let C=c;for(;C<d;){const T=p[C];let N=null,te=T>239?4:T>223?3:T>191?2:1;if(C+te<=d){let be,ge,ye,fe;switch(te){case 1:T<128&&(N=T);break;case 2:be=p[C+1],(be&192)===128&&(fe=(T&31)<<6|be&63,fe>127&&(N=fe));break;case 3:be=p[C+1],ge=p[C+2],(be&192)===128&&(ge&192)===128&&(fe=(T&15)<<12|(be&63)<<6|ge&63,fe>2047&&(fe<55296||fe>57343)&&(N=fe));break;case 4:be=p[C+1],ge=p[C+2],ye=p[C+3],(be&192)===128&&(ge&192)===128&&(ye&192)===128&&(fe=(T&15)<<18|(be&63)<<12|(ge&63)<<6|ye&63,fe>65535&&fe<1114112&&(N=fe))}}N===null?(N=65533,te=1):N>65535&&(N-=65536,m.push(N>>>10&1023|55296),N=56320|N&1023),m.push(N),C+=te}return V(m)}const O=4096;function V(p){const c=p.length;if(c<=O)return String.fromCharCode.apply(String,p);let d="",m=0;for(;m<c;)d+=String.fromCharCode.apply(String,p.slice(m,m+=O));return d}function j(p,c,d){let m="";d=Math.min(p.length,d);for(let C=c;C<d;++C)m+=String.fromCharCode(p[C]&127);return m}function q(p,c,d){let m="";d=Math.min(p.length,d);for(let C=c;C<d;++C)m+=String.fromCharCode(p[C]);return m}function U(p,c,d){const m=p.length;(!c||c<0)&&(c=0),(!d||d<0||d>m)&&(d=m);let C="";for(let T=c;T<d;++T)C+=It[p[T]];return C}function Q(p,c,d){const m=p.slice(c,d);let C="";for(let T=0;T<m.length-1;T+=2)C+=String.fromCharCode(m[T]+m[T+1]*256);return C}o.prototype.slice=function(c,d){const m=this.length;c=~~c,d=d===void 0?m:~~d,c<0?(c+=m,c<0&&(c=0)):c>m&&(c=m),d<0?(d+=m,d<0&&(d=0)):d>m&&(d=m),d<c&&(d=c);const C=this.subarray(c,d);return Object.setPrototypeOf(C,o.prototype),C};function G(p,c,d){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+c>d)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(c,d,m){c=c>>>0,d=d>>>0,m||G(c,d,this.length);let C=this[c],T=1,N=0;for(;++N<d&&(T*=256);)C+=this[c+N]*T;return C},o.prototype.readUintBE=o.prototype.readUIntBE=function(c,d,m){c=c>>>0,d=d>>>0,m||G(c,d,this.length);let C=this[c+--d],T=1;for(;d>0&&(T*=256);)C+=this[c+--d]*T;return C},o.prototype.readUint8=o.prototype.readUInt8=function(c,d){return c=c>>>0,d||G(c,1,this.length),this[c]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(c,d){return c=c>>>0,d||G(c,2,this.length),this[c]|this[c+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(c,d){return c=c>>>0,d||G(c,2,this.length),this[c]<<8|this[c+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(c,d){return c=c>>>0,d||G(c,4,this.length),(this[c]|this[c+1]<<8|this[c+2]<<16)+this[c+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(c,d){return c=c>>>0,d||G(c,4,this.length),this[c]*16777216+(this[c+1]<<16|this[c+2]<<8|this[c+3])},o.prototype.readBigUInt64LE=$e(function(c){c=c>>>0,L(c,"offset");const d=this[c],m=this[c+7];(d===void 0||m===void 0)&&F(c,this.length-8);const C=d+this[++c]*2**8+this[++c]*2**16+this[++c]*2**24,T=this[++c]+this[++c]*2**8+this[++c]*2**16+m*2**24;return BigInt(C)+(BigInt(T)<<BigInt(32))}),o.prototype.readBigUInt64BE=$e(function(c){c=c>>>0,L(c,"offset");const d=this[c],m=this[c+7];(d===void 0||m===void 0)&&F(c,this.length-8);const C=d*2**24+this[++c]*2**16+this[++c]*2**8+this[++c],T=this[++c]*2**24+this[++c]*2**16+this[++c]*2**8+m;return(BigInt(C)<<BigInt(32))+BigInt(T)}),o.prototype.readIntLE=function(c,d,m){c=c>>>0,d=d>>>0,m||G(c,d,this.length);let C=this[c],T=1,N=0;for(;++N<d&&(T*=256);)C+=this[c+N]*T;return T*=128,C>=T&&(C-=Math.pow(2,8*d)),C},o.prototype.readIntBE=function(c,d,m){c=c>>>0,d=d>>>0,m||G(c,d,this.length);let C=d,T=1,N=this[c+--C];for(;C>0&&(T*=256);)N+=this[c+--C]*T;return T*=128,N>=T&&(N-=Math.pow(2,8*d)),N},o.prototype.readInt8=function(c,d){return c=c>>>0,d||G(c,1,this.length),this[c]&128?(255-this[c]+1)*-1:this[c]},o.prototype.readInt16LE=function(c,d){c=c>>>0,d||G(c,2,this.length);const m=this[c]|this[c+1]<<8;return m&32768?m|4294901760:m},o.prototype.readInt16BE=function(c,d){c=c>>>0,d||G(c,2,this.length);const m=this[c+1]|this[c]<<8;return m&32768?m|4294901760:m},o.prototype.readInt32LE=function(c,d){return c=c>>>0,d||G(c,4,this.length),this[c]|this[c+1]<<8|this[c+2]<<16|this[c+3]<<24},o.prototype.readInt32BE=function(c,d){return c=c>>>0,d||G(c,4,this.length),this[c]<<24|this[c+1]<<16|this[c+2]<<8|this[c+3]},o.prototype.readBigInt64LE=$e(function(c){c=c>>>0,L(c,"offset");const d=this[c],m=this[c+7];(d===void 0||m===void 0)&&F(c,this.length-8);const C=this[c+4]+this[c+5]*2**8+this[c+6]*2**16+(m<<24);return(BigInt(C)<<BigInt(32))+BigInt(d+this[++c]*2**8+this[++c]*2**16+this[++c]*2**24)}),o.prototype.readBigInt64BE=$e(function(c){c=c>>>0,L(c,"offset");const d=this[c],m=this[c+7];(d===void 0||m===void 0)&&F(c,this.length-8);const C=(d<<24)+this[++c]*2**16+this[++c]*2**8+this[++c];return(BigInt(C)<<BigInt(32))+BigInt(this[++c]*2**24+this[++c]*2**16+this[++c]*2**8+m)}),o.prototype.readFloatLE=function(c,d){return c=c>>>0,d||G(c,4,this.length),r.read(this,c,!0,23,4)},o.prototype.readFloatBE=function(c,d){return c=c>>>0,d||G(c,4,this.length),r.read(this,c,!1,23,4)},o.prototype.readDoubleLE=function(c,d){return c=c>>>0,d||G(c,8,this.length),r.read(this,c,!0,52,8)},o.prototype.readDoubleBE=function(c,d){return c=c>>>0,d||G(c,8,this.length),r.read(this,c,!1,52,8)};function z(p,c,d,m,C,T){if(!o.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(c>C||c<T)throw new RangeError('"value" argument is out of bounds');if(d+m>p.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(c,d,m,C){if(c=+c,d=d>>>0,m=m>>>0,!C){const te=Math.pow(2,8*m)-1;z(this,c,d,m,te,0)}let T=1,N=0;for(this[d]=c&255;++N<m&&(T*=256);)this[d+N]=c/T&255;return d+m},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(c,d,m,C){if(c=+c,d=d>>>0,m=m>>>0,!C){const te=Math.pow(2,8*m)-1;z(this,c,d,m,te,0)}let T=m-1,N=1;for(this[d+T]=c&255;--T>=0&&(N*=256);)this[d+T]=c/N&255;return d+m},o.prototype.writeUint8=o.prototype.writeUInt8=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,1,255,0),this[d]=c&255,d+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,2,65535,0),this[d]=c&255,this[d+1]=c>>>8,d+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,2,65535,0),this[d]=c>>>8,this[d+1]=c&255,d+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,4,4294967295,0),this[d+3]=c>>>24,this[d+2]=c>>>16,this[d+1]=c>>>8,this[d]=c&255,d+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,4,4294967295,0),this[d]=c>>>24,this[d+1]=c>>>16,this[d+2]=c>>>8,this[d+3]=c&255,d+4};function re(p,c,d,m,C){w(c,m,C,p,d,7);let T=Number(c&BigInt(4294967295));p[d++]=T,T=T>>8,p[d++]=T,T=T>>8,p[d++]=T,T=T>>8,p[d++]=T;let N=Number(c>>BigInt(32)&BigInt(4294967295));return p[d++]=N,N=N>>8,p[d++]=N,N=N>>8,p[d++]=N,N=N>>8,p[d++]=N,d}function Ee(p,c,d,m,C){w(c,m,C,p,d,7);let T=Number(c&BigInt(4294967295));p[d+7]=T,T=T>>8,p[d+6]=T,T=T>>8,p[d+5]=T,T=T>>8,p[d+4]=T;let N=Number(c>>BigInt(32)&BigInt(4294967295));return p[d+3]=N,N=N>>8,p[d+2]=N,N=N>>8,p[d+1]=N,N=N>>8,p[d]=N,d+8}o.prototype.writeBigUInt64LE=$e(function(c,d=0){return re(this,c,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=$e(function(c,d=0){return Ee(this,c,d,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(c,d,m,C){if(c=+c,d=d>>>0,!C){const be=Math.pow(2,8*m-1);z(this,c,d,m,be-1,-be)}let T=0,N=1,te=0;for(this[d]=c&255;++T<m&&(N*=256);)c<0&&te===0&&this[d+T-1]!==0&&(te=1),this[d+T]=(c/N>>0)-te&255;return d+m},o.prototype.writeIntBE=function(c,d,m,C){if(c=+c,d=d>>>0,!C){const be=Math.pow(2,8*m-1);z(this,c,d,m,be-1,-be)}let T=m-1,N=1,te=0;for(this[d+T]=c&255;--T>=0&&(N*=256);)c<0&&te===0&&this[d+T+1]!==0&&(te=1),this[d+T]=(c/N>>0)-te&255;return d+m},o.prototype.writeInt8=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,1,127,-128),c<0&&(c=255+c+1),this[d]=c&255,d+1},o.prototype.writeInt16LE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,2,32767,-32768),this[d]=c&255,this[d+1]=c>>>8,d+2},o.prototype.writeInt16BE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,2,32767,-32768),this[d]=c>>>8,this[d+1]=c&255,d+2},o.prototype.writeInt32LE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,4,2147483647,-2147483648),this[d]=c&255,this[d+1]=c>>>8,this[d+2]=c>>>16,this[d+3]=c>>>24,d+4},o.prototype.writeInt32BE=function(c,d,m){return c=+c,d=d>>>0,m||z(this,c,d,4,2147483647,-2147483648),c<0&&(c=4294967295+c+1),this[d]=c>>>24,this[d+1]=c>>>16,this[d+2]=c>>>8,this[d+3]=c&255,d+4},o.prototype.writeBigInt64LE=$e(function(c,d=0){return re(this,c,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=$e(function(c,d=0){return Ee(this,c,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ce(p,c,d,m,C,T){if(d+m>p.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function k(p,c,d,m,C){return c=+c,d=d>>>0,C||ce(p,c,d,4),r.write(p,c,d,m,23,4),d+4}o.prototype.writeFloatLE=function(c,d,m){return k(this,c,d,!0,m)},o.prototype.writeFloatBE=function(c,d,m){return k(this,c,d,!1,m)};function I(p,c,d,m,C){return c=+c,d=d>>>0,C||ce(p,c,d,8),r.write(p,c,d,m,52,8),d+8}o.prototype.writeDoubleLE=function(c,d,m){return I(this,c,d,!0,m)},o.prototype.writeDoubleBE=function(c,d,m){return I(this,c,d,!1,m)},o.prototype.copy=function(c,d,m,C){if(!o.isBuffer(c))throw new TypeError("argument should be a Buffer");if(m||(m=0),!C&&C!==0&&(C=this.length),d>=c.length&&(d=c.length),d||(d=0),C>0&&C<m&&(C=m),C===m||c.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(m<0||m>=this.length)throw new RangeError("Index out of range");if(C<0)throw new RangeError("sourceEnd out of bounds");C>this.length&&(C=this.length),c.length-d<C-m&&(C=c.length-d+m);const T=C-m;return this===c&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,m,C):Uint8Array.prototype.set.call(c,this.subarray(m,C),d),T},o.prototype.fill=function(c,d,m,C){if(typeof c=="string"){if(typeof d=="string"?(C=d,d=0,m=this.length):typeof m=="string"&&(C=m,m=this.length),C!==void 0&&typeof C!="string")throw new TypeError("encoding must be a string");if(typeof C=="string"&&!o.isEncoding(C))throw new TypeError("Unknown encoding: "+C);if(c.length===1){const N=c.charCodeAt(0);(C==="utf8"&&N<128||C==="latin1")&&(c=N)}}else typeof c=="number"?c=c&255:typeof c=="boolean"&&(c=Number(c));if(d<0||this.length<d||this.length<m)throw new RangeError("Out of range index");if(m<=d)return this;d=d>>>0,m=m===void 0?this.length:m>>>0,c||(c=0);let T;if(typeof c=="number")for(T=d;T<m;++T)this[T]=c;else{const N=o.isBuffer(c)?c:o.from(c,C),te=N.length;if(te===0)throw new TypeError('The value "'+c+'" is invalid for argument "value"');for(T=0;T<m-d;++T)this[T+d]=N[T%te]}return this};const P={};function J(p,c,d){P[p]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:c.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(C){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:C,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}J("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),J("ERR_INVALID_ARG_TYPE",function(p,c){return`The "${p}" argument must be of type number. Received type ${typeof c}`},TypeError),J("ERR_OUT_OF_RANGE",function(p,c,d){let m=`The value of "${p}" is out of range.`,C=d;return Number.isInteger(d)&&Math.abs(d)>2**32?C=X(String(d)):typeof d=="bigint"&&(C=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(C=X(C)),C+="n"),m+=` It must be ${c}. Received ${C}`,m},RangeError);function X(p){let c="",d=p.length;const m=p[0]==="-"?1:0;for(;d>=m+4;d-=3)c=`_${p.slice(d-3,d)}${c}`;return`${p.slice(0,d)}${c}`}function y(p,c,d){L(c,"offset"),(p[c]===void 0||p[c+d]===void 0)&&F(c,p.length-(d+1))}function w(p,c,d,m,C,T){if(p>d||p<c){const N=typeof c=="bigint"?"n":"";let te;throw c===0||c===BigInt(0)?te=`>= 0${N} and < 2${N} ** ${(T+1)*8}${N}`:te=`>= -(2${N} ** ${(T+1)*8-1}${N}) and < 2 ** ${(T+1)*8-1}${N}`,new P.ERR_OUT_OF_RANGE("value",te,p)}y(m,C,T)}function L(p,c){if(typeof p!="number")throw new P.ERR_INVALID_ARG_TYPE(c,"number",p)}function F(p,c,d){throw Math.floor(p)!==p?(L(p,d),new P.ERR_OUT_OF_RANGE("offset","an integer",p)):c<0?new P.ERR_BUFFER_OUT_OF_BOUNDS:new P.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${c}`,p)}const _e=/[^+/0-9A-Za-z-_]/g;function ee(p){if(p=p.split("=")[0],p=p.trim().replace(_e,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function le(p,c){c=c||1/0;let d;const m=p.length;let C=null;const T=[];for(let N=0;N<m;++N){if(d=p.charCodeAt(N),d>55295&&d<57344){if(!C){if(d>56319){(c-=3)>-1&&T.push(239,191,189);continue}else if(N+1===m){(c-=3)>-1&&T.push(239,191,189);continue}C=d;continue}if(d<56320){(c-=3)>-1&&T.push(239,191,189),C=d;continue}d=(C-55296<<10|d-56320)+65536}else C&&(c-=3)>-1&&T.push(239,191,189);if(C=null,d<128){if((c-=1)<0)break;T.push(d)}else if(d<2048){if((c-=2)<0)break;T.push(d>>6|192,d&63|128)}else if(d<65536){if((c-=3)<0)break;T.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((c-=4)<0)break;T.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return T}function et(p){const c=[];for(let d=0;d<p.length;++d)c.push(p.charCodeAt(d)&255);return c}function yt(p,c){let d,m,C;const T=[];for(let N=0;N<p.length&&!((c-=2)<0);++N)d=p.charCodeAt(N),m=d>>8,C=d%256,T.push(C),T.push(m);return T}function kt(p){return t.toByteArray(ee(p))}function wt(p,c,d,m){let C;for(C=0;C<m&&!(C+d>=c.length||C>=p.length);++C)c[C+d]=p[C];return C}function Pe(p,c){return p instanceof c||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===c.name}function ot(p){return p!==p}const It=function(){const p="0123456789abcdef",c=new Array(256);for(let d=0;d<16;++d){const m=d*16;for(let C=0;C<16;++C)c[m+C]=p[d]+p[C]}return c}();function $e(p){return typeof BigInt>"u"?at:p}function at(){throw new Error("BigInt not supported")}})(Zr);/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(e,t){var r=Zr,n=r.Buffer;function i(a,o){for(var l in a)o[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,o,l){return n(a,o,l)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,l)},s.alloc=function(a,o,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var u=n(a);return o!==void 0?typeof l=="string"?u.fill(o,l):u.fill(o):u.fill(0),u},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(eo,eo.exports);var Bt=eo.exports,dl=Bt.Buffer;function Kn(e,t){this._block=dl.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Kn.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=dl.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a<i;){for(var o=s%n,l=Math.min(i-a,n-o),u=0;u<l;u++)r[o+u]=e[a+u];s+=l,a+=l,s%n===0&&this._update(r)}return this._len+=i,this};Kn.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};Kn.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Cr=Kn,ih=nt,hl=Cr,sh=Bt.Buffer,oh=[1518500249,1859775393,-1894007588,-899497514],ah=new Array(80);function Kr(){this.init(),this._w=ah,hl.call(this,64,56)}ih(Kr,hl);Kr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function ch(e){return e<<5|e>>>27}function lh(e){return e<<30|e>>>2}function uh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Kr.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)t[o]=e.readInt32BE(o*4);for(;o<80;++o)t[o]=t[o-3]^t[o-8]^t[o-14]^t[o-16];for(var l=0;l<80;++l){var u=~~(l/20),f=ch(r)+uh(u,n,i,s)+a+t[l]+oh[u]|0;a=s,s=i,i=lh(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Kr.prototype._hash=function(){var e=sh.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var dh=Kr,hh=nt,fl=Cr,fh=Bt.Buffer,ph=[1518500249,1859775393,-1894007588,-899497514],gh=new Array(80);function Qr(){this.init(),this._w=gh,fl.call(this,64,56)}hh(Qr,fl);Qr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _h(e){return e<<1|e>>>31}function mh(e){return e<<5|e>>>27}function bh(e){return e<<30|e>>>2}function yh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Qr.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)t[o]=e.readInt32BE(o*4);for(;o<80;++o)t[o]=_h(t[o-3]^t[o-8]^t[o-14]^t[o-16]);for(var l=0;l<80;++l){var u=~~(l/20),f=mh(r)+yh(u,n,i,s)+a+t[l]+ph[u]|0;a=s,s=i,i=bh(n),n=r,r=f}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Qr.prototype._hash=function(){var e=fh.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var wh=Qr,Eh=nt,pl=Cr,vh=Bt.Buffer,Sh=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Rh=new Array(64);function Yr(){this.init(),this._w=Rh,pl.call(this,64,56)}Eh(Yr,pl);Yr.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Ch(e,t,r){return r^e&(t^r)}function kh(e,t,r){return e&t|r&(e|t)}function Ih(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function xh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Ah(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function Th(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Yr.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,o=this._f|0,l=this._g|0,u=this._h|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<64;++f)t[f]=Th(t[f-2])+t[f-7]+Ah(t[f-15])+t[f-16]|0;for(var h=0;h<64;++h){var g=u+xh(a)+Ch(a,o,l)+Sh[h]+t[h]|0,_=Ih(r)+kh(r,n,i)|0;u=l,l=o,o=a,a=s+g|0,s=i,i=n,n=r,r=g+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=o+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0};Yr.prototype._hash=function(){var e=vh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var gl=Yr,Mh=nt,Nh=gl,Lh=Cr,Bh=Bt.Buffer,Ph=new Array(64);function Qn(){this.init(),this._w=Ph,Lh.call(this,64,56)}Mh(Qn,Nh);Qn.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Qn.prototype._hash=function(){var e=Bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var Oh=Qn,$h=nt,_l=Cr,Fh=Bt.Buffer,ca=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Dh=new Array(160);function Xr(){this.init(),this._w=Dh,_l.call(this,128,112)}$h(Xr,_l);Xr.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function la(e,t,r){return r^e&(t^r)}function ua(e,t,r){return e&t|r&(e|t)}function da(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ha(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function jh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Uh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function Hh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Wh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Te(e,t){return e>>>0<t>>>0?1:0}Xr.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,o=this._fh|0,l=this._gh|0,u=this._hh|0,f=this._al|0,h=this._bl|0,g=this._cl|0,_=this._dl|0,E=this._el|0,x=this._fl|0,R=this._gl|0,b=this._hl|0,v=0;v<32;v+=2)t[v]=e.readInt32BE(v*4),t[v+1]=e.readInt32BE(v*4+4);for(;v<160;v+=2){var S=t[v-30],M=t[v-15*2+1],A=jh(S,M),B=Uh(M,S);S=t[v-2*2],M=t[v-2*2+1];var K=Hh(S,M),H=Wh(M,S),D=t[v-7*2],ie=t[v-7*2+1],oe=t[v-16*2],ae=t[v-16*2+1],pe=B+ie|0,$=A+D+Te(pe,B)|0;pe=pe+H|0,$=$+K+Te(pe,H)|0,pe=pe+ae|0,$=$+oe+Te(pe,ae)|0,t[v]=$,t[v+1]=pe}for(var O=0;O<160;O+=2){$=t[O],pe=t[O+1];var V=ua(r,n,i),j=ua(f,h,g),q=da(r,f),U=da(f,r),Q=ha(a,E),G=ha(E,a),z=ca[O],re=ca[O+1],Ee=la(a,o,l),ce=la(E,x,R),k=b+G|0,I=u+Q+Te(k,b)|0;k=k+ce|0,I=I+Ee+Te(k,ce)|0,k=k+re|0,I=I+z+Te(k,re)|0,k=k+pe|0,I=I+$+Te(k,pe)|0;var P=U+j|0,J=q+V+Te(P,U)|0;u=l,b=R,l=o,R=x,o=a,x=E,E=_+k|0,a=s+I+Te(E,_)|0,s=i,_=g,i=n,g=h,n=r,h=f,f=k+P|0,r=I+J+Te(f,k)|0}this._al=this._al+f|0,this._bl=this._bl+h|0,this._cl=this._cl+g|0,this._dl=this._dl+_|0,this._el=this._el+E|0,this._fl=this._fl+x|0,this._gl=this._gl+R|0,this._hl=this._hl+b|0,this._ah=this._ah+r+Te(this._al,f)|0,this._bh=this._bh+n+Te(this._bl,h)|0,this._ch=this._ch+i+Te(this._cl,g)|0,this._dh=this._dh+s+Te(this._dl,_)|0,this._eh=this._eh+a+Te(this._el,E)|0,this._fh=this._fh+o+Te(this._fl,x)|0,this._gh=this._gh+l+Te(this._gl,R)|0,this._hh=this._hh+u+Te(this._hl,b)|0};Xr.prototype._hash=function(){var e=Fh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var ml=Xr,Vh=nt,zh=ml,qh=Cr,Gh=Bt.Buffer,Jh=new Array(160);function Yn(){this.init(),this._w=Jh,qh.call(this,128,112)}Vh(Yn,zh);Yn.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};Yn.prototype._hash=function(){var e=Gh.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Zh=Yn,Jt=ll.exports=function(t){t=t.toLowerCase();var r=Jt[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};Jt.sha=dh;Jt.sha1=wh;Jt.sha224=Oh;Jt.sha256=gl;Jt.sha384=Zh;Jt.sha512=ml;var Kh=ll.exports;Object.defineProperty(Rr,"__esModule",{value:!0});Rr.Session=void 0;const fa=Kh,pa=W,ga="session:id",_a="session:secret",ma="session:linked";class bo{constructor(t,r,n,i){this._storage=t,this._id=r||(0,pa.randomBytesHex)(16),this._secret=n||(0,pa.randomBytesHex)(32),this._key=new fa.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(ga),n=t.getItem(ma),i=t.getItem(_a);return r&&i?new bo(t,r,i,n==="1"):null}static hash(t){return new fa.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(ga,this._id),this._storage.setItem(_a,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(ma,this._linked?"1":"0")}}Rr.Session=bo;var Xn={},ei={};Object.defineProperty(ei,"__esModule",{value:!0});ei.Cipher=void 0;const yn=W;class Qh{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,yn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),o=16,l=a.slice(a.byteLength-o),u=a.slice(0,a.byteLength-o),f=new Uint8Array(l),h=new Uint8Array(u),g=new Uint8Array([...n,...f,...h]);return(0,yn.uint8ArrayToHex)(g)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,yn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,yn.hexStringToUint8Array)(t),o=a.slice(0,12),l=a.slice(12,28),u=a.slice(28),f=new Uint8Array([...u,...l]),h={name:"AES-GCM",iv:new Uint8Array(o)};try{const g=await window.crypto.subtle.decrypt(h,s,f),_=new TextDecoder;n(_.decode(g))}catch(g){i(g)}})()})}}ei.Cipher=Qh;var ti={};Object.defineProperty(ti,"__esModule",{value:!0});ti.WalletLinkHTTP=void 0;class Yh{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.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 t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&t!==void 0?t:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}ti.WalletLinkHTTP=Yh;var fr={};Object.defineProperty(fr,"__esModule",{value:!0});fr.WalletLinkWebSocket=fr.ConnectionState=void 0;var ar;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(ar||(fr.ConnectionState=ar={}));class Xh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,ar.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,ar.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,ar.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(l=>this.sendData(l)),this.pendingData=[])},i.onmessage=s=>{var a,o;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const l=JSON.parse(s.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,l)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,ar.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}fr.WalletLinkWebSocket=Xh;Object.defineProperty(Xn,"__esModule",{value:!0});Xn.WalletLinkConnection=void 0;const tr=xe,ef=ei,ct=Sr,ba=Ke,rr=Rr,tf=ti,wn=fr,ya=1e4,rf=6e4;class nf{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=o=>{if(!o)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",u=>o.JsonRpcUrl&&this.handleChainUpdated(u,o.JsonRpcUrl)]]).forEach((u,f)=>{const h=o[f];h!==void 0&&u(h)})},this.handleDestroyed=o=>{var l,u;o==="1"&&((l=this.listener)===null||l===void 0||l.resetAndReload(),(u=this.diagnostic)===null||u===void 0||u.log(ct.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:rr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async o=>{var l,u;try{const f=await this.cipher.decrypt(o);(l=this.listener)===null||l===void 0||l.accountUpdated(f)}catch{(u=this.diagnostic)===null||u===void 0||u.log(ct.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(o,l)=>{var u,f;try{const h=await this.cipher.decrypt(l);(u=this.listener)===null||u===void 0||u.metadataUpdated(o,h)}catch{(f=this.diagnostic)===null||f===void 0||f.log(ct.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:o})}},this.handleWalletUsernameUpdated=async o=>{this.handleMetadataUpdated(ba.WALLET_USER_NAME_KEY,o)},this.handleAppVersionUpdated=async o=>{this.handleMetadataUpdated(ba.APP_VERSION_KEY,o)},this.handleChainUpdated=async(o,l)=>{var u,f;try{const h=await this.cipher.decrypt(o),g=await this.cipher.decrypt(l);(u=this.listener)===null||u===void 0||u.chainUpdated(h,g)}catch{(f=this.diagnostic)===null||f===void 0||f.log(ct.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new ef.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new wn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async o=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ct.EVENTS.CONNECTED_STATE_CHANGE,{state:o,sessionIdHash:rr.Session.hash(t.id)});let u=!1;switch(o){case wn.ConnectionState.DISCONNECTED:if(!this.destroyed){const f=async()=>{await new Promise(h=>setTimeout(h,5e3)),this.destroyed||a.connect().catch(()=>{f()})};f()}break;case wn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),u=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},ya),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case wn.ConnectionState.CONNECTING:break}this.connected!==u&&(this.connected=u)}),a.setIncomingDataListener(o=>{var l,u,f;switch(o.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const h=o.type==="IsLinkedOK"?o.linked:void 0;(l=this.diagnostic)===null||l===void 0||l.log(ct.EVENTS.LINKED,{sessionIdHash:rr.Session.hash(t.id),linked:h,type:o.type,onlineGuests:o.onlineGuests}),this.linked=h||o.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(u=this.diagnostic)===null||u===void 0||u.log(ct.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:rr.Session.hash(t.id),metadata_keys:o&&o.metadata?Object.keys(o.metadata):void 0}),this.handleSessionMetadataUpdated(o.metadata);break}case"Event":{this.handleIncomingEvent(o);break}}o.id!==void 0&&((f=this.requestResolutions.get(o.id))===null||f===void 0||f(o))}),this.ws=a,this.http=new tf.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(ct.EVENTS.STARTED_CONNECTING,{sessionIdHash:rr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(ct.EVENTS.DISCONNECTED,{sessionIdHash:rr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ct.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(t){this.ws.sendData(JSON.stringify(t))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>ya*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=rf){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}Xn.WalletLinkConnection=nf;var en={},tn={},yo={};Object.defineProperty(yo,"__esModule",{value:!0});yo.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 sf=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tn,"__esModule",{value:!0});tn.injectCssReset=void 0;const of=sf(yo);function af(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(of.default)),document.documentElement.appendChild(e)}tn.injectCssReset=af;var ri={},rn,we,bl,yl,Dt,wa,wl,El,vl,wo,to,ro,Sl,Fr={},Rl=[],cf=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,nn=Array.isArray;function gt(e,t){for(var r in t)e[r]=t[r];return e}function Eo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function no(e,t,r){var n,i,s,a={};for(s in t)s=="key"?n=t[s]:s=="ref"?i=t[s]:a[s]=t[s];if(arguments.length>2&&(a.children=arguments.length>3?rn.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)a[s]==null&&(a[s]=e.defaultProps[s]);return Br(e,a,n,i,null)}function Br(e,t,r,n,i){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++bl,__i:-1,__u:0};return i==null&&we.vnode!=null&&we.vnode(s),s}function lf(){return{current:null}}function sn(e){return e.children}function Pr(e,t){this.props=e,this.context=t}function pr(e,t){if(t==null)return e.__?pr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?pr(e):null}function Cl(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Cl(e)}}function io(e){(!e.__d&&(e.__d=!0)&&Dt.push(e)&&!On.__r++||wa!=we.debounceRendering)&&((wa=we.debounceRendering)||wl)(On)}function On(){for(var e,t,r,n,i,s,a,o=1;Dt.length;)Dt.length>o&&Dt.sort(El),e=Dt.shift(),o=Dt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,s=[],a=[],t.__P&&((r=gt({},n)).__v=n.__v+1,we.vnode&&we.vnode(r),vo(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,s,i??pr(n),!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,Al(s,r,a),r.__e!=i&&Cl(r)));On.__r=0}function kl(e,t,r,n,i,s,a,o,l,u,f){var h,g,_,E,x,R,b=n&&n.__k||Rl,v=t.length;for(l=uf(r,t,b,l,v),h=0;h<v;h++)(_=r.__k[h])!=null&&(g=_.__i==-1?Fr:b[_.__i]||Fr,_.__i=h,R=vo(e,_,g,i,s,a,o,l,u,f),E=_.__e,_.ref&&g.ref!=_.ref&&(g.ref&&So(g.ref,null,_),f.push(_.ref,_.__c||E,_)),x==null&&E!=null&&(x=E),4&_.__u||g.__k===_.__k?l=Il(_,l,e):typeof _.type=="function"&&R!==void 0?l=R:E&&(l=E.nextSibling),_.__u&=-7);return r.__e=x,l}function uf(e,t,r,n,i){var s,a,o,l,u,f=r.length,h=f,g=0;for(e.__k=new Array(i),s=0;s<i;s++)(a=t[s])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=s+g,(a=e.__k[s]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?Br(null,a,null,null,null):nn(a)?Br(sn,{children:a},null,null,null):a.constructor==null&&a.__b>0?Br(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,o=null,(u=a.__i=df(a,r,l,h))!=-1&&(h--,(o=r[u])&&(o.__u|=2)),o==null||o.__v==null?(u==-1&&(i>f?g--:i<f&&g++),typeof a.type!="function"&&(a.__u|=4)):u!=l&&(u==l-1?g--:u==l+1?g++:(u>l?g--:g++,a.__u|=4))):e.__k[s]=null;if(h)for(s=0;s<f;s++)(o=r[s])!=null&&!(2&o.__u)&&(o.__e==n&&(n=pr(o)),Ml(o,o));return n}function Il(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=Il(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=pr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function xl(e,t){return t=t||[],e==null||typeof e=="boolean"||(nn(e)?e.some(function(r){xl(r,t)}):t.push(e)),t}function df(e,t,r,n){var i,s,a=e.key,o=e.type,l=t[r];if(l===null&&e.key==null||l&&a==l.key&&o==l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,s=r+1;i>=0||s<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&a==l.key&&o==l.type)return i;i--}if(s<t.length){if((l=t[s])&&!(2&l.__u)&&a==l.key&&o==l.type)return s;s++}}return-1}function Ea(e,t,r){t[0]=="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||cf.test(t)?r:r+"px"}function En(e,t,r,n,i){var s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Ea(e.style,t,"");if(r)for(t in r)n&&r[t]==n[t]||Ea(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(vl,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.u=n.u:(r.u=wo,e.addEventListener(t,s?ro:to,s)):e.removeEventListener(t,s?ro:to,s);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function va(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.t==null)t.t=wo++;else if(t.t<r.u)return;return r(we.event?we.event(t):t)}}}function vo(e,t,r,n,i,s,a,o,l,u){var f,h,g,_,E,x,R,b,v,S,M,A,B,K,H,D,ie,oe=t.type;if(t.constructor!=null)return null;128&r.__u&&(l=!!(32&r.__u),s=[o=t.__e=r.__e]),(f=we.__b)&&f(t);e:if(typeof oe=="function")try{if(b=t.props,v="prototype"in oe&&oe.prototype.render,S=(f=oe.contextType)&&n[f.__c],M=f?S?S.props.value:f.__:n,r.__c?R=(h=t.__c=r.__c).__=h.__E:(v?t.__c=h=new oe(b,M):(t.__c=h=new Pr(b,M),h.constructor=oe,h.render=ff),S&&S.sub(h),h.props=b,h.state||(h.state={}),h.context=M,h.__n=n,g=h.__d=!0,h.__h=[],h._sb=[]),v&&h.__s==null&&(h.__s=h.state),v&&oe.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=gt({},h.__s)),gt(h.__s,oe.getDerivedStateFromProps(b,h.__s))),_=h.props,E=h.state,h.__v=t,g)v&&oe.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),v&&h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(v&&oe.getDerivedStateFromProps==null&&b!==_&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(b,M),!h.__e&&h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(b,h.__s,M)===!1||t.__v==r.__v){for(t.__v!=r.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ae){ae&&(ae.__=t)}),A=0;A<h._sb.length;A++)h.__h.push(h._sb[A]);h._sb=[],h.__h.length&&a.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(b,h.__s,M),v&&h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(_,E,x)})}if(h.context=M,h.props=b,h.__P=e,h.__e=!1,B=we.__r,K=0,v){for(h.state=h.__s,h.__d=!1,B&&B(t),f=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[]}else do h.__d=!1,B&&B(t),f=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++K<25);h.state=h.__s,h.getChildContext!=null&&(n=gt(gt({},n),h.getChildContext())),v&&!g&&h.getSnapshotBeforeUpdate!=null&&(x=h.getSnapshotBeforeUpdate(_,E)),D=f,f!=null&&f.type===sn&&f.key==null&&(D=Tl(f.props.children)),o=kl(e,nn(D)?D:[D],t,r,n,i,s,a,o,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&a.push(h),R&&(h.__E=h.__=null)}catch(ae){if(t.__v=null,l||s!=null)if(ae.then){for(t.__u|=l?160:128;o&&o.nodeType==8&&o.nextSibling;)o=o.nextSibling;s[s.indexOf(o)]=null,t.__e=o}else for(ie=s.length;ie--;)Eo(s[ie]);else t.__e=r.__e,t.__k=r.__k;we.__e(ae,t,r)}else s==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):o=t.__e=hf(r.__e,t,r,n,i,s,a,l,u);return(f=we.diffed)&&f(t),128&t.__u?void 0:o}function Al(e,t,r){for(var n=0;n<r.length;n++)So(r[n],r[++n],r[++n]);we.__c&&we.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){we.__e(s,i.__v)}})}function Tl(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:nn(e)?e.map(Tl):gt({},e)}function hf(e,t,r,n,i,s,a,o,l){var u,f,h,g,_,E,x,R=r.props,b=t.props,v=t.type;if(v=="svg"?i="http://www.w3.org/2000/svg":v=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((_=s[u])&&"setAttribute"in _==!!v&&(v?_.localName==v:_.nodeType==3)){e=_,s[u]=null;break}}if(e==null){if(v==null)return document.createTextNode(b);e=document.createElementNS(i,v,b.is&&b),o&&(we.__m&&we.__m(t,s),o=!1),s=null}if(v==null)R===b||o&&e.data==b||(e.data=b);else{if(s=s&&rn.call(e.childNodes),R=r.props||Fr,!o&&s!=null)for(R={},u=0;u<e.attributes.length;u++)R[(_=e.attributes[u]).name]=_.value;for(u in R)if(_=R[u],u!="children"){if(u=="dangerouslySetInnerHTML")h=_;else if(!(u in b)){if(u=="value"&&"defaultValue"in b||u=="checked"&&"defaultChecked"in b)continue;En(e,u,null,_,i)}}for(u in b)_=b[u],u=="children"?g=_:u=="dangerouslySetInnerHTML"?f=_:u=="value"?E=_:u=="checked"?x=_:o&&typeof _!="function"||R[u]===_||En(e,u,_,R[u],i);if(f)o||h&&(f.__html==h.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(h&&(e.innerHTML=""),kl(t.type=="template"?e.content:e,nn(g)?g:[g],t,r,n,v=="foreignObject"?"http://www.w3.org/1999/xhtml":i,s,a,s?s[0]:r.__k&&pr(r,0),o,l),s!=null)for(u=s.length;u--;)Eo(s[u]);o||(u="value",v=="progress"&&E==null?e.removeAttribute("value"):E!=null&&(E!==e[u]||v=="progress"&&!E||v=="option"&&E!=R[u])&&En(e,u,E,R[u],i),u="checked",x!=null&&x!=e[u]&&En(e,u,x,R[u],i))}return e}function So(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){we.__e(i,r)}}function Ml(e,t,r){var n,i;if(we.unmount&&we.unmount(e),(n=e.ref)&&(n.current&&n.current!=e.__e||So(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){we.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Ml(n[i],t,r||typeof e.type!="function");r||Eo(e.__e),e.__c=e.__=e.__e=void 0}function ff(e,t,r){return this.constructor(e,r)}function Nl(e,t,r){var n,i,s,a;t==document&&(t=document.documentElement),we.__&&we.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,s=[],a=[],vo(t,e=(!n&&r||t).__k=no(sn,null,[e]),i||Fr,Fr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?rn.call(t.childNodes):null,s,!n&&r?r:i?i.__e:t.firstChild,n,a),Al(s,e,a)}function Ll(e,t){Nl(e,t,Ll)}function pf(e,t,r){var n,i,s,a,o=gt({},e.props);for(s in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)s=="key"?n=t[s]:s=="ref"?i=t[s]:o[s]=t[s]==null&&a!=null?a[s]:t[s];return arguments.length>2&&(o.children=arguments.length>3?rn.call(arguments,2):r),Br(e.type,o,n||e.key,i||e.ref,null)}function gf(e){function t(r){var n,i;return this.getChildContext||(n=new Set,(i={})[t.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(s){this.props.value!=s.value&&n.forEach(function(a){a.__e=!0,io(a)})},this.sub=function(s){n.add(s);var a=s.componentWillUnmount;s.componentWillUnmount=function(){n&&n.delete(s),a&&a.call(s)}}),r.children}return t.__c="__cC"+Sl++,t.__=e,t.Provider=t.__l=(t.Consumer=function(r,n){return r.children(n)}).contextType=t,t}rn=Rl.slice,we={__e:function(e,t,r,n){for(var i,s,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(o){e=o}throw e}},bl=0,yl=function(e){return e!=null&&e.constructor==null},Pr.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=gt({},this.state),typeof e=="function"&&(e=e(gt({},r),this.props)),e&&gt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),io(this))},Pr.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),io(this))},Pr.prototype.render=sn,Dt=[],wl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,El=function(e,t){return e.__v.__b-t.__v.__b},On.__r=0,vl=/(PointerCapture)$|Capture$/i,wo=0,to=va(!1),ro=va(!0),Sl=0;const _f=Object.freeze(Object.defineProperty({__proto__:null,Component:Pr,Fragment:sn,cloneElement:pf,createContext:gf,createElement:no,createRef:lf,h:no,hydrate:Ll,get isValidElement(){return yl},get options(){return we},render:Nl,toChildArray:xl},Symbol.toStringTag,{value:"Module"})),Ue=Hr(_f);var ni={};function Bl(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Bl(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function Sa(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=Bl(e))&&(n&&(n+=" "),n+=t);return n}const mf=Object.freeze(Object.defineProperty({__proto__:null,clsx:Sa,default:Sa},Symbol.toStringTag,{value:"Module"})),on=Hr(mf);var Rt,me,Rs,Ra,gr=0,Pl=[],Re=we,Ca=Re.__b,ka=Re.__r,Ia=Re.diffed,xa=Re.__c,Aa=Re.unmount,Ta=Re.__;function Zt(e,t){Re.__h&&Re.__h(me,e,gr||t),gr=0;var r=me.__H||(me.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Ol(e){return gr=1,$l(Dl,e)}function $l(e,t,r){var n=Zt(Rt++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Dl(void 0,t),function(o){var l=n.__N?n.__N[0]:n.__[0],u=n.t(l,o);l!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=me,!me.__f)){var i=function(o,l,u){if(!n.__c.__H)return!0;var f=n.__c.__H.__.filter(function(g){return!!g.__c});if(f.every(function(g){return!g.__N}))return!s||s.call(this,o,l,u);var h=n.__c.props!==o;return f.forEach(function(g){if(g.__N){var _=g.__[0];g.__=g.__N,g.__N=void 0,_!==g.__[0]&&(h=!0)}}),s&&s.call(this,o,l,u)||h};me.__f=!0;var s=me.shouldComponentUpdate,a=me.componentWillUpdate;me.componentWillUpdate=function(o,l,u){if(this.__e){var f=s;s=void 0,i(o,l,u),s=f}a&&a.call(this,o,l,u)},me.shouldComponentUpdate=i}return n.__N||n.__}function bf(e,t){var r=Zt(Rt++,3);!Re.__s&&Co(r.__H,t)&&(r.__=e,r.u=t,me.__H.__h.push(r))}function Fl(e,t){var r=Zt(Rt++,4);!Re.__s&&Co(r.__H,t)&&(r.__=e,r.u=t,me.__h.push(r))}function yf(e){return gr=5,Ro(function(){return{current:e}},[])}function wf(e,t,r){gr=6,Fl(function(){if(typeof e=="function"){var n=e(t());return function(){e(null),n&&typeof n=="function"&&n()}}if(e)return e.current=t(),function(){return e.current=null}},r==null?r:r.concat(e))}function Ro(e,t){var r=Zt(Rt++,7);return Co(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Ef(e,t){return gr=8,Ro(function(){return e},t)}function vf(e){var t=me.context[e.__c],r=Zt(Rt++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(me)),t.props.value):e.__}function Sf(e,t){Re.useDebugValue&&Re.useDebugValue(t?t(e):e)}function Rf(e){var t=Zt(Rt++,10),r=Ol();return t.__=e,me.componentDidCatch||(me.componentDidCatch=function(n,i){t.__&&t.__(n,i),r[1](n)}),[r[0],function(){r[1](void 0)}]}function Cf(){var e=Zt(Rt++,11);if(!e.__){for(var t=me.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function kf(){for(var e;e=Pl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ln),e.__H.__h.forEach(so),e.__H.__h=[]}catch(t){e.__H.__h=[],Re.__e(t,e.__v)}}Re.__b=function(e){me=null,Ca&&Ca(e)},Re.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ta&&Ta(e,t)},Re.__r=function(e){ka&&ka(e),Rt=0;var t=(me=e.__c).__H;t&&(Rs===me?(t.__h=[],me.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Ln),t.__h.forEach(so),t.__h=[],Rt=0)),Rs=me},Re.diffed=function(e){Ia&&Ia(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Pl.push(t)!==1&&Ra===Re.requestAnimationFrame||((Ra=Re.requestAnimationFrame)||If)(kf)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Rs=me=null},Re.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Ln),r.__h=r.__h.filter(function(n){return!n.__||so(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Re.__e(n,r.__v)}}),xa&&xa(e,t)},Re.unmount=function(e){Aa&&Aa(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Ln(n)}catch(i){t=i}}),r.__H=void 0,t&&Re.__e(t,r.__v))};var Ma=typeof requestAnimationFrame=="function";function If(e){var t,r=function(){clearTimeout(n),Ma&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Ma&&(t=requestAnimationFrame(r))}function Ln(e){var t=me,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),me=t}function so(e){var t=me;e.__c=e.__(),me=t}function Co(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Dl(e,t){return typeof t=="function"?t(e):t}const xf=Object.freeze(Object.defineProperty({__proto__:null,useCallback:Ef,useContext:vf,useDebugValue:Sf,useEffect:bf,useErrorBoundary:Rf,useId:Cf,useImperativeHandle:wf,useLayoutEffect:Fl,useMemo:Ro,useReducer:$l,useRef:yf,useState:Ol},Symbol.toStringTag,{value:"Module"})),ii=Hr(xf);var _r={},si={};Object.defineProperty(si,"__esModule",{value:!0});si.CloseIcon=void 0;const Na=Ue;function Af(e){return(0,Na.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,Na.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"}))}si.CloseIcon=Af;var oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.CoinbaseWalletRound=void 0;const vn=Ue;function Tf(e){return(0,vn.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,vn.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,vn.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,vn.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"}))}oi.CoinbaseWalletRound=Tf;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.QRCodeIcon=void 0;const Tr=Ue;function Mf(e){return(0,Tr.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),(0,Tr.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Tr.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Tr.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Tr.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}ai.QRCodeIcon=Mf;var ci={};function jl(e){this.mode=Ve.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var n=[],i=this.data.charCodeAt(t);i>65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,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))}jl.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}};function _t(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}_t.prototype={addData:function(e){var t=new jl(e);this.dataList.push(t),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){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(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=_t.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+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[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=Se.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s<this.modules.length;s++)for(var a=s*i,o=0;o<this.modules[s].length;o++){var l=o*i,u=this.modules[s][o];u&&(n.beginFill(0,100),n.moveTo(l,a),n.lineTo(l+i,a),n.lineTo(l+i,a+i),n.lineTo(l,a+i),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]==null&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=Se.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(this.modules[n][i]==null)for(var s=-2;s<=2;s++)for(var a=-2;a<=2;a++)s==-2||s==2||a==-2||a==2||s==0&&a==0?this.modules[n+s][i+a]=!0:this.modules[n+s][i+a]=!1}},setupTypeNumber:function(e){for(var t=Se.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&(t>>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=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=Se.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var o=0;o<2;o++)if(this.modules[n][a-o]==null){var l=!1;s<e.length&&(l=(e[s]>>>i&1)==1);var u=Se.getMask(t,n,a-o);u&&(l=!l),this.modules[n][a-o]=l,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};_t.PAD0=236;_t.PAD1=17;_t.createData=function(e,t,r){for(var n=pt.getRSBlocks(e,t),i=new Ul,s=0;s<r.length;s++){var a=r[s];i.put(a.mode,4),i.put(a.getLength(),Se.getLengthInBits(a.mode,e)),a.write(i)}for(var o=0,s=0;s<n.length;s++)o+=n[s].dataCount;if(i.getLengthInBits()>o*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+o*8+")");for(i.getLengthInBits()+4<=o*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=o*8||(i.put(_t.PAD0,8),i.getLengthInBits()>=o*8));)i.put(_t.PAD1,8);return _t.createBytes(i,n)};_t.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),o=0;o<t.length;o++){var l=t[o].dataCount,u=t[o].totalCount-l;n=Math.max(n,l),i=Math.max(i,u),s[o]=new Array(l);for(var f=0;f<s[o].length;f++)s[o][f]=255&e.buffer[f+r];r+=l;var h=Se.getErrorCorrectPolynomial(u),g=new cr(s[o],h.getLength()-1),_=g.mod(h);a[o]=new Array(h.getLength()-1);for(var f=0;f<a[o].length;f++){var E=f+_.getLength()-a[o].length;a[o][f]=E>=0?_.get(E):0}}for(var x=0,f=0;f<t.length;f++)x+=t[f].totalCount;for(var R=new Array(x),b=0,f=0;f<n;f++)for(var o=0;o<t.length;o++)f<s[o].length&&(R[b++]=s[o][f]);for(var f=0;f<i;f++)for(var o=0;o<t.length;o++)f<a[o].length&&(R[b++]=a[o][f]);return R};var Ve={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},Mt={L:1,M:0,Q:3,H:2},xt={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},Se={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(e){for(var t=e<<10;Se.getBCHDigit(t)-Se.getBCHDigit(Se.G15)>=0;)t^=Se.G15<<Se.getBCHDigit(t)-Se.getBCHDigit(Se.G15);return(e<<10|t)^Se.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;Se.getBCHDigit(t)-Se.getBCHDigit(Se.G18)>=0;)t^=Se.G18<<Se.getBCHDigit(t)-Se.getBCHDigit(Se.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!=0;)t++,e>>>=1;return t},getPatternPosition:function(e){return Se.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case xt.PATTERN000:return(t+r)%2==0;case xt.PATTERN001:return t%2==0;case xt.PATTERN010:return r%3==0;case xt.PATTERN011:return(t+r)%3==0;case xt.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case xt.PATTERN101:return t*r%2+t*r%3==0;case xt.PATTERN110:return(t*r%2+t*r%3)%2==0;case xt.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new cr([1],0),r=0;r<e;r++)t=t.multiply(new cr([1,Me.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case Ve.MODE_NUMBER:return 10;case Ve.MODE_ALPHA_NUM:return 9;case Ve.MODE_8BIT_BYTE:return 8;case Ve.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case Ve.MODE_NUMBER:return 12;case Ve.MODE_ALPHA_NUM:return 11;case Ve.MODE_8BIT_BYTE:return 16;case Ve.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else if(t<41)switch(e){case Ve.MODE_NUMBER:return 14;case Ve.MODE_ALPHA_NUM:return 13;case Ve.MODE_8BIT_BYTE:return 16;case Ve.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}else throw new Error("type:"+t)},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var s=0,a=e.isDark(n,i),o=-1;o<=1;o++)if(!(n+o<0||t<=n+o))for(var l=-1;l<=1;l++)i+l<0||t<=i+l||o==0&&l==0||a==e.isDark(n+o,i+l)&&s++;s>5&&(r+=3+s-5)}for(var n=0;n<t-1;n++)for(var i=0;i<t-1;i++){var u=0;e.isDark(n,i)&&u++,e.isDark(n+1,i)&&u++,e.isDark(n,i+1)&&u++,e.isDark(n+1,i+1)&&u++,(u==0||u==4)&&(r+=3)}for(var n=0;n<t;n++)for(var i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(var i=0;i<t;i++)for(var n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);for(var f=0,i=0;i<t;i++)for(var n=0;n<t;n++)e.isDark(n,i)&&f++;var h=Math.abs(100*f/t/t-50)/5;return r+=h*10,r}},Me={glog:function(e){if(e<1)throw new Error("glog("+e+")");return Me.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return Me.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Le=0;Le<8;Le++)Me.EXP_TABLE[Le]=1<<Le;for(var Le=8;Le<256;Le++)Me.EXP_TABLE[Le]=Me.EXP_TABLE[Le-4]^Me.EXP_TABLE[Le-5]^Me.EXP_TABLE[Le-6]^Me.EXP_TABLE[Le-8];for(var Le=0;Le<255;Le++)Me.LOG_TABLE[Me.EXP_TABLE[Le]]=Le;function cr(e,t){if(e.length==null)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&e[r]==0;)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}cr.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=Me.gexp(Me.glog(this.get(r))+Me.glog(e.get(n)));return new cr(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=Me.glog(this.get(0))-Me.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(var n=0;n<e.getLength();n++)r[n]^=Me.gexp(Me.glog(e.get(n))+t);return new cr(r,0).mod(e)}};function pt(e,t){this.totalCount=e,this.dataCount=t}pt.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]];pt.getRSBlocks=function(e,t){var r=pt.getRsBlockTable(e,t);if(r==null)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],s=0;s<n;s++)for(var a=r[s*3+0],o=r[s*3+1],l=r[s*3+2],u=0;u<a;u++)i.push(new pt(o,l));return i};pt.getRsBlockTable=function(e,t){switch(t){case Mt.L:return pt.RS_BLOCK_TABLE[(e-1)*4+0];case Mt.M:return pt.RS_BLOCK_TABLE[(e-1)*4+1];case Mt.Q:return pt.RS_BLOCK_TABLE[(e-1)*4+2];case Mt.H:return pt.RS_BLOCK_TABLE[(e-1)*4+3];default:return}};function Ul(){this.buffer=[],this.length=0}Ul.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var r=0;r<t;r++)this.putBit((e>>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var Cs=[[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 Hl(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];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 Mt.L;case"M":return Mt.M;case"Q":return Mt.Q;case"H":return Mt.H;default:throw new Error("Unknwon error correction level: "+l)}}function n(l,u){for(var f=i(l),h=1,g=0,_=0,E=Cs.length;_<=E;_++){var x=Cs[_];if(!x)throw new Error("Content too long: expected "+g+" but got "+f);switch(u){case"L":g=x[0];break;case"M":g=x[1];break;case"Q":g=x[2];break;case"H":g=x[3];break;default:throw new Error("Unknwon error correction level: "+u)}if(f<=g)break;h++}if(h>Cs.length)throw new Error("Content too long");return h}function i(l){var u=encodeURI(l).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return u.length+(u.length!=l?3:0)}var s=this.options.content,a=n(s,this.options.ecl),o=r(this.options.ecl);this.qrcode=new _t(a,o),this.qrcode.addData(s),this.qrcode.make()}Hl.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r
7
+ `:"",a=t.width,o=t.height,l=r.length,u=a/(l+2*t.padding),f=o/(l+2*t.padding),h=typeof t.join<"u"?!!t.join:!1,g=typeof t.swap<"u"?!!t.swap:!1,_=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,E=typeof t.predefined<"u"?!!t.predefined:!1,x=E?i+'<defs><path id="qrmodule" d="M0 0 h'+f+" v"+u+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+s:"",R=i+'<rect x="0" y="0" width="'+a+'" height="'+o+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+s,b="",v="",S=0;S<l;S++)for(var M=0;M<l;M++){var A=r[M][S];if(A){var B=M*u+t.padding*u,K=S*f+t.padding*f;if(g){var H=B;B=K,K=H}if(h){var D=u+B,ie=f+K;B=Number.isInteger(B)?Number(B):B.toFixed(2),K=Number.isInteger(K)?Number(K):K.toFixed(2),D=Number.isInteger(D)?Number(D):D.toFixed(2),ie=Number.isInteger(ie)?Number(ie):ie.toFixed(2),v+="M"+B+","+K+" V"+ie+" H"+D+" V"+K+" H"+B+" Z "}else E?b+=i+'<use x="'+B.toString()+'" y="'+K.toString()+'" href="#qrmodule" />'+s:b+=i+'<rect x="'+B.toString()+'" y="'+K.toString()+'" width="'+u+'" height="'+f+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+s}}h&&(b=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+v+'" />');let oe="";if(this.options.image!==void 0&&this.options.image.svg){const pe=a*this.options.image.width/100,$=o*this.options.image.height/100,O=a/2-pe/2,V=o/2-$/2;oe+=`<svg x="${O}" y="${V}" width="${pe}" height="${$}" viewBox="0 0 100 100" preserveAspectRatio="xMinYMin meet">`,oe+=this.options.image.svg+s,oe+="</svg>"}var ae="";switch(e.container){case"svg":_&&(ae+='<?xml version="1.0" standalone="yes"?>'+s),ae+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+a+'" height="'+o+'">'+s,ae+=x+R+b,ae+=oe,ae+="</svg>";break;case"svg-viewbox":_&&(ae+='<?xml version="1.0" standalone="yes"?>'+s),ae+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+a+" "+o+'">'+s,ae+=x+R+b,ae+=oe,ae+="</svg>";break;case"g":ae+='<g width="'+a+'" height="'+o+'">'+s,ae+=x+R+b,ae+=oe,ae+="</g>";break;default:ae+=(x+R+b+oe).replace(/^\s+/,"");break}return ae};var Nf=Hl,Lf=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ci,"__esModule",{value:!0});ci.QRCode=void 0;const Bf=Ue,La=ii,Pf=Lf(Nf),Of=e=>{const[t,r]=(0,La.useState)("");return(0,La.useEffect)(()=>{var n,i;const s=new Pf.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(n=e.width)!==null&&n!==void 0?n:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),a=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${a}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Bf.h)("img",{src:t,alt:"QR Code"}):null};ci.QRCode=Of;var li={},ko={};Object.defineProperty(ko,"__esModule",{value:!0});ko.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 $f=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(li,"__esModule",{value:!0});li.Spinner=void 0;const Sn=Ue,Ff=$f(ko),Df=e=>{var t;const r=(t=e.size)!==null&&t!==void 0?t:64,n=e.color||"#000";return(0,Sn.h)("div",{class:"-cbwsdk-spinner"},(0,Sn.h)("style",null,Ff.default),(0,Sn.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Sn.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};li.Spinner=Df;var Io={};Object.defineProperty(Io,"__esModule",{value:!0});Io.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 Wl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_r,"__esModule",{value:!0});_r.CoinbaseWalletSteps=_r.ConnectContent=void 0;const Vt=Wl(on),de=Ue,jf=W,Uf=vr,Hf=si,Wf=oi,Vf=ai,zf=ci,qf=li,Gf=Wl(Io),ks={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Vl},Jf=e=>e==="light"?"#FFFFFF":"#0A0B0D";function Zf(e){const{theme:t}=e,r=(0,jf.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=ks.steps;return(0,de.h)("div",{"data-testid":"connect-content",className:(0,Vt.default)("-cbwsdk-connect-content",t)},(0,de.h)("style",null,Gf.default),(0,de.h)("div",{className:"-cbwsdk-connect-content-header"},(0,de.h)("h2",{className:(0,Vt.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,de.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,de.h)(Hf.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,de.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,de.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,de.h)(Kf,{title:ks.title,description:ks.description,theme:t})),(0,de.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,de.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,de.h)(zf.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,de.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Uf.LIB_VERSION}),(0,de.h)("input",{type:"hidden",value:r})),(0,de.h)(n,{theme:t}),!e.isConnected&&(0,de.h)("div",{"data-testid":"connecting-spinner",className:(0,Vt.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,de.h)(qf.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,de.h)("p",null,"Connecting...")))))}_r.ConnectContent=Zf;function Kf({title:e,description:t,theme:r}){return(0,de.h)("div",{className:(0,Vt.default)("-cbwsdk-connect-item",r)},(0,de.h)("div",null,(0,de.h)(Wf.CoinbaseWalletRound,null)),(0,de.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,de.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,de.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function Vl({theme:e}){return(0,de.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,de.h)("li",{className:(0,Vt.default)("-cbwsdk-wallet-steps-item",e)},(0,de.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,de.h)("li",{className:(0,Vt.default)("-cbwsdk-wallet-steps-item",e)},(0,de.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,de.h)("span",null,"Tap ",(0,de.h)("strong",null,"Scan")," "),(0,de.h)("span",{className:(0,Vt.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,de.h)(Vf.QRCodeIcon,{fill:Jf(e)})))))}_r.CoinbaseWalletSteps=Vl;var ui={},di={};Object.defineProperty(di,"__esModule",{value:!0});di.ArrowLeftIcon=void 0;const Ba=Ue;function Qf(e){return(0,Ba.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,Ba.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"}))}di.ArrowLeftIcon=Qf;var hi={};Object.defineProperty(hi,"__esModule",{value:!0});hi.LaptopIcon=void 0;const Is=Ue;function Yf(e){return(0,Is.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Is.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,Is.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"}))}hi.LaptopIcon=Yf;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.SafeIcon=void 0;const Pa=Ue;function Xf(e){return(0,Pa.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Pa.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"}))}fi.SafeIcon=Xf;var xo={};Object.defineProperty(xo,"__esModule",{value:!0});xo.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 zl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ui,"__esModule",{value:!0});ui.TryExtensionContent=void 0;const Pt=zl(on),Ie=Ue,xs=ii,e0=di,t0=hi,r0=fi,n0=zl(xo);function i0({theme:e}){const[t,r]=(0,xs.useState)(!1),n=(0,xs.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,xs.useCallback)(()=>{t?window.location.reload():(n(),r(!0))},[n,t]);return(0,Ie.h)("div",{class:(0,Pt.default)("-cbwsdk-try-extension",e)},(0,Ie.h)("style",null,n0.default),(0,Ie.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Ie.h)("h3",{class:(0,Pt.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,Ie.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,Ie.h)("button",{class:(0,Pt.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,Ie.h)("div",null,!t&&(0,Ie.h)(e0.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,Ie.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Ie.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,Ie.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Ie.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Ie.h)("span",{class:(0,Pt.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,Ie.h)(t0.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Ie.h)("div",{class:(0,Pt.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,Ie.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Ie.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Ie.h)("span",{class:(0,Pt.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,Ie.h)(r0.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Ie.h)("div",{class:(0,Pt.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}ui.TryExtensionContent=i0;var Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});Ao.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 ql=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ni,"__esModule",{value:!0});ni.ConnectDialog=void 0;const As=ql(on),Ot=Ue,Ts=ii,s0=_r,o0=ui,a0=ql(Ao),c0=e=>{const{isOpen:t,darkMode:r}=e,[n,i]=(0,Ts.useState)(!t),[s,a]=(0,Ts.useState)(!t);(0,Ts.useEffect)(()=>{const l=[window.setTimeout(()=>{a(!t)},10)];return t?i(!1):l.push(window.setTimeout(()=>{i(!0)},360)),()=>{l.forEach(window.clearTimeout)}},[t]);const o=r?"dark":"light";return(0,Ot.h)("div",{class:(0,As.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,Ot.h)("style",null,a0.default),(0,Ot.h)("div",{class:(0,As.default)("-cbwsdk-connect-dialog-backdrop",o,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,Ot.h)("div",{class:"-cbwsdk-connect-dialog"},(0,Ot.h)("div",{class:(0,As.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,Ot.h)(s0.ConnectContent,{theme:o,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,Ot.h)(o0.TryExtensionContent,{theme:o}))))};ni.ConnectDialog=c0;Object.defineProperty(ri,"__esModule",{value:!0});ri.LinkFlow=void 0;const Ms=Ue,l0=ni;class u0{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,Ms.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,Ms.render)((0,Ms.h)(l0.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)}}ri.LinkFlow=u0;var To={},Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});Mo.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(e){var t=Z&&Z.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const r=t(on),n=Ue,i=ii,s=t(Mo),a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(g){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=g.darkMode}attach(g){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",g.appendChild(this.root),this.render()}presentItem(g){const _=this.nextItemKey++;return this.items.set(_,g),this.render(),()=>{this.items.delete(_),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([g,_])=>(0,n.h)(e.SnackbarInstance,Object.assign({},_,{key:g}))))),this.root)}}e.Snackbar=l;const u=h=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,s.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},h.children));e.SnackbarContainer=u;const f=({autoExpand:h,message:g,menuItems:_})=>{const[E,x]=(0,i.useState)(!0),[R,b]=(0,i.useState)(h??!1);(0,i.useEffect)(()=>{const S=[window.setTimeout(()=>{x(!1)},1),window.setTimeout(()=>{b(!0)},1e4)];return()=>{S.forEach(window.clearTimeout)}});const v=()=>{b(!R)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",E&&"-cbwsdk-snackbar-instance-hidden",R&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:v},(0,n.h)("img",{src:a,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},g),(0,n.h)("div",{class:"-gear-container"},!R&&(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:o,class:"-gear-icon",title:"Expand"}))),_&&_.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},_.map((S,M)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",S.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:S.onClick,key:M},(0,n.h)("svg",{width:S.svgWidth,height:S.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":S.defaultFillRule,"clip-rule":S.defaultClipRule,d:S.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",S.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},S.info)))))};e.SnackbarInstance=f})(To);Object.defineProperty(en,"__esModule",{value:!0});en.WalletLinkRelayUI=void 0;const d0=tn,h0=ri,f0=To;class p0{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new f0.Snackbar({darkMode:t.darkMode}),this.linkFlow=new h0.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",t.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,d0.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let r;return t.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:t.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:t.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:t.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}en.WalletLinkRelayUI=p0;Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletLinkRelay=void 0;const nr=Wr,g0=xe,ve=W,$t=Sr,Oa=Ke,At=Rr,_0=Xn,Ft=Er,m0=en;class vt extends Oa.RelayAbstract{constructor(t){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{var o;this.isLinked=a;const l=this.storage.getItem(Oa.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this.session.linked=a),this.isUnlinkedErrorState=!1,l){const u=l.split(" "),f=this.storage.getItem("IsStandaloneSigning")==="true";if(u[0]!==""&&!a&&this.session.linked&&!f){this.isUnlinkedErrorState=!0;const h=this.getSessionIdHash();(o=this.diagnostic)===null||o===void 0||o.log($t.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:h})}}},this.metadataUpdated=(a,o)=>{this.storage.setItem(a,o)},this.chainUpdated=(a,o)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===o||(this.chainCallbackParams={chainId:a,jsonRpcUrl:o},this.chainCallback&&this.chainCallback(a,o))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),vt.accountRequestCallbackIds.size>0&&(Array.from(vt.accountRequestCallbackIds.values()).forEach(o=>{const l={type:"WEB3_RESPONSE",id:o,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},l),{id:o}))}),vt.accountRequestCallbackIds.clear())},this.connectedUpdated=a=>{this.ui.setConnected(a)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(r=t.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const t=At.Session.load(this.storage)||new At.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new _0.WalletLinkConnection({session:t,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:a}=this.options,o=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:a,session:t});return i.connect(),{session:t,ui:o,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,r;const n=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log($t.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=At.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((r=this.diagnostic)===null||r===void 0||r.log($t.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:At.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:a,connection:o}=this.subscribe();this._session=s,this.connection=o,this.ui=a,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var r;(r=this.diagnostic)===null||r===void 0||r.log($t.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,r){this.appName=t,this.appLogoUrl=r}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,r){this.storage.setItem(t,r)}signEthereumMessage(t,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,ve.hexStringFromBuffer)(t,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,ve.hexStringFromBuffer)(t,!0),signature:(0,ve.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,ve.bigIntStringFromBN)(t.weiValue),data:(0,ve.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,ve.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,ve.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,ve.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,ve.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,ve.bigIntStringFromBN)(t.weiValue),data:(0,ve.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,ve.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,ve.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,ve.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,ve.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,ve.hexStringFromBuffer)(t,!0),chainId:r}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,ve.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,r){return this.sendRequest({method:"generic",params:{action:r,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let r=null;const n=(0,ve.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,a),r==null||r()};return{promise:new Promise((a,o)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,l=>{if(r==null||r(),(0,Ft.isErrorResponse)(l))return o(new Error(l.errorMessage));a(l)}),this.ui.isStandalone()?this.sendRequestStandalone(n,t):this.publishWeb3RequestEvent(n,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof m0.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,r){var n;const i={type:"WEB3_REQUEST",id:t,request:r},s=At.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log($t.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?At.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(a=>{var o;(o=this.diagnostic)===null||o===void 0||o.log($t.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?At.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(a=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:a.message}})})}publishWeb3RequestCanceledEvent(t){const r={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(t,r,n){return this.connection.publishEvent(t,r,n)}handleWeb3ResponseMessage(t){var r;const{response:n}=t;if((r=this.diagnostic)===null||r===void 0||r.log($t.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){vt.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),vt.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,r,n,i){var s;const a=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,nr.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:r,errorMessage:a,errorCode:i}})}invokeCallback(t){const r=this.relayEventManager.callbacks.get(t.id);r&&(r(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,ve.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s)};return{promise:new Promise((s,a)=>{if(this.relayEventManager.callbacks.set(r,o=>{if(this.ui.hideRequestEthereumAccounts(),(0,Ft.isErrorResponse)(o))return a(new Error(o.errorMessage));s(o)}),this.ui.inlineAccountsResponse()){const o=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:l}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:o})}else{const o=nr.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(o)})}vt.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,t)}),cancel:n}}selectProvider(t){const r={method:"selectProvider",params:{providerOptions:t}},n=(0,ve.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,a)},s=new Promise((a,o)=>{this.relayEventManager.callbacks.set(n,f=>{if((0,Ft.isErrorResponse)(f))return o(new Error(f.errorMessage));a(f)});const l=f=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:g0.ProviderType.Unselected}})},u=f=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:f}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:u,onCancel:l,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,r,n,i,s,a){const o={method:"watchAsset",params:{type:t,options:{address:r,symbol:n,decimals:i,image:s},chainId:a}};let l=null;const u=(0,ve.randomBytesHex)(8),f=g=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,g),l==null||l()};this.ui.inlineWatchAsset()||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:f,onResetConnection:this.resetAndReload}));const h=new Promise((g,_)=>{this.relayEventManager.callbacks.set(u,R=>{if(l==null||l(),(0,Ft.isErrorResponse)(R))return _(new Error(R.errorMessage));g(R)});const E=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"watchAsset",result:!1}})},x=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:x,onCancel:E,type:t,address:r,symbol:n,decimals:i,image:s,chainId:a}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(u,o)});return{cancel:f,promise:h}}addEthereumChain(t,r,n,i,s,a){const o={method:"addEthereumChain",params:{chainId:t,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:a}};let l=null;const u=(0,ve.randomBytesHex)(8),f=g=>{this.publishWeb3RequestCanceledEvent(u),this.handleErrorResponse(u,o.method,g),l==null||l()};return this.ui.inlineAddEthereumChain(t)||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:f,onResetConnection:this.resetAndReload})),{promise:new Promise((g,_)=>{this.relayEventManager.callbacks.set(u,R=>{if(l==null||l(),(0,Ft.isErrorResponse)(R))return _(new Error(R.errorMessage));g(R)});const E=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},x=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:u,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:R}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:E,onApprove:x,chainId:o.params.chainId,rpcUrls:o.params.rpcUrls,blockExplorerUrls:o.params.blockExplorerUrls,chainName:o.params.chainName,iconUrls:o.params.iconUrls,nativeCurrency:o.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(u,o)}),cancel:f}}switchEthereumChain(t,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:r})},i=(0,ve.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,o)};return{promise:new Promise((o,l)=>{this.relayEventManager.callbacks.set(i,h=>{if((0,Ft.isErrorResponse)(h)&&h.errorCode)return l(nr.standardErrors.provider.custom({code:h.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Ft.isErrorResponse)(h))return l(new Error(h.errorMessage));o(h)});const u=h=>{var g;if(h){const _=(g=(0,nr.getErrorCode)(h))!==null&&g!==void 0?g:nr.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",h instanceof Error?h:nr.standardErrors.provider.unsupportedChain(t),_)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},f=h=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:h}}})};this.ui.switchEthereumChain({onCancel:u,onApprove:f,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return At.Session.hash(this._session.id)}sendRequestStandalone(t,r){const n=s=>{this.handleErrorResponse(t,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}Jr.WalletLinkRelay=vt;vt.accountRequestCallbackIds=new Set;var an={},pi={},Gl={};(function(e){var t=Z&&Z.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Z&&Z.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(To,e)})(Gl);var No={};Object.defineProperty(No,"__esModule",{value:!0});No.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 Jl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pi,"__esModule",{value:!0});pi.RedirectDialog=void 0;const b0=Jl(on),ht=Ue,y0=tn,w0=Gl,E0=Jl(No);class v0{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,y0.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,ht.render)(null,this.root),t&&(0,ht.render)((0,ht.h)(S0,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}pi.RedirectDialog=v0;const S0=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,ht.h)(w0.SnackbarContainer,{darkMode:r},(0,ht.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,ht.h)("style",null,E0.default),(0,ht.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,ht.h)("div",{class:(0,b0.default)("-cbwsdk-redirect-dialog-box",s)},(0,ht.h)("p",null,e),(0,ht.h)("button",{onClick:n},t))))};Object.defineProperty(an,"__esModule",{value:!0});an.MobileRelayUI=void 0;const R0=pi;class C0{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new R0.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),t&&r.searchParams.append("wl_url",t);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){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}}an.MobileRelayUI=C0;Object.defineProperty(Gr,"__esModule",{value:!0});Gr.MobileRelay=void 0;const k0=W,I0=Jr,x0=an;class A0 extends I0.WalletLinkRelay{constructor(t){var r;super(t),this._enableMobileWalletLink=(r=t.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,k0.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,r){if(super.publishWeb3RequestEvent(t,r),!(this._enableMobileWalletLink&&this.ui instanceof x0.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(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){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:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}Gr.MobileRelay=A0;var oo={exports:{}},Zl=Un.EventEmitter,Ns,$a;function T0(){if($a)return Ns;$a=1;function e(E,x){var R=Object.keys(E);if(Object.getOwnPropertySymbols){var b=Object.getOwnPropertySymbols(E);x&&(b=b.filter(function(v){return Object.getOwnPropertyDescriptor(E,v).enumerable})),R.push.apply(R,b)}return R}function t(E){for(var x=1;x<arguments.length;x++){var R=arguments[x]!=null?arguments[x]:{};x%2?e(Object(R),!0).forEach(function(b){r(E,b,R[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(E,Object.getOwnPropertyDescriptors(R)):e(Object(R)).forEach(function(b){Object.defineProperty(E,b,Object.getOwnPropertyDescriptor(R,b))})}return E}function r(E,x,R){return x=a(x),x in E?Object.defineProperty(E,x,{value:R,enumerable:!0,configurable:!0,writable:!0}):E[x]=R,E}function n(E,x){if(!(E instanceof x))throw new TypeError("Cannot call a class as a function")}function i(E,x){for(var R=0;R<x.length;R++){var b=x[R];b.enumerable=b.enumerable||!1,b.configurable=!0,"value"in b&&(b.writable=!0),Object.defineProperty(E,a(b.key),b)}}function s(E,x,R){return x&&i(E.prototype,x),Object.defineProperty(E,"prototype",{writable:!1}),E}function a(E){var x=o(E,"string");return typeof x=="symbol"?x:String(x)}function o(E,x){if(typeof E!="object"||E===null)return E;var R=E[Symbol.toPrimitive];if(R!==void 0){var b=R.call(E,x||"default");if(typeof b!="object")return b;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(E)}var l=Zr,u=l.Buffer,f=Zc,h=f.inspect,g=h&&h.custom||"inspect";function _(E,x,R){u.prototype.copy.call(E,x,R)}return Ns=function(){function E(){n(this,E),this.head=null,this.tail=null,this.length=0}return s(E,[{key:"push",value:function(R){var b={data:R,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length}},{key:"unshift",value:function(R){var b={data:R,next:this.head};this.length===0&&(this.tail=b),this.head=b,++this.length}},{key:"shift",value:function(){if(this.length!==0){var R=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,R}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(R){if(this.length===0)return"";for(var b=this.head,v=""+b.data;b=b.next;)v+=R+b.data;return v}},{key:"concat",value:function(R){if(this.length===0)return u.alloc(0);for(var b=u.allocUnsafe(R>>>0),v=this.head,S=0;v;)_(v.data,b,S),S+=v.data.length,v=v.next;return b}},{key:"consume",value:function(R,b){var v;return R<this.head.data.length?(v=this.head.data.slice(0,R),this.head.data=this.head.data.slice(R)):R===this.head.data.length?v=this.shift():v=b?this._getString(R):this._getBuffer(R),v}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(R){var b=this.head,v=1,S=b.data;for(R-=S.length;b=b.next;){var M=b.data,A=R>M.length?M.length:R;if(A===M.length?S+=M:S+=M.slice(0,R),R-=A,R===0){A===M.length?(++v,b.next?this.head=b.next:this.head=this.tail=null):(this.head=b,b.data=M.slice(A));break}++v}return this.length-=v,S}},{key:"_getBuffer",value:function(R){var b=u.allocUnsafe(R),v=this.head,S=1;for(v.data.copy(b),R-=v.data.length;v=v.next;){var M=v.data,A=R>M.length?M.length:R;if(M.copy(b,b.length-R,0,A),R-=A,R===0){A===M.length?(++S,v.next?this.head=v.next:this.head=this.tail=null):(this.head=v,v.data=M.slice(A));break}++S}return this.length-=S,b}},{key:g,value:function(R,b){return h(this,t(t({},b),{},{depth:0,customInspect:!1}))}}]),E}(),Ns}function M0(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(ao,this,e)):process.nextTick(ao,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(Bn,r):(r._writableState.errorEmitted=!0,process.nextTick(Fa,r,s)):process.nextTick(Fa,r,s):t?(process.nextTick(Bn,r),t(s)):process.nextTick(Bn,r)}),this)}function Fa(e,t){ao(e,t),Bn(e)}function Bn(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function N0(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function ao(e,t){e.emit("error",t)}function L0(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var Kl={destroy:M0,undestroy:N0,errorOrDestroy:L0},Kt={};function B0(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Ql={};function Xe(e,t,r){r||(r=Error);function n(s,a,o){return typeof t=="string"?t:t(s,a,o)}var i=function(s){B0(a,s);function a(o,l,u){return s.call(this,n(o,l,u))||this}return a}(r);i.prototype.name=r.name,i.prototype.code=e,Ql[e]=i}function Da(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function P0(e,t,r){return e.substr(0,t.length)===t}function O0(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function $0(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Xe("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Xe("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&P0(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(O0(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Da(t,"type"));else{var s=$0(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Da(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);Xe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Xe("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Xe("ERR_STREAM_PREMATURE_CLOSE","Premature close");Xe("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Xe("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Xe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Xe("ERR_STREAM_WRITE_AFTER_END","write after end");Xe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Xe("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Xe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");Kt.codes=Ql;var F0=Kt.codes.ERR_INVALID_OPT_VALUE;function D0(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function j0(e,t,r,n){var i=D0(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new F0(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var Yl={getHighWaterMark:j0},U0=H0;function H0(e,t){if(Ls("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Ls("throwDeprecation"))throw new Error(t);Ls("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Ls(e){try{if(!Z.localStorage)return!1}catch{return!1}var t=Z.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Bs,ja;function Xl(){if(ja)return Bs;ja=1,Bs=H;function e(k){var I=this;this.next=null,this.entry=null,this.finish=function(){ce(I,k)}}var t;H.WritableState=B;var r={deprecate:U0},n=Zl,i=Zr.Buffer,s=(typeof Z<"u"?Z:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function a(k){return i.from(k)}function o(k){return i.isBuffer(k)||k instanceof s}var l=Kl,u=Yl,f=u.getHighWaterMark,h=Kt.codes,g=h.ERR_INVALID_ARG_TYPE,_=h.ERR_METHOD_NOT_IMPLEMENTED,E=h.ERR_MULTIPLE_CALLBACK,x=h.ERR_STREAM_CANNOT_PIPE,R=h.ERR_STREAM_DESTROYED,b=h.ERR_STREAM_NULL_VALUES,v=h.ERR_STREAM_WRITE_AFTER_END,S=h.ERR_UNKNOWN_ENCODING,M=l.errorOrDestroy;nt(H,n);function A(){}function B(k,I,P){t=t||mr(),k=k||{},typeof P!="boolean"&&(P=I instanceof t),this.objectMode=!!k.objectMode,P&&(this.objectMode=this.objectMode||!!k.writableObjectMode),this.highWaterMark=f(this,k,"writableHighWaterMark",P),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=k.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=k.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(X){V(I,X)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=k.emitClose!==!1,this.autoDestroy=!!k.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}B.prototype.getBuffer=function(){for(var I=this.bufferedRequest,P=[];I;)P.push(I),I=I.next;return P},function(){try{Object.defineProperty(B.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var K;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(K=Function.prototype[Symbol.hasInstance],Object.defineProperty(H,Symbol.hasInstance,{value:function(I){return K.call(this,I)?!0:this!==H?!1:I&&I._writableState instanceof B}})):K=function(I){return I instanceof this};function H(k){t=t||mr();var I=this instanceof t;if(!I&&!K.call(H,this))return new H(k);this._writableState=new B(k,this,I),this.writable=!0,k&&(typeof k.write=="function"&&(this._write=k.write),typeof k.writev=="function"&&(this._writev=k.writev),typeof k.destroy=="function"&&(this._destroy=k.destroy),typeof k.final=="function"&&(this._final=k.final)),n.call(this)}H.prototype.pipe=function(){M(this,new x)};function D(k,I){var P=new v;M(k,P),process.nextTick(I,P)}function ie(k,I,P,J){var X;return P===null?X=new b:typeof P!="string"&&!I.objectMode&&(X=new g("chunk",["string","Buffer"],P)),X?(M(k,X),process.nextTick(J,X),!1):!0}H.prototype.write=function(k,I,P){var J=this._writableState,X=!1,y=!J.objectMode&&o(k);return y&&!i.isBuffer(k)&&(k=a(k)),typeof I=="function"&&(P=I,I=null),y?I="buffer":I||(I=J.defaultEncoding),typeof P!="function"&&(P=A),J.ending?D(this,P):(y||ie(this,J,k,P))&&(J.pendingcb++,X=ae(this,J,y,k,I,P)),X},H.prototype.cork=function(){this._writableState.corked++},H.prototype.uncork=function(){var k=this._writableState;k.corked&&(k.corked--,!k.writing&&!k.corked&&!k.bufferProcessing&&k.bufferedRequest&&U(this,k))},H.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new S(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(H.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function oe(k,I,P){return!k.objectMode&&k.decodeStrings!==!1&&typeof I=="string"&&(I=i.from(I,P)),I}Object.defineProperty(H.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function ae(k,I,P,J,X,y){if(!P){var w=oe(I,J,X);J!==w&&(P=!0,X="buffer",J=w)}var L=I.objectMode?1:J.length;I.length+=L;var F=I.length<I.highWaterMark;if(F||(I.needDrain=!0),I.writing||I.corked){var _e=I.lastBufferedRequest;I.lastBufferedRequest={chunk:J,encoding:X,isBuf:P,callback:y,next:null},_e?_e.next=I.lastBufferedRequest:I.bufferedRequest=I.lastBufferedRequest,I.bufferedRequestCount+=1}else pe(k,I,!1,L,J,X,y);return F}function pe(k,I,P,J,X,y,w){I.writelen=J,I.writecb=w,I.writing=!0,I.sync=!0,I.destroyed?I.onwrite(new R("write")):P?k._writev(X,I.onwrite):k._write(X,y,I.onwrite),I.sync=!1}function $(k,I,P,J,X){--I.pendingcb,P?(process.nextTick(X,J),process.nextTick(re,k,I),k._writableState.errorEmitted=!0,M(k,J)):(X(J),k._writableState.errorEmitted=!0,M(k,J),re(k,I))}function O(k){k.writing=!1,k.writecb=null,k.length-=k.writelen,k.writelen=0}function V(k,I){var P=k._writableState,J=P.sync,X=P.writecb;if(typeof X!="function")throw new E;if(O(P),I)$(k,P,J,I,X);else{var y=Q(P)||k.destroyed;!y&&!P.corked&&!P.bufferProcessing&&P.bufferedRequest&&U(k,P),J?process.nextTick(j,k,P,y,X):j(k,P,y,X)}}function j(k,I,P,J){P||q(k,I),I.pendingcb--,J(),re(k,I)}function q(k,I){I.length===0&&I.needDrain&&(I.needDrain=!1,k.emit("drain"))}function U(k,I){I.bufferProcessing=!0;var P=I.bufferedRequest;if(k._writev&&P&&P.next){var J=I.bufferedRequestCount,X=new Array(J),y=I.corkedRequestsFree;y.entry=P;for(var w=0,L=!0;P;)X[w]=P,P.isBuf||(L=!1),P=P.next,w+=1;X.allBuffers=L,pe(k,I,!0,I.length,X,"",y.finish),I.pendingcb++,I.lastBufferedRequest=null,y.next?(I.corkedRequestsFree=y.next,y.next=null):I.corkedRequestsFree=new e(I),I.bufferedRequestCount=0}else{for(;P;){var F=P.chunk,_e=P.encoding,ee=P.callback,le=I.objectMode?1:F.length;if(pe(k,I,!1,le,F,_e,ee),P=P.next,I.bufferedRequestCount--,I.writing)break}P===null&&(I.lastBufferedRequest=null)}I.bufferedRequest=P,I.bufferProcessing=!1}H.prototype._write=function(k,I,P){P(new _("_write()"))},H.prototype._writev=null,H.prototype.end=function(k,I,P){var J=this._writableState;return typeof k=="function"?(P=k,k=null,I=null):typeof I=="function"&&(P=I,I=null),k!=null&&this.write(k,I),J.corked&&(J.corked=1,this.uncork()),J.ending||Ee(this,J,P),this},Object.defineProperty(H.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function Q(k){return k.ending&&k.length===0&&k.bufferedRequest===null&&!k.finished&&!k.writing}function G(k,I){k._final(function(P){I.pendingcb--,P&&M(k,P),I.prefinished=!0,k.emit("prefinish"),re(k,I)})}function z(k,I){!I.prefinished&&!I.finalCalled&&(typeof k._final=="function"&&!I.destroyed?(I.pendingcb++,I.finalCalled=!0,process.nextTick(G,k,I)):(I.prefinished=!0,k.emit("prefinish")))}function re(k,I){var P=Q(I);if(P&&(z(k,I),I.pendingcb===0&&(I.finished=!0,k.emit("finish"),I.autoDestroy))){var J=k._readableState;(!J||J.autoDestroy&&J.endEmitted)&&k.destroy()}return P}function Ee(k,I,P){I.ending=!0,re(k,I),P&&(I.finished?process.nextTick(P):k.once("finish",P)),I.ended=!0,k.writable=!1}function ce(k,I,P){var J=k.entry;for(k.entry=null;J;){var X=J.callback;I.pendingcb--,X(P),J=J.next}I.corkedRequestsFree.next=k}return Object.defineProperty(H.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),H.prototype.destroy=l.destroy,H.prototype._undestroy=l.undestroy,H.prototype._destroy=function(k,I){I(k)},Bs}var Ps,Ua;function mr(){if(Ua)return Ps;Ua=1;var e=Object.keys||function(u){var f=[];for(var h in u)f.push(h);return f};Ps=a;var t=tu(),r=Xl();nt(a,t);for(var n=e(r.prototype),i=0;i<n.length;i++){var s=n[i];a.prototype[s]||(a.prototype[s]=r.prototype[s])}function a(u){if(!(this instanceof a))return new a(u);t.call(this,u),r.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",o)))}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(a.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(a.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function o(){this._writableState.ended||process.nextTick(l,this)}function l(u){u.end()}return Object.defineProperty(a.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(f){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=f,this._writableState.destroyed=f)}}),Ps}var Os={},Ha;function Wa(){if(Ha)return Os;Ha=1;var e=Bt.Buffer,t=e.isEncoding||function(b){switch(b=""+b,b&&b.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(b){if(!b)return"utf8";for(var v;;)switch(b){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return b;default:if(v)return;b=(""+b).toLowerCase(),v=!0}}function n(b){var v=r(b);if(typeof v!="string"&&(e.isEncoding===t||!t(b)))throw new Error("Unknown encoding: "+b);return v||b}Os.StringDecoder=i;function i(b){this.encoding=n(b);var v;switch(this.encoding){case"utf16le":this.text=h,this.end=g,v=4;break;case"utf8":this.fillLast=l,v=4;break;case"base64":this.text=_,this.end=E,v=3;break;default:this.write=x,this.end=R;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(v)}i.prototype.write=function(b){if(b.length===0)return"";var v,S;if(this.lastNeed){if(v=this.fillLast(b),v===void 0)return"";S=this.lastNeed,this.lastNeed=0}else S=0;return S<b.length?v?v+this.text(b,S):this.text(b,S):v||""},i.prototype.end=f,i.prototype.text=u,i.prototype.fillLast=function(b){if(this.lastNeed<=b.length)return b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,this.lastTotal-this.lastNeed,0,b.length),this.lastNeed-=b.length};function s(b){return b<=127?0:b>>5===6?2:b>>4===14?3:b>>3===30?4:b>>6===2?-1:-2}function a(b,v,S){var M=v.length-1;if(M<S)return 0;var A=s(v[M]);return A>=0?(A>0&&(b.lastNeed=A-1),A):--M<S||A===-2?0:(A=s(v[M]),A>=0?(A>0&&(b.lastNeed=A-2),A):--M<S||A===-2?0:(A=s(v[M]),A>=0?(A>0&&(A===2?A=0:b.lastNeed=A-3),A):0))}function o(b,v,S){if((v[0]&192)!==128)return b.lastNeed=0,"�";if(b.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return b.lastNeed=1,"�";if(b.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return b.lastNeed=2,"�"}}function l(b){var v=this.lastTotal-this.lastNeed,S=o(this,b);if(S!==void 0)return S;if(this.lastNeed<=b.length)return b.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);b.copy(this.lastChar,v,0,b.length),this.lastNeed-=b.length}function u(b,v){var S=a(this,b,v);if(!this.lastNeed)return b.toString("utf8",v);this.lastTotal=S;var M=b.length-(S-this.lastNeed);return b.copy(this.lastChar,0,M),b.toString("utf8",v,M)}function f(b){var v=b&&b.length?this.write(b):"";return this.lastNeed?v+"�":v}function h(b,v){if((b.length-v)%2===0){var S=b.toString("utf16le",v);if(S){var M=S.charCodeAt(S.length-1);if(M>=55296&&M<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1],S.slice(0,-1)}return S}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=b[b.length-1],b.toString("utf16le",v,b.length-1)}function g(b){var v=b&&b.length?this.write(b):"";if(this.lastNeed){var S=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,S)}return v}function _(b,v){var S=(b.length-v)%3;return S===0?b.toString("base64",v):(this.lastNeed=3-S,this.lastTotal=3,S===1?this.lastChar[0]=b[b.length-1]:(this.lastChar[0]=b[b.length-2],this.lastChar[1]=b[b.length-1]),b.toString("base64",v,b.length-S))}function E(b){var v=b&&b.length?this.write(b):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function x(b){return b.toString(this.encoding)}function R(b){return b&&b.length?this.write(b):""}return Os}var Va=Kt.codes.ERR_STREAM_PREMATURE_CLOSE;function W0(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function V0(){}function z0(e){return e.setHeader&&typeof e.abort=="function"}function eu(e,t,r){if(typeof t=="function")return eu(e,null,t);t||(t={}),r=W0(r||V0);var n=t.readable||t.readable!==!1&&e.readable,i=t.writable||t.writable!==!1&&e.writable,s=function(){e.writable||o()},a=e._writableState&&e._writableState.finished,o=function(){i=!1,a=!0,n||r.call(e)},l=e._readableState&&e._readableState.endEmitted,u=function(){n=!1,l=!0,i||r.call(e)},f=function(E){r.call(e,E)},h=function(){var E;if(n&&!l)return(!e._readableState||!e._readableState.ended)&&(E=new Va),r.call(e,E);if(i&&!a)return(!e._writableState||!e._writableState.ended)&&(E=new Va),r.call(e,E)},g=function(){e.req.on("finish",o)};return z0(e)?(e.on("complete",o),e.on("abort",h),e.req?g():e.on("request",g)):i&&!e._writableState&&(e.on("end",s),e.on("close",s)),e.on("end",u),e.on("finish",o),t.error!==!1&&e.on("error",f),e.on("close",h),function(){e.removeListener("complete",o),e.removeListener("abort",h),e.removeListener("request",g),e.req&&e.req.removeListener("finish",o),e.removeListener("end",s),e.removeListener("close",s),e.removeListener("finish",o),e.removeListener("end",u),e.removeListener("error",f),e.removeListener("close",h)}}var Lo=eu,$s,za;function q0(){if(za)return $s;za=1;var e;function t(S,M,A){return M=r(M),M in S?Object.defineProperty(S,M,{value:A,enumerable:!0,configurable:!0,writable:!0}):S[M]=A,S}function r(S){var M=n(S,"string");return typeof M=="symbol"?M:String(M)}function n(S,M){if(typeof S!="object"||S===null)return S;var A=S[Symbol.toPrimitive];if(A!==void 0){var B=A.call(S,M||"default");if(typeof B!="object")return B;throw new TypeError("@@toPrimitive must return a primitive value.")}return(M==="string"?String:Number)(S)}var i=Lo,s=Symbol("lastResolve"),a=Symbol("lastReject"),o=Symbol("error"),l=Symbol("ended"),u=Symbol("lastPromise"),f=Symbol("handlePromise"),h=Symbol("stream");function g(S,M){return{value:S,done:M}}function _(S){var M=S[s];if(M!==null){var A=S[h].read();A!==null&&(S[u]=null,S[s]=null,S[a]=null,M(g(A,!1)))}}function E(S){process.nextTick(_,S)}function x(S,M){return function(A,B){S.then(function(){if(M[l]){A(g(void 0,!0));return}M[f](A,B)},B)}}var R=Object.getPrototypeOf(function(){}),b=Object.setPrototypeOf((e={get stream(){return this[h]},next:function(){var M=this,A=this[o];if(A!==null)return Promise.reject(A);if(this[l])return Promise.resolve(g(void 0,!0));if(this[h].destroyed)return new Promise(function(D,ie){process.nextTick(function(){M[o]?ie(M[o]):D(g(void 0,!0))})});var B=this[u],K;if(B)K=new Promise(x(B,this));else{var H=this[h].read();if(H!==null)return Promise.resolve(g(H,!1));K=new Promise(this[f])}return this[u]=K,K}},t(e,Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var M=this;return new Promise(function(A,B){M[h].destroy(null,function(K){if(K){B(K);return}A(g(void 0,!0))})})}),e),R),v=function(M){var A,B=Object.create(b,(A={},t(A,h,{value:M,writable:!0}),t(A,s,{value:null,writable:!0}),t(A,a,{value:null,writable:!0}),t(A,o,{value:null,writable:!0}),t(A,l,{value:M._readableState.endEmitted,writable:!0}),t(A,f,{value:function(H,D){var ie=B[h].read();ie?(B[u]=null,B[s]=null,B[a]=null,H(g(ie,!1))):(B[s]=H,B[a]=D)},writable:!0}),A));return B[u]=null,i(M,function(K){if(K&&K.code!=="ERR_STREAM_PREMATURE_CLOSE"){var H=B[a];H!==null&&(B[u]=null,B[s]=null,B[a]=null,H(K)),B[o]=K;return}var D=B[s];D!==null&&(B[u]=null,B[s]=null,B[a]=null,D(g(void 0,!0))),B[l]=!0}),M.on("readable",E.bind(null,B)),B};return $s=v,$s}var Fs,qa;function G0(){return qa||(qa=1,Fs=function(){throw new Error("Readable.from is not available in the browser")}),Fs}var Ds,Ga;function tu(){if(Ga)return Ds;Ga=1,Ds=D;var e;D.ReadableState=H,Un.EventEmitter;var t=function(w,L){return w.listeners(L).length},r=Zl,n=Zr.Buffer,i=(typeof Z<"u"?Z:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(y){return n.from(y)}function a(y){return n.isBuffer(y)||y instanceof i}var o=Zc,l;o&&o.debuglog?l=o.debuglog("stream"):l=function(){};var u=T0(),f=Kl,h=Yl,g=h.getHighWaterMark,_=Kt.codes,E=_.ERR_INVALID_ARG_TYPE,x=_.ERR_STREAM_PUSH_AFTER_EOF,R=_.ERR_METHOD_NOT_IMPLEMENTED,b=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,v,S,M;nt(D,r);var A=f.errorOrDestroy,B=["error","close","destroy","pause","resume"];function K(y,w,L){if(typeof y.prependListener=="function")return y.prependListener(w,L);!y._events||!y._events[w]?y.on(w,L):Array.isArray(y._events[w])?y._events[w].unshift(L):y._events[w]=[L,y._events[w]]}function H(y,w,L){e=e||mr(),y=y||{},typeof L!="boolean"&&(L=w instanceof e),this.objectMode=!!y.objectMode,L&&(this.objectMode=this.objectMode||!!y.readableObjectMode),this.highWaterMark=g(this,y,"readableHighWaterMark",L),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=y.emitClose!==!1,this.autoDestroy=!!y.autoDestroy,this.destroyed=!1,this.defaultEncoding=y.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,y.encoding&&(v||(v=Wa().StringDecoder),this.decoder=new v(y.encoding),this.encoding=y.encoding)}function D(y){if(e=e||mr(),!(this instanceof D))return new D(y);var w=this instanceof e;this._readableState=new H(y,this,w),this.readable=!0,y&&(typeof y.read=="function"&&(this._read=y.read),typeof y.destroy=="function"&&(this._destroy=y.destroy)),r.call(this)}Object.defineProperty(D.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(w){this._readableState&&(this._readableState.destroyed=w)}}),D.prototype.destroy=f.destroy,D.prototype._undestroy=f.undestroy,D.prototype._destroy=function(y,w){w(y)},D.prototype.push=function(y,w){var L=this._readableState,F;return L.objectMode?F=!0:typeof y=="string"&&(w=w||L.defaultEncoding,w!==L.encoding&&(y=n.from(y,w),w=""),F=!0),ie(this,y,w,!1,F)},D.prototype.unshift=function(y){return ie(this,y,null,!0,!1)};function ie(y,w,L,F,_e){l("readableAddChunk",w);var ee=y._readableState;if(w===null)ee.reading=!1,V(y,ee);else{var le;if(_e||(le=ae(ee,w)),le)A(y,le);else if(ee.objectMode||w&&w.length>0)if(typeof w!="string"&&!ee.objectMode&&Object.getPrototypeOf(w)!==n.prototype&&(w=s(w)),F)ee.endEmitted?A(y,new b):oe(y,ee,w,!0);else if(ee.ended)A(y,new x);else{if(ee.destroyed)return!1;ee.reading=!1,ee.decoder&&!L?(w=ee.decoder.write(w),ee.objectMode||w.length!==0?oe(y,ee,w,!1):U(y,ee)):oe(y,ee,w,!1)}else F||(ee.reading=!1,U(y,ee))}return!ee.ended&&(ee.length<ee.highWaterMark||ee.length===0)}function oe(y,w,L,F){w.flowing&&w.length===0&&!w.sync?(w.awaitDrain=0,y.emit("data",L)):(w.length+=w.objectMode?1:L.length,F?w.buffer.unshift(L):w.buffer.push(L),w.needReadable&&j(y)),U(y,w)}function ae(y,w){var L;return!a(w)&&typeof w!="string"&&w!==void 0&&!y.objectMode&&(L=new E("chunk",["string","Buffer","Uint8Array"],w)),L}D.prototype.isPaused=function(){return this._readableState.flowing===!1},D.prototype.setEncoding=function(y){v||(v=Wa().StringDecoder);var w=new v(y);this._readableState.decoder=w,this._readableState.encoding=this._readableState.decoder.encoding;for(var L=this._readableState.buffer.head,F="";L!==null;)F+=w.write(L.data),L=L.next;return this._readableState.buffer.clear(),F!==""&&this._readableState.buffer.push(F),this._readableState.length=F.length,this};var pe=1073741824;function $(y){return y>=pe?y=pe:(y--,y|=y>>>1,y|=y>>>2,y|=y>>>4,y|=y>>>8,y|=y>>>16,y++),y}function O(y,w){return y<=0||w.length===0&&w.ended?0:w.objectMode?1:y!==y?w.flowing&&w.length?w.buffer.head.data.length:w.length:(y>w.highWaterMark&&(w.highWaterMark=$(y)),y<=w.length?y:w.ended?w.length:(w.needReadable=!0,0))}D.prototype.read=function(y){l("read",y),y=parseInt(y,10);var w=this._readableState,L=y;if(y!==0&&(w.emittedReadable=!1),y===0&&w.needReadable&&((w.highWaterMark!==0?w.length>=w.highWaterMark:w.length>0)||w.ended))return l("read: emitReadable",w.length,w.ended),w.length===0&&w.ended?P(this):j(this),null;if(y=O(y,w),y===0&&w.ended)return w.length===0&&P(this),null;var F=w.needReadable;l("need readable",F),(w.length===0||w.length-y<w.highWaterMark)&&(F=!0,l("length less than watermark",F)),w.ended||w.reading?(F=!1,l("reading or ended",F)):F&&(l("do read"),w.reading=!0,w.sync=!0,w.length===0&&(w.needReadable=!0),this._read(w.highWaterMark),w.sync=!1,w.reading||(y=O(L,w)));var _e;return y>0?_e=I(y,w):_e=null,_e===null?(w.needReadable=w.length<=w.highWaterMark,y=0):(w.length-=y,w.awaitDrain=0),w.length===0&&(w.ended||(w.needReadable=!0),L!==y&&w.ended&&P(this)),_e!==null&&this.emit("data",_e),_e};function V(y,w){if(l("onEofChunk"),!w.ended){if(w.decoder){var L=w.decoder.end();L&&L.length&&(w.buffer.push(L),w.length+=w.objectMode?1:L.length)}w.ended=!0,w.sync?j(y):(w.needReadable=!1,w.emittedReadable||(w.emittedReadable=!0,q(y)))}}function j(y){var w=y._readableState;l("emitReadable",w.needReadable,w.emittedReadable),w.needReadable=!1,w.emittedReadable||(l("emitReadable",w.flowing),w.emittedReadable=!0,process.nextTick(q,y))}function q(y){var w=y._readableState;l("emitReadable_",w.destroyed,w.length,w.ended),!w.destroyed&&(w.length||w.ended)&&(y.emit("readable"),w.emittedReadable=!1),w.needReadable=!w.flowing&&!w.ended&&w.length<=w.highWaterMark,k(y)}function U(y,w){w.readingMore||(w.readingMore=!0,process.nextTick(Q,y,w))}function Q(y,w){for(;!w.reading&&!w.ended&&(w.length<w.highWaterMark||w.flowing&&w.length===0);){var L=w.length;if(l("maybeReadMore read 0"),y.read(0),L===w.length)break}w.readingMore=!1}D.prototype._read=function(y){A(this,new R("_read()"))},D.prototype.pipe=function(y,w){var L=this,F=this._readableState;switch(F.pipesCount){case 0:F.pipes=y;break;case 1:F.pipes=[F.pipes,y];break;default:F.pipes.push(y);break}F.pipesCount+=1,l("pipe count=%d opts=%j",F.pipesCount,w);var _e=(!w||w.end!==!1)&&y!==process.stdout&&y!==process.stderr,ee=_e?et:at;F.endEmitted?process.nextTick(ee):L.once("end",ee),y.on("unpipe",le);function le(p,c){l("onunpipe"),p===L&&c&&c.hasUnpiped===!1&&(c.hasUnpiped=!0,wt())}function et(){l("onend"),y.end()}var yt=G(L);y.on("drain",yt);var kt=!1;function wt(){l("cleanup"),y.removeListener("close",It),y.removeListener("finish",$e),y.removeListener("drain",yt),y.removeListener("error",ot),y.removeListener("unpipe",le),L.removeListener("end",et),L.removeListener("end",at),L.removeListener("data",Pe),kt=!0,F.awaitDrain&&(!y._writableState||y._writableState.needDrain)&&yt()}L.on("data",Pe);function Pe(p){l("ondata");var c=y.write(p);l("dest.write",c),c===!1&&((F.pipesCount===1&&F.pipes===y||F.pipesCount>1&&X(F.pipes,y)!==-1)&&!kt&&(l("false write response, pause",F.awaitDrain),F.awaitDrain++),L.pause())}function ot(p){l("onerror",p),at(),y.removeListener("error",ot),t(y,"error")===0&&A(y,p)}K(y,"error",ot);function It(){y.removeListener("finish",$e),at()}y.once("close",It);function $e(){l("onfinish"),y.removeListener("close",It),at()}y.once("finish",$e);function at(){l("unpipe"),L.unpipe(y)}return y.emit("pipe",L),F.flowing||(l("pipe resume"),L.resume()),y};function G(y){return function(){var L=y._readableState;l("pipeOnDrain",L.awaitDrain),L.awaitDrain&&L.awaitDrain--,L.awaitDrain===0&&t(y,"data")&&(L.flowing=!0,k(y))}}D.prototype.unpipe=function(y){var w=this._readableState,L={hasUnpiped:!1};if(w.pipesCount===0)return this;if(w.pipesCount===1)return y&&y!==w.pipes?this:(y||(y=w.pipes),w.pipes=null,w.pipesCount=0,w.flowing=!1,y&&y.emit("unpipe",this,L),this);if(!y){var F=w.pipes,_e=w.pipesCount;w.pipes=null,w.pipesCount=0,w.flowing=!1;for(var ee=0;ee<_e;ee++)F[ee].emit("unpipe",this,{hasUnpiped:!1});return this}var le=X(w.pipes,y);return le===-1?this:(w.pipes.splice(le,1),w.pipesCount-=1,w.pipesCount===1&&(w.pipes=w.pipes[0]),y.emit("unpipe",this,L),this)},D.prototype.on=function(y,w){var L=r.prototype.on.call(this,y,w),F=this._readableState;return y==="data"?(F.readableListening=this.listenerCount("readable")>0,F.flowing!==!1&&this.resume()):y==="readable"&&!F.endEmitted&&!F.readableListening&&(F.readableListening=F.needReadable=!0,F.flowing=!1,F.emittedReadable=!1,l("on readable",F.length,F.reading),F.length?j(this):F.reading||process.nextTick(re,this)),L},D.prototype.addListener=D.prototype.on,D.prototype.removeListener=function(y,w){var L=r.prototype.removeListener.call(this,y,w);return y==="readable"&&process.nextTick(z,this),L},D.prototype.removeAllListeners=function(y){var w=r.prototype.removeAllListeners.apply(this,arguments);return(y==="readable"||y===void 0)&&process.nextTick(z,this),w};function z(y){var w=y._readableState;w.readableListening=y.listenerCount("readable")>0,w.resumeScheduled&&!w.paused?w.flowing=!0:y.listenerCount("data")>0&&y.resume()}function re(y){l("readable nexttick read 0"),y.read(0)}D.prototype.resume=function(){var y=this._readableState;return y.flowing||(l("resume"),y.flowing=!y.readableListening,Ee(this,y)),y.paused=!1,this};function Ee(y,w){w.resumeScheduled||(w.resumeScheduled=!0,process.nextTick(ce,y,w))}function ce(y,w){l("resume",w.reading),w.reading||y.read(0),w.resumeScheduled=!1,y.emit("resume"),k(y),w.flowing&&!w.reading&&y.read(0)}D.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function k(y){var w=y._readableState;for(l("flow",w.flowing);w.flowing&&y.read()!==null;);}D.prototype.wrap=function(y){var w=this,L=this._readableState,F=!1;y.on("end",function(){if(l("wrapped end"),L.decoder&&!L.ended){var le=L.decoder.end();le&&le.length&&w.push(le)}w.push(null)}),y.on("data",function(le){if(l("wrapped data"),L.decoder&&(le=L.decoder.write(le)),!(L.objectMode&&le==null)&&!(!L.objectMode&&(!le||!le.length))){var et=w.push(le);et||(F=!0,y.pause())}});for(var _e in y)this[_e]===void 0&&typeof y[_e]=="function"&&(this[_e]=function(et){return function(){return y[et].apply(y,arguments)}}(_e));for(var ee=0;ee<B.length;ee++)y.on(B[ee],this.emit.bind(this,B[ee]));return this._read=function(le){l("wrapped _read",le),F&&(F=!1,y.resume())},this},typeof Symbol=="function"&&(D.prototype[Symbol.asyncIterator]=function(){return S===void 0&&(S=q0()),S(this)}),Object.defineProperty(D.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(D.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(D.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(w){this._readableState&&(this._readableState.flowing=w)}}),D._fromList=I,Object.defineProperty(D.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function I(y,w){if(w.length===0)return null;var L;return w.objectMode?L=w.buffer.shift():!y||y>=w.length?(w.decoder?L=w.buffer.join(""):w.buffer.length===1?L=w.buffer.first():L=w.buffer.concat(w.length),w.buffer.clear()):L=w.buffer.consume(y,w.decoder),L}function P(y){var w=y._readableState;l("endReadable",w.endEmitted),w.endEmitted||(w.ended=!0,process.nextTick(J,w,y))}function J(y,w){if(l("endReadableNT",y.endEmitted,y.length),!y.endEmitted&&y.length===0&&(y.endEmitted=!0,w.readable=!1,w.emit("end"),y.autoDestroy)){var L=w._writableState;(!L||L.autoDestroy&&L.finished)&&w.destroy()}}typeof Symbol=="function"&&(D.from=function(y,w){return M===void 0&&(M=G0()),M(D,y,w)});function X(y,w){for(var L=0,F=y.length;L<F;L++)if(y[L]===w)return L;return-1}return Ds}var ru=Ct,gi=Kt.codes,J0=gi.ERR_METHOD_NOT_IMPLEMENTED,Z0=gi.ERR_MULTIPLE_CALLBACK,K0=gi.ERR_TRANSFORM_ALREADY_TRANSFORMING,Q0=gi.ERR_TRANSFORM_WITH_LENGTH_0,_i=mr();nt(Ct,_i);function Y0(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(n===null)return this.emit("error",new Z0);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function Ct(e){if(!(this instanceof Ct))return new Ct(e);_i.call(this,e),this._transformState={afterTransform:Y0.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",X0)}function X0(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){Ja(e,t,r)}):Ja(this,null,null)}Ct.prototype.push=function(e,t){return this._transformState.needTransform=!1,_i.prototype.push.call(this,e,t)};Ct.prototype._transform=function(e,t,r){r(new J0("_transform()"))};Ct.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};Ct.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Ct.prototype._destroy=function(e,t){_i.prototype._destroy.call(this,e,function(r){t(r)})};function Ja(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Q0;if(e._transformState.transforming)throw new K0;return e.push(null)}var ep=Dr,nu=ru;nt(Dr,nu);function Dr(e){if(!(this instanceof Dr))return new Dr(e);nu.call(this,e)}Dr.prototype._transform=function(e,t,r){r(null,e)};var js;function tp(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var iu=Kt.codes,rp=iu.ERR_MISSING_ARGS,np=iu.ERR_STREAM_DESTROYED;function Za(e){if(e)throw e}function ip(e){return e.setHeader&&typeof e.abort=="function"}function sp(e,t,r,n){n=tp(n);var i=!1;e.on("close",function(){i=!0}),js===void 0&&(js=Lo),js(e,{readable:t,writable:r},function(a){if(a)return n(a);i=!0,n()});var s=!1;return function(a){if(!i&&!s){if(s=!0,ip(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();n(a||new np("pipe"))}}}function Ka(e){e()}function op(e,t){return e.pipe(t)}function ap(e){return!e.length||typeof e[e.length-1]!="function"?Za:e.pop()}function cp(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=ap(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new rp("streams");var i,s=t.map(function(a,o){var l=o<t.length-1,u=o>0;return sp(a,l,u,function(f){i||(i=f),f&&s.forEach(Ka),!l&&(s.forEach(Ka),n(i))})});return t.reduce(op)}var lp=cp;(function(e,t){t=e.exports=tu(),t.Stream=t,t.Readable=t,t.Writable=Xl(),t.Duplex=mr(),t.Transform=ru,t.PassThrough=ep,t.finished=Lo,t.pipeline=lp})(oo,oo.exports);var su=oo.exports;const{Transform:up}=su;var dp=e=>class ou extends up{constructor(r,n,i,s,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new ou(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:hp}=su;var fp=e=>class au extends hp{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new au(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const pp=dp,gp=fp;var _p=function(e){const t=pp(e),r=gp(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},cu={};const Qa=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];cu.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],o=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],u=e[7]^e[17]^e[27]^e[37]^e[47],f=e[8]^e[18]^e[28]^e[38]^e[48],h=e[9]^e[19]^e[29]^e[39]^e[49];let g=f^(i<<1|s>>>31),_=h^(s<<1|i>>>31);const E=e[0]^g,x=e[1]^_,R=e[10]^g,b=e[11]^_,v=e[20]^g,S=e[21]^_,M=e[30]^g,A=e[31]^_,B=e[40]^g,K=e[41]^_;g=r^(a<<1|o>>>31),_=n^(o<<1|a>>>31);const H=e[2]^g,D=e[3]^_,ie=e[12]^g,oe=e[13]^_,ae=e[22]^g,pe=e[23]^_,$=e[32]^g,O=e[33]^_,V=e[42]^g,j=e[43]^_;g=i^(l<<1|u>>>31),_=s^(u<<1|l>>>31);const q=e[4]^g,U=e[5]^_,Q=e[14]^g,G=e[15]^_,z=e[24]^g,re=e[25]^_,Ee=e[34]^g,ce=e[35]^_,k=e[44]^g,I=e[45]^_;g=a^(f<<1|h>>>31),_=o^(h<<1|f>>>31);const P=e[6]^g,J=e[7]^_,X=e[16]^g,y=e[17]^_,w=e[26]^g,L=e[27]^_,F=e[36]^g,_e=e[37]^_,ee=e[46]^g,le=e[47]^_;g=l^(r<<1|n>>>31),_=u^(n<<1|r>>>31);const et=e[8]^g,yt=e[9]^_,kt=e[18]^g,wt=e[19]^_,Pe=e[28]^g,ot=e[29]^_,It=e[38]^g,$e=e[39]^_,at=e[48]^g,p=e[49]^_,c=E,d=x,m=b<<4|R>>>28,C=R<<4|b>>>28,T=v<<3|S>>>29,N=S<<3|v>>>29,te=A<<9|M>>>23,be=M<<9|A>>>23,ge=B<<18|K>>>14,ye=K<<18|B>>>14,fe=H<<1|D>>>31,Fi=D<<1|H>>>31,Di=oe<<12|ie>>>20,ji=ie<<12|oe>>>20,Ui=ae<<10|pe>>>22,Hi=pe<<10|ae>>>22,Wi=O<<13|$>>>19,Vi=$<<13|O>>>19,zi=V<<2|j>>>30,qi=j<<2|V>>>30,Gi=U<<30|q>>>2,Ji=q<<30|U>>>2,Zi=Q<<6|G>>>26,Ki=G<<6|Q>>>26,Qi=re<<11|z>>>21,Yi=z<<11|re>>>21,Xi=Ee<<15|ce>>>17,es=ce<<15|Ee>>>17,ts=I<<29|k>>>3,rs=k<<29|I>>>3,ns=P<<28|J>>>4,is=J<<28|P>>>4,ss=y<<23|X>>>9,os=X<<23|y>>>9,as=w<<25|L>>>7,cs=L<<25|w>>>7,ls=F<<21|_e>>>11,us=_e<<21|F>>>11,ds=le<<24|ee>>>8,hs=ee<<24|le>>>8,fs=et<<27|yt>>>5,ps=yt<<27|et>>>5,gs=kt<<20|wt>>>12,_s=wt<<20|kt>>>12,ms=ot<<7|Pe>>>25,bs=Pe<<7|ot>>>25,ys=It<<8|$e>>>24,ws=$e<<8|It>>>24,Es=at<<14|p>>>18,vs=p<<14|at>>>18;e[0]=c^~Di&Qi,e[1]=d^~ji&Yi,e[10]=ns^~gs&T,e[11]=is^~_s&N,e[20]=fe^~Zi&as,e[21]=Fi^~Ki&cs,e[30]=fs^~m&Ui,e[31]=ps^~C&Hi,e[40]=Gi^~ss&ms,e[41]=Ji^~os&bs,e[2]=Di^~Qi&ls,e[3]=ji^~Yi&us,e[12]=gs^~T&Wi,e[13]=_s^~N&Vi,e[22]=Zi^~as&ys,e[23]=Ki^~cs&ws,e[32]=m^~Ui&Xi,e[33]=C^~Hi&es,e[42]=ss^~ms&te,e[43]=os^~bs&be,e[4]=Qi^~ls&Es,e[5]=Yi^~us&vs,e[14]=T^~Wi&ts,e[15]=N^~Vi&rs,e[24]=as^~ys&ge,e[25]=cs^~ws&ye,e[34]=Ui^~Xi&ds,e[35]=Hi^~es&hs,e[44]=ms^~te&zi,e[45]=bs^~be&qi,e[6]=ls^~Es&c,e[7]=us^~vs&d,e[16]=Wi^~ts&ns,e[17]=Vi^~rs&is,e[26]=ys^~ge&fe,e[27]=ws^~ye&Fi,e[36]=Xi^~ds&fs,e[37]=es^~hs&ps,e[46]=te^~zi&Gi,e[47]=be^~qi&Ji,e[8]=Es^~c&Di,e[9]=vs^~d&ji,e[18]=ts^~ns&gs,e[19]=rs^~is&_s,e[28]=ge^~fe&Zi,e[29]=ye^~Fi&Ki,e[38]=ds^~fs&m,e[39]=hs^~ps&C,e[48]=zi^~Gi&ss,e[49]=qi^~Ji&os,e[0]^=Qa[t*2],e[1]^=Qa[t*2+1]}};const $n=cu;function kr(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}kr.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};kr.prototype.absorb=function(e){for(let t=0;t<e.length;++t)this.state[~~(this.count/4)]^=e[t]<<8*(this.count%4),this.count+=1,this.count===this.blockSize&&($n.p1600(this.state),this.count=0)};kr.prototype.absorbLastFewBits=function(e){this.state[~~(this.count/4)]^=e<<8*(this.count%4),e&128&&this.count===this.blockSize-1&&$n.p1600(this.state),this.state[~~((this.blockSize-1)/4)]^=128<<8*((this.blockSize-1)%4),$n.p1600(this.state),this.count=0,this.squeezing=!0};kr.prototype.squeeze=function(e){this.squeezing||this.absorbLastFewBits(1);const t=Buffer.alloc(e);for(let r=0;r<e;++r)t[r]=this.state[~~(this.count/4)]>>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&($n.p1600(this.state),this.count=0);return t};kr.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var mp=kr,bp=_p(mp);const yp=bp,wp=jn;function lu(e){return Buffer.allocUnsafe(e).fill(0)}function uu(e,t,r){const n=lu(t);return e=mi(e),r?e.length<t?(e.copy(n),n):e.slice(0,t):e.length<t?(e.copy(n,t-e.length),n):e.slice(-t)}function Ep(e,t){return uu(e,t,!0)}function mi(e){if(!Buffer.isBuffer(e))if(Array.isArray(e))e=Buffer.from(e);else if(typeof e=="string")du(e)?e=Buffer.from(Rp(hu(e)),"hex"):e=Buffer.from(e);else if(typeof e=="number")e=intToBuffer(e);else if(e==null)e=Buffer.allocUnsafe(0);else if(wp.isBN(e))e=e.toArrayLike(Buffer);else if(e.toArray)e=Buffer.from(e.toArray());else throw new Error("invalid type");return e}function vp(e){return e=mi(e),"0x"+e.toString("hex")}function Sp(e,t){return e=mi(e),t||(t=256),yp("keccak"+t).update(e).digest()}function Rp(e){return e.length%2?"0"+e:e}function du(e){return typeof e=="string"&&e.match(/^0x[0-9A-Fa-f]*$/)}function hu(e){return typeof e=="string"&&e.startsWith("0x")?e.slice(2):e}var fu={zeros:lu,setLength:uu,setLengthRight:Ep,isHexString:du,stripHexPrefix:hu,toBuffer:mi,bufferToHex:vp,keccak:Sp};const zt=fu,Ht=jn;function pu(e){return e.startsWith("int[")?"int256"+e.slice(3):e==="int"?"int256":e.startsWith("uint[")?"uint256"+e.slice(4):e==="uint"?"uint256":e.startsWith("fixed[")?"fixed128x128"+e.slice(5):e==="fixed"?"fixed128x128":e.startsWith("ufixed[")?"ufixed128x128"+e.slice(6):e==="ufixed"?"ufixed128x128":e}function lr(e){return parseInt(/^\D+(\d+)$/.exec(e)[1],10)}function Ya(e){var t=/^\D+(\d+)x(\d+)$/.exec(e);return[parseInt(t[1],10),parseInt(t[2],10)]}function gu(e){var t=e.match(/(.*)\[(.*?)\]$/);return t?t[2]===""?"dynamic":parseInt(t[2],10):null}function jt(e){var t=typeof e;if(t==="string")return zt.isHexString(e)?new Ht(zt.stripHexPrefix(e),16):new Ht(e,10);if(t==="number")return new Ht(e);if(e.toArray)return e;throw new Error("Argument is not a number")}function dt(e,t){var r,n,i,s;if(e==="address")return dt("uint160",jt(t));if(e==="bool")return dt("uint8",t?1:0);if(e==="string")return dt("bytes",new Buffer(t,"utf8"));if(kp(e)){if(typeof t.length>"u")throw new Error("Not an array?");if(r=gu(e),r!=="dynamic"&&r!==0&&t.length>r)throw new Error("Elements exceed array size: "+r);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(dt(e,t[s]));if(r==="dynamic"){var a=dt("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([dt("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,zt.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(r=lr(e),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);return zt.setLengthRight(t,32)}else if(e.startsWith("uint")){if(r=lr(e),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=jt(t),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(r=lr(e),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=jt(t),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(r=Ya(e),n=jt(t),n<0)throw new Error("Supplied ufixed is negative");return dt("uint256",n.mul(new Ht(2).pow(new Ht(r[1]))))}else if(e.startsWith("fixed"))return r=Ya(e),dt("int256",jt(t).mul(new Ht(2).pow(new Ht(r[1]))))}throw new Error("Unsupported or invalid type: "+e)}function Cp(e){return e==="string"||e==="bytes"||gu(e)==="dynamic"}function kp(e){return e.lastIndexOf("]")===e.length-1}function Ip(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var a=pu(e[s]),o=t[s],l=dt(a,o);Cp(a)?(r.push(dt("uint256",i)),n.push(l),i+=l.length):r.push(l)}return Buffer.concat(r.concat(n))}function _u(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s<e.length;s++){var a=pu(e[s]),o=t[s];if(a==="bytes")i.push(o);else if(a==="string")i.push(new Buffer(o,"utf8"));else if(a==="bool")i.push(new Buffer(o?"01":"00","hex"));else if(a==="address")i.push(zt.setLength(o,20));else if(a.startsWith("bytes")){if(r=lr(a),r<1||r>32)throw new Error("Invalid bytes<N> width: "+r);i.push(zt.setLengthRight(o,r))}else if(a.startsWith("uint")){if(r=lr(a),r%8||r<8||r>256)throw new Error("Invalid uint<N> width: "+r);if(n=jt(o),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(a.startsWith("int")){if(r=lr(a),r%8||r<8||r>256)throw new Error("Invalid int<N> width: "+r);if(n=jt(o),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function xp(e,t){return zt.keccak(_u(e,t))}var Ap={rawEncode:Ip,solidityPack:_u,soliditySHA3:xp};const rt=fu,Or=Ap,mu={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"]},Us={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const a=(o,l,u)=>{if(r[l]!==void 0)return["bytes32",u==null?"0x0000000000000000000000000000000000000000000000000000000000000000":rt.keccak(this.encodeData(l,u,r,n))];if(u===void 0)throw new Error(`missing value for field ${o} of type ${l}`);if(l==="bytes")return["bytes32",rt.keccak(u)];if(l==="string")return typeof u=="string"&&(u=Buffer.from(u,"utf8")),["bytes32",rt.keccak(u)];if(l.lastIndexOf("]")===l.length-1){const f=l.slice(0,l.lastIndexOf("[")),h=u.map(g=>a(o,f,g));return["bytes32",rt.keccak(Or.rawEncode(h.map(([g])=>g),h.map(([,g])=>g)))]}return[l,u]};for(const o of r[e]){const[l,u]=a(o.name,o.type,t[o.name]);i.push(l),s.push(u)}}else for(const a of r[e]){let o=t[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=rt.keccak(o),s.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=rt.keccak(o),s.push(o);else if(r[a.type]!==void 0)i.push("bytes32"),o=rt.keccak(this.encodeData(a.type,o,r,n)),s.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(o)}}return Or.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(i=>i!==e);n=[e].concat(n.sort());for(const i of n){if(!t[i])throw new Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||t[e]===void 0)return r;r.push(e);for(const n of t[e])for(const i of this.findTypeDependencies(n.type,t,r))!r.includes(i)&&r.push(i);return r},hashStruct(e,t,r,n=!0){return rt.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return rt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in mu.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),rt.keccak(Buffer.concat(n))}};var Tp={TYPED_MESSAGE_SCHEMA:mu,TypedDataUtils:Us,hashForSignTypedDataLegacy:function(e){return Mp(e.data)},hashForSignTypedData_v3:function(e){return Us.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Us.hash(e.data)}};function Mp(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const r=e.map(function(s){return s.type==="bytes"?rt.toBuffer(s.value):s.value}),n=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return Or.soliditySHA3(["bytes32","bytes32"],[Or.soliditySHA3(new Array(e.length).fill("string"),i),Or.soliditySHA3(n,r)])}var br={};Object.defineProperty(br,"__esModule",{value:!0});br.filterFromParam=br.FilterPolyfill=void 0;const or=xe,Fe=W,Np=5*60*1e3,Ut={jsonrpc:"2.0",id:0};class Lp{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,or.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const r=bu(t),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Fe.hexStringFromIntNumber)(n)}async newBlockFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.blockFilters.add(t),this.setFilterTimeout(t),(0,Fe.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,Fe.hexStringFromIntNumber)(t)}uninstallFilter(t){const r=(0,Fe.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(t){const r=(0,Fe.intNumberFromHexString)(t);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(Rn())}async getFilterLogs(t){const r=(0,Fe.intNumberFromHexString)(t),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},Ut),{method:"eth_getLogs",params:[Xa(n)]})):Rn()}makeFilterId(){return(0,or.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((r,n)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const r=this.logFilters.get(t),n=this.cursors.get(t);if(!n||!r)return Rn();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return Cn();console.info(`Fetching logs from ${n} to ${s} for filter ${t}`);const a=await this.sendAsyncPromise(Object.assign(Object.assign({},Ut),{method:"eth_getLogs",params:[Xa(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(a.result)){const o=a.result.map(u=>(0,Fe.intNumberFromHexString)(u.blockNumber||"0x0")),l=Math.max(...o);if(l&&l>n){const u=(0,or.IntNumber)(l+1);console.info(`Moving cursor position for filter (${t}) from ${n} to ${u}`),this.cursors.set(t,u)}}return a}async getBlockFilterChanges(t){const r=this.cursors.get(t);if(!r)return Rn();const n=await this.getCurrentBlockHeight();if(r>n)return Cn();console.info(`Fetching blocks from ${r} to ${n} for filter (${t})`);const i=(await Promise.all((0,Fe.range)(r,n+1).map(a=>this.getBlockHashByNumber((0,or.IntNumber)(a))))).filter(a=>!!a),s=(0,or.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${t}) from ${r} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},Ut),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(Cn())}async setInitialCursorPosition(t,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(t,i),i}setFilterTimeout(t){const r=this.timeouts.get(t);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},Np);this.timeouts.set(t,n)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;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:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},Ut),{method:"eth_blockNumber",params:[]}));return(0,Fe.intNumberFromHexString)((0,Fe.ensureHexString)(t))}async getBlockHashByNumber(t){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},Ut),{method:"eth_getBlockByNumber",params:[(0,Fe.hexStringFromIntNumber)(t),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Fe.ensureHexString)(r.result.hash):null}}br.FilterPolyfill=Lp;function bu(e){return{fromBlock:ec(e.fromBlock),toBlock:ec(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}br.filterFromParam=bu;function Xa(e){const t={fromBlock:tc(e.fromBlock),toBlock:tc(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function ec(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,or.IntNumber)(0);if((0,Fe.isHexString)(e))return(0,Fe.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function tc(e){return e==="latest"?e:(0,Fe.hexStringFromIntNumber)(e)}function Rn(){return Object.assign(Object.assign({},Ut),{error:{code:-32e3,message:"filter not found"}})}function Cn(){return Object.assign(Object.assign({},Ut),{result:[]})}var bi={},yu={},yi={},Bo=Bp;function Bp(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const rc=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let i=0;i<arguments.length;i++)n[i]=arguments[i];return new r((i,s)=>{t.errorFirst?n.push(function(a,o){if(t.multiArgs){const l=new Array(arguments.length-1);for(let u=1;u<arguments.length;u++)l[u-1]=arguments[u];a?(l.unshift(a),s(l)):i(l)}else a?s(a):i(o)}):n.push(function(a){if(t.multiArgs){const o=new Array(arguments.length-1);for(let l=0;l<arguments.length;l++)o[l]=arguments[l];i(o)}else i(a)}),e.apply(this,n)})};var Pp=(e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=i=>{const s=a=>typeof a=="string"?i===a:a.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let n;typeof e=="function"?n=function(){return t.excludeMain?e.apply(this,arguments):rc(e,t).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]=typeof s=="function"&&r(i)?rc(s,t):s}return n},cn={},ln={};Object.defineProperty(ln,"__esModule",{value:!0});const Op=Un;function nc(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function $p(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}let Fp=class extends Op.EventEmitter{emit(t,...r){let n=t==="error";const i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){let a;if(r.length>0&&([a]=r),a instanceof Error)throw a;const o=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw o.context=a,o}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")nc(s,this,r);else{const a=s.length,o=$p(s);for(let l=0;l<a;l+=1)nc(o[l],this,r)}return!0}};ln.default=Fp;var Dp=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(cn,"__esModule",{value:!0});cn.BaseBlockTracker=void 0;const jp=Dp(ln),Up=1e3,Hp=(e,t)=>e+t,ic=["sync","latest"];class Wp extends jp.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*Up,this._usePastBlocks=t.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(t){return t?super.removeAllListeners(t):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(t){ic.includes(t)&&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 ic.map(t=>this.listenerCount(t)).reduce(Hp)}_shouldUseNewBlock(t){const r=this._currentBlock;if(!r)return!0;const n=sc(t),i=sc(r);return this._usePastBlocks&&n<i||n>i}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const r=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:r,newBlock:t})}_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}}cn.BaseBlockTracker=Wp;function sc(e){return Number.parseInt(e,16)}var wu={},Eu={},Be={};class vu extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...a}=t,{path:o}=t,l=o.length===0?i:`At path: ${o.join(".")} -- ${i}`;super(s??l),s!=null&&(this.cause=l),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function Vp(e){return Ye(e)&&typeof e[Symbol.iterator]=="function"}function Ye(e){return typeof e=="object"&&e!=null}function oc(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Ae(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function zp(e){const{done:t,value:r}=e.next();return t?void 0:r}function qp(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:a}=r,{refinement:o,message:l=`Expected a value of type \`${a}\`${o?` with refinement \`${o}\``:""}, but received: \`${Ae(n)}\``}=e;return{value:n,type:a,refinement:o,key:i[i.length-1],path:i,branch:s,...e,message:l}}function*co(e,t,r,n){Vp(e)||(e=[e]);for(const i of e){const s=qp(i,t,r,n);s&&(yield s)}}function*Po(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:a=!1}=r,o={path:n,branch:i};if(s&&(e=t.coercer(e,o),a&&t.type!=="type"&&Ye(t.schema)&&Ye(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let l="valid";for(const u of t.validator(e,o))u.explanation=r.message,l="not_valid",yield[u,void 0];for(let[u,f,h]of t.entries(e,o)){const g=Po(f,h,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,f],coerce:s,mask:a,message:r.message});for(const _ of g)_[0]?(l=_[0].refinement!=null?"not_refined":"not_valid",yield[_[0],void 0]):s&&(f=_[1],u===void 0?e=f:e instanceof Map?e.set(u,f):e instanceof Set?e.add(f):Ye(e)&&(f!==void 0||u in e)&&(e[u]=f))}if(l!=="not_valid")for(const u of t.refiner(e,o))u.explanation=r.message,l="not_refined",yield[u,void 0];l==="valid"&&(yield[void 0,e])}class ke{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:a=l=>l,entries:o=function*(){}}=t;this.type=r,this.schema=n,this.entries=o,this.coercer=a,i?this.validator=(l,u)=>{const f=i(l,u);return co(f,u,this,l)}:this.validator=()=>[],s?this.refiner=(l,u)=>{const f=s(l,u);return co(f,u,this,l)}:this.refiner=()=>[]}assert(t,r){return Su(t,this,r)}create(t,r){return Ru(t,this,r)}is(t){return Oo(t,this)}mask(t,r){return Cu(t,this,r)}validate(t,r={}){return Ir(t,this,r)}}function Su(e,t,r){const n=Ir(e,t,{message:r});if(n[0])throw n[0]}function Ru(e,t,r){const n=Ir(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Cu(e,t,r){const n=Ir(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Oo(e,t){return!Ir(e,t)[0]}function Ir(e,t,r={}){const n=Po(e,t,r),i=zp(n);return i[0]?[new vu(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function Gp(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?dn(n):un(n)}function He(e,t){return new ke({type:e,schema:null,validator:t})}function Jp(e,t){return new ke({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function Zp(e){return new ke({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function Kp(e){let t;return new ke({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function Qp(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return dn(n);default:return un(n)}}function Yp(e){const t=e instanceof ke,r=t?{...e.schema}:{...e};for(const n in r)r[n]=ku(r[n]);return t&&e.type==="type"?dn(r):un(r)}function Xp(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return dn(n);default:return un(n)}}function e1(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),He(e,t)}function t1(){return He("any",()=>!0)}function r1(e){return new ke({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Ae(t)}`}})}function n1(){return He("bigint",e=>typeof e=="bigint")}function i1(){return He("boolean",e=>typeof e=="boolean")}function s1(){return He("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Ae(e)}`)}function o1(e){const t={},r=e.map(n=>Ae(n)).join();for(const n of e)t[n]=n;return new ke({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${Ae(n)}`}})}function a1(){return He("func",e=>typeof e=="function"||`Expected a function, but received: ${Ae(e)}`)}function c1(e){return He("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Ae(t)}`)}function l1(){return He("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Ae(e)}`)}function u1(e){return new ke({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function d1(e){const t=Ae(e),r=typeof e;return new ke({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Ae(n)}`}})}function h1(e,t){return new ke({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Ae(r)}`}})}function $o(){return He("never",()=>!1)}function f1(e){return new ke({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function p1(){return He("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${Ae(e)}`)}function un(e){const t=e?Object.keys(e):[],r=$o();return new ke({type:"object",schema:e||null,*entries(n){if(e&&Ye(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return Ye(n)||`Expected an object, but received: ${Ae(n)}`},coercer(n){return Ye(n)?{...n}:n}})}function ku(e){return new ke({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function g1(e,t){return new ke({type:"record",schema:null,*entries(r){if(Ye(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return Ye(r)||`Expected an object, but received: ${Ae(r)}`}})}function _1(){return He("regexp",e=>e instanceof RegExp)}function m1(e){return new ke({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${Ae(t)}`}})}function Iu(){return He("string",e=>typeof e=="string"||`Expected a string, but received: ${Ae(e)}`)}function b1(e){const t=$o();return new ke({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${Ae(r)}`}})}function dn(e){const t=Object.keys(e);return new ke({type:"type",schema:e,*entries(r){if(Ye(r))for(const n of t)yield[n,r[n],e[n]]},validator(r){return Ye(r)||`Expected an object, but received: ${Ae(r)}`},coercer(r){return Ye(r)?{...r}:r}})}function y1(e){const t=e.map(r=>r.type).join(" | ");return new ke({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...a]=Po(r,s,n),[o]=a;if(o[0])for(const[l]of a)l&&i.push(l);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Ae(r)}`,...i]}})}function xu(){return He("unknown",()=>!0)}function Fo(e,t,r){return new ke({...e,coercer:(n,i)=>Oo(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function w1(e,t,r={}){return Fo(e,xu(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&oc(n)&&oc(i)){const s={...n};let a=!1;for(const o in i)s[o]===void 0&&(s[o]=i[o],a=!0);if(a)return s}return n})}function E1(e){return Fo(e,Iu(),t=>t.trim())}function v1(e){return Qt(e,"empty",t=>{const r=Au(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Au(e){return e instanceof Map||e instanceof Set?e.size:e.length}function S1(e,t,r={}){const{exclusive:n}=r;return Qt(e,"max",i=>n?i<t:i<=t||`Expected a ${e.type} less than ${n?"":"or equal to "}${t} but received \`${i}\``)}function R1(e,t,r={}){const{exclusive:n}=r;return Qt(e,"min",i=>n?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function C1(e){return Qt(e,"nonempty",t=>Au(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function k1(e,t){return Qt(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function I1(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Qt(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:a}=s;return t<=a&&a<=r||`${n} with a size ${i} but received one with a size of \`${a}\``}else{const{length:a}=s;return t<=a&&a<=r||`${n} with a length ${i} but received one with a length of \`${a}\``}})}function Qt(e,t,r){return new ke({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),a=co(s,i,e,n);for(const o of a)yield{...o,refinement:t}}})}const x1=Object.freeze(Object.defineProperty({__proto__:null,Struct:ke,StructError:vu,any:t1,array:r1,assert:Su,assign:Gp,bigint:n1,boolean:i1,coerce:Fo,create:Ru,date:s1,defaulted:w1,define:He,deprecated:Jp,dynamic:Zp,empty:v1,enums:o1,func:a1,instance:c1,integer:l1,intersection:u1,is:Oo,lazy:Kp,literal:d1,map:h1,mask:Cu,max:S1,min:R1,never:$o,nonempty:C1,nullable:f1,number:p1,object:un,omit:Qp,optional:ku,partial:Yp,pattern:k1,pick:Xp,record:g1,refine:Qt,regexp:_1,set:m1,size:I1,string:Iu,struct:e1,trimmed:E1,tuple:b1,type:dn,union:y1,unknown:xu,validate:Ir},Symbol.toStringTag,{value:"Module"})),Yt=Hr(x1);Object.defineProperty(Be,"__esModule",{value:!0});Be.assertExhaustive=Be.assertStruct=Be.assert=Be.AssertionError=void 0;const A1=Yt;function T1(e){return typeof e=="object"&&e!==null&&"message"in e}function M1(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function N1(e){const t=T1(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function Tu(e,t){return M1(e)?new e({message:t}):e({message:t})}class Do extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}Be.AssertionError=Do;function L1(e,t="Assertion failed.",r=Do){if(!e)throw t instanceof Error?t:Tu(r,t)}Be.assert=L1;function B1(e,t,r="Assertion failed",n=Do){try{(0,A1.assert)(e,t)}catch(i){throw Tu(n,`${r}: ${N1(i)}.`)}}Be.assertStruct=B1;function P1(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Be.assertExhaustive=P1;var hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.base64=void 0;const O1=Yt,$1=Be,F1=(e,t={})=>{var r,n;const i=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=t.characterSet)!==null&&n!==void 0?n:"base64";let a;s==="base64"?a=String.raw`[A-Za-z0-9+\/]`:((0,$1.assert)(s==="base64url"),a=String.raw`[-_A-Za-z0-9]`);let o;return i?o=new RegExp(`^(?:${a}{4})*(?:${a}{3}=|${a}{2}==)?$`,"u"):o=new RegExp(`^(?:${a}{4})*(?:${a}{2,3}|${a}{3}=|${a}{2}==)?$`,"u"),(0,O1.pattern)(e,o)};hn.base64=F1;var he={},fn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=Yt,r=Be;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function n(u){return(0,t.is)(u,e.HexStruct)}e.isHexString=n;function i(u){return(0,t.is)(u,e.StrictHexStruct)}e.isStrictHexString=i;function s(u){(0,r.assert)(n(u),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function a(u){(0,r.assert)(i(u),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=a;function o(u){return u.startsWith("0x")?u:u.startsWith("0X")?`0x${u.substring(2)}`:`0x${u}`}e.add0x=o;function l(u){return u.startsWith("0x")||u.startsWith("0X")?u.substring(2):u}e.remove0x=l})(fn);Object.defineProperty(he,"__esModule",{value:!0});he.createDataView=he.concatBytes=he.valueToBytes=he.stringToBytes=he.numberToBytes=he.signedBigIntToBytes=he.bigIntToBytes=he.hexToBytes=he.bytesToString=he.bytesToNumber=he.bytesToSignedBigInt=he.bytesToBigInt=he.bytesToHex=he.assertIsBytes=he.isBytes=void 0;const ze=Be,lo=fn,ac=48,cc=58,lc=87;function D1(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const j1=D1();function jo(e){return e instanceof Uint8Array}he.isBytes=jo;function xr(e){(0,ze.assert)(jo(e),"Value must be a Uint8Array.")}he.assertIsBytes=xr;function Mu(e){if(xr(e),e.length===0)return"0x";const t=j1(),r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=t[e[n]];return(0,lo.add0x)(r.join(""))}he.bytesToHex=Mu;function Nu(e){xr(e);const t=Mu(e);return BigInt(t)}he.bytesToBigInt=Nu;function U1(e){xr(e);let t=BigInt(0);for(const r of e)t=(t<<BigInt(8))+BigInt(r);return BigInt.asIntN(e.length*8,t)}he.bytesToSignedBigInt=U1;function H1(e){xr(e);const t=Nu(e);return(0,ze.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)}he.bytesToNumber=H1;function W1(e){return xr(e),new TextDecoder().decode(e)}he.bytesToString=W1;function wi(e){var t;if(((t=e==null?void 0:e.toLowerCase)===null||t===void 0?void 0:t.call(e))==="0x")return new Uint8Array;(0,lo.assertIsHexString)(e);const r=(0,lo.remove0x)(e).toLowerCase(),n=r.length%2===0?r:`0${r}`,i=new Uint8Array(n.length/2);for(let s=0;s<i.length;s++){const a=n.charCodeAt(s*2),o=n.charCodeAt(s*2+1),l=a-(a<cc?ac:lc),u=o-(o<cc?ac:lc);i[s]=l*16+u}return i}he.hexToBytes=wi;function Lu(e){(0,ze.assert)(typeof e=="bigint","Value must be a bigint."),(0,ze.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return wi(t)}he.bigIntToBytes=Lu;function V1(e,t){(0,ze.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function z1(e,t){(0,ze.assert)(typeof e=="bigint","Value must be a bigint."),(0,ze.assert)(typeof t=="number","Byte length must be a number."),(0,ze.assert)(t>0,"Byte length must be greater than 0."),(0,ze.assert)(V1(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i<n.length;i++)n[i]=Number(BigInt.asUintN(8,r)),r>>=BigInt(8);return n.reverse()}he.signedBigIntToBytes=z1;function Bu(e){(0,ze.assert)(typeof e=="number","Value must be a number."),(0,ze.assert)(e>=0,"Value must be a non-negative number."),(0,ze.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return wi(t)}he.numberToBytes=Bu;function Pu(e){return(0,ze.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}he.stringToBytes=Pu;function Ou(e){if(typeof e=="bigint")return Lu(e);if(typeof e=="number")return Bu(e);if(typeof e=="string")return e.startsWith("0x")?wi(e):Pu(e);if(jo(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}he.valueToBytes=Ou;function q1(e){const t=new Array(e.length);let r=0;for(let i=0;i<e.length;i++){const s=Ou(e[i]);t[i]=s,r+=s.length}const n=new Uint8Array(r);for(let i=0,s=0;i<t.length;i++)n.set(t[i],s),s+=t[i].length;return n}he.concatBytes=q1;function G1(e){if(typeof Buffer<"u"&&e instanceof Buffer){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}he.createDataView=G1;var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.ChecksumStruct=void 0;const uc=Yt,J1=hn;Ei.ChecksumStruct=(0,uc.size)((0,J1.base64)((0,uc.string)(),{paddingRequired:!0}),44,44);var mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.createHex=mt.createBytes=mt.createBigInt=mt.createNumber=void 0;const Ce=Yt,Z1=Be,$u=he,vi=fn,Fu=(0,Ce.union)([(0,Ce.number)(),(0,Ce.bigint)(),(0,Ce.string)(),vi.StrictHexStruct]),K1=(0,Ce.coerce)((0,Ce.number)(),Fu,Number),Q1=(0,Ce.coerce)((0,Ce.bigint)(),Fu,BigInt);(0,Ce.union)([vi.StrictHexStruct,(0,Ce.instance)(Uint8Array)]);const Y1=(0,Ce.coerce)((0,Ce.instance)(Uint8Array),(0,Ce.union)([vi.StrictHexStruct]),$u.hexToBytes),X1=(0,Ce.coerce)(vi.StrictHexStruct,(0,Ce.instance)(Uint8Array),$u.bytesToHex);function eg(e){try{const t=(0,Ce.create)(e,K1);return(0,Z1.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){throw t instanceof Ce.StructError?new Error(`Expected a number-like value, got "${e}".`):t}}mt.createNumber=eg;function tg(e){try{return(0,Ce.create)(e,Q1)}catch(t){throw t instanceof Ce.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}mt.createBigInt=tg;function rg(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return(0,Ce.create)(e,Y1)}catch(t){throw t instanceof Ce.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}mt.createBytes=rg;function ng(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return(0,Ce.create)(e,X1)}catch(t){throw t instanceof Ce.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}mt.createHex=ng;var yr={},Du=Z&&Z.__classPrivateFieldSet||function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},De=Z&&Z.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},tt,lt;Object.defineProperty(yr,"__esModule",{value:!0});yr.FrozenSet=yr.FrozenMap=void 0;class Uo{constructor(t){tt.set(this,void 0),Du(this,tt,new Map(t),"f"),Object.freeze(this)}get size(){return De(this,tt,"f").size}[(tt=new WeakMap,Symbol.iterator)](){return De(this,tt,"f")[Symbol.iterator]()}entries(){return De(this,tt,"f").entries()}forEach(t,r){return De(this,tt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}get(t){return De(this,tt,"f").get(t)}has(t){return De(this,tt,"f").has(t)}keys(){return De(this,tt,"f").keys()}values(){return De(this,tt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}yr.FrozenMap=Uo;class Ho{constructor(t){lt.set(this,void 0),Du(this,lt,new Set(t),"f"),Object.freeze(this)}get size(){return De(this,lt,"f").size}[(lt=new WeakMap,Symbol.iterator)](){return De(this,lt,"f")[Symbol.iterator]()}entries(){return De(this,lt,"f").entries()}forEach(t,r){return De(this,lt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}has(t){return De(this,lt,"f").has(t)}keys(){return De(this,lt,"f").keys()}values(){return De(this,lt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}yr.FrozenSet=Ho;Object.freeze(Uo);Object.freeze(Uo.prototype);Object.freeze(Ho);Object.freeze(Ho.prototype);var ju={};Object.defineProperty(ju,"__esModule",{value:!0});var Uu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=Yt,r=Be,n=()=>(0,t.define)("finite number",A=>(0,t.is)(A,(0,t.number)())&&Number.isFinite(A));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),n(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(A,B)=>{function K(H,D){const oe=[...D.validator(H,B)];return oe.length>0?oe:!0}try{const H=K(A,e.UnsafeJsonStruct);return H!==!0?H:K(JSON.parse(JSON.stringify(A)),e.UnsafeJsonStruct)}catch(H){return H instanceof RangeError?"Circular reference detected":!1}});function i(A){return(0,t.is)(A,e.JsonStruct)}e.isValidJson=i;function s(A){(0,r.assertStruct)(A,e.JsonStruct,"Invalid JSON value");const B=JSON.stringify(A);return new TextEncoder().encode(B).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function a(A){return(0,t.is)(A,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=a;function o(A,B){(0,r.assertStruct)(A,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",B)}e.assertIsJsonRpcNotification=o;function l(A){return(0,t.is)(A,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=l;function u(A,B){(0,r.assertStruct)(A,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",B)}e.assertIsJsonRpcRequest=u,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function f(A){return(0,t.is)(A,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=f;function h(A,B){(0,r.assertStruct)(A,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",B)}e.assertIsPendingJsonRpcResponse=h;function g(A){return(0,t.is)(A,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=g;function _(A,B){(0,r.assertStruct)(A,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",B)}e.assertIsJsonRpcResponse=_;function E(A){return(0,t.is)(A,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=E;function x(A,B){(0,r.assertStruct)(A,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",B)}e.assertIsJsonRpcSuccess=x;function R(A){return(0,t.is)(A,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=R;function b(A,B){(0,r.assertStruct)(A,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",B)}e.assertIsJsonRpcFailure=b;function v(A){return(0,t.is)(A,e.JsonRpcErrorStruct)}e.isJsonRpcError=v;function S(A,B){(0,r.assertStruct)(A,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",B)}e.assertIsJsonRpcError=S;function M(A){const{permitEmptyString:B,permitFractions:K,permitNull:H}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},A);return ie=>!!(typeof ie=="number"&&(K||Number.isInteger(ie))||typeof ie=="string"&&(B||ie.length>0)||H&&ie===null)}e.getJsonRpcIdValidator=M})(Uu);var Hu={};Object.defineProperty(Hu,"__esModule",{value:!0});var wr={},uo={exports:{}},Hs,dc;function ig(){if(dc)return Hs;dc=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;Hs=function(f,h){h=h||{};var g=typeof f;if(g==="string"&&f.length>0)return a(f);if(g==="number"&&isFinite(f))return h.long?l(f):o(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function a(f){if(f=String(f),!(f.length>100)){var h=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(h){var g=parseFloat(h[1]),_=(h[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return g*s;case"weeks":case"week":case"w":return g*i;case"days":case"day":case"d":return g*n;case"hours":case"hour":case"hrs":case"hr":case"h":return g*r;case"minutes":case"minute":case"mins":case"min":case"m":return g*t;case"seconds":case"second":case"secs":case"sec":case"s":return g*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function o(f){var h=Math.abs(f);return h>=n?Math.round(f/n)+"d":h>=r?Math.round(f/r)+"h":h>=t?Math.round(f/t)+"m":h>=e?Math.round(f/e)+"s":f+"ms"}function l(f){var h=Math.abs(f);return h>=n?u(f,h,n,"day"):h>=r?u(f,h,r,"hour"):h>=t?u(f,h,t,"minute"):h>=e?u(f,h,e,"second"):f+" ms"}function u(f,h,g,_){var E=h>=g*1.5;return Math.round(f/g)+" "+_+(E?"s":"")}return Hs}function sg(e){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=i,r.enabled=o,r.humanize=ig(),r.destroy=u,Object.keys(e).forEach(f=>{r[f]=e[f]}),r.names=[],r.skips=[],r.formatters={};function t(f){let h=0;for(let g=0;g<f.length;g++)h=(h<<5)-h+f.charCodeAt(g),h|=0;return r.colors[Math.abs(h)%r.colors.length]}r.selectColor=t;function r(f){let h,g=null,_,E;function x(...R){if(!x.enabled)return;const b=x,v=Number(new Date),S=v-(h||v);b.diff=S,b.prev=h,b.curr=v,h=v,R[0]=r.coerce(R[0]),typeof R[0]!="string"&&R.unshift("%O");let M=0;R[0]=R[0].replace(/%([a-zA-Z%])/g,(B,K)=>{if(B==="%%")return"%";M++;const H=r.formatters[K];if(typeof H=="function"){const D=R[M];B=H.call(b,D),R.splice(M,1),M--}return B}),r.formatArgs.call(b,R),(b.log||r.log).apply(b,R)}return x.namespace=f,x.useColors=r.useColors(),x.color=r.selectColor(f),x.extend=n,x.destroy=r.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>g!==null?g:(_!==r.namespaces&&(_=r.namespaces,E=r.enabled(f)),E),set:R=>{g=R}}),typeof r.init=="function"&&r.init(x),x}function n(f,h){const g=r(this.namespace+(typeof h>"u"?":":h)+f);return g.log=this.log,g}function i(f){r.save(f),r.namespaces=f,r.names=[],r.skips=[];const h=(typeof f=="string"?f:"").trim().replace(" ",",").split(",").filter(Boolean);for(const g of h)g[0]==="-"?r.skips.push(g.slice(1)):r.names.push(g)}function s(f,h){let g=0,_=0,E=-1,x=0;for(;g<f.length;)if(_<h.length&&(h[_]===f[g]||h[_]==="*"))h[_]==="*"?(E=_,x=g,_++):(g++,_++);else if(E!==-1)_=E+1,x++,g=x;else return!1;for(;_<h.length&&h[_]==="*";)_++;return _===h.length}function a(){const f=[...r.names,...r.skips.map(h=>"-"+h)].join(",");return r.enable(""),f}function o(f){for(const h of r.skips)if(s(f,h))return!1;for(const h of r.names)if(s(f,h))return!0;return!1}function l(f){return f instanceof Error?f.stack||f.message:f}function u(){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 og=sg;(function(e,t){var r={VITE_SEGMENT_DEV_API_KEY:"UJLmm39XefLTcE55pRdWiwBT1JoTs6OI",VITE_SEGMENT_PRD_API_KEY:"uMHQo9dBTi626Bv11I3RxcH3Jui8lKMm"};t.formatArgs=i,t.save=s,t.load=a,t.useColors=n,t.storage=o(),t.destroy=(()=>{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){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 u;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&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;u.splice(1,0,f,"color: inherit");let h=0,g=0;u[0].replace(/%[a-zA-Z%]/g,_=>{_!=="%%"&&(h++,_==="%c"&&(g=h))}),u.splice(g,0,f)}t.log=console.debug||console.log||(()=>{});function s(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function a(){let u;try{u=t.storage.getItem("debug")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=r.DEBUG),u}function o(){try{return localStorage}catch{}}e.exports=og(t);const{formatters:l}=e.exports;l.j=function(u){try{return JSON.stringify(u)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(uo,uo.exports);var ag=uo.exports,cg=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wr,"__esModule",{value:!0});wr.createModuleLogger=wr.createProjectLogger=void 0;const lg=cg(ag),ug=(0,lg.default)("metamask");function dg(e){return ug.extend(e)}wr.createProjectLogger=dg;function hg(e,t){return e.extend(t)}wr.createModuleLogger=hg;var Wu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(u){return Array.isArray(u)&&u.length>0}e.isNonEmptyArray=t;function r(u){return u==null}e.isNullOrUndefined=r;function n(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}e.isObject=n;const i=(u,f)=>Object.hasOwnProperty.call(u,f);e.hasProperty=i,function(u){u[u.Null=4]="Null",u[u.Comma=1]="Comma",u[u.Wrapper=1]="Wrapper",u[u.True=4]="True",u[u.False=5]="False",u[u.Quote=1]="Quote",u[u.Colon=1]="Colon",u[u.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(u){if(typeof u!="object"||u===null)return!1;try{let f=u;for(;Object.getPrototypeOf(f)!==null;)f=Object.getPrototypeOf(f);return Object.getPrototypeOf(u)===f}catch{return!1}}e.isPlainObject=s;function a(u){return u.charCodeAt(0)<=127}e.isASCII=a;function o(u){var f;return u.split("").reduce((g,_)=>a(_)?g+1:g+2,0)+((f=u.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&f!==void 0?f:[]).length}e.calculateStringSize=o;function l(u){return u.toString().length}e.calculateNumberSize=l})(Wu);var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.hexToBigInt=bt.hexToNumber=bt.bigIntToHex=bt.numberToHex=void 0;const ur=Be,jr=fn,fg=e=>((0,ur.assert)(typeof e=="number","Value must be a number."),(0,ur.assert)(e>=0,"Value must be a non-negative number."),(0,ur.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,jr.add0x)(e.toString(16)));bt.numberToHex=fg;const pg=e=>((0,ur.assert)(typeof e=="bigint","Value must be a bigint."),(0,ur.assert)(e>=0,"Value must be a non-negative bigint."),(0,jr.add0x)(e.toString(16)));bt.bigIntToHex=pg;const gg=e=>{(0,jr.assertIsHexString)(e);const t=parseInt(e,16);return(0,ur.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};bt.hexToNumber=gg;const _g=e=>((0,jr.assertIsHexString)(e),BigInt((0,jr.add0x)(e)));bt.hexToBigInt=_g;var Vu={};Object.defineProperty(Vu,"__esModule",{value:!0});var zu={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,a)=>{if(!t(s))throw new Error(`"${a}" must be a non-negative integer. Received: "${s}".`)};function n(s,a){return r(s,"count"),s*a}e.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=i})(zu);var qu={};Object.defineProperty(qu,"__esModule",{value:!0});var Gu={},ho={exports:{}};const mg="2.0.0",Ju=256,bg=Number.MAX_SAFE_INTEGER||9007199254740991,yg=16,wg=Ju-6,Eg=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Si={MAX_LENGTH:Ju,MAX_SAFE_COMPONENT_LENGTH:yg,MAX_SAFE_BUILD_LENGTH:wg,MAX_SAFE_INTEGER:bg,RELEASE_TYPES:Eg,SEMVER_SPEC_VERSION:mg,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Ws={VITE_SEGMENT_DEV_API_KEY:"UJLmm39XefLTcE55pRdWiwBT1JoTs6OI",VITE_SEGMENT_PRD_API_KEY:"uMHQo9dBTi626Bv11I3RxcH3Jui8lKMm"};const vg=typeof process=="object"&&Ws&&Ws.NODE_DEBUG&&/\bsemver\b/i.test(Ws.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ri=vg;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Si,s=Ri;t=e.exports={};const a=t.re=[],o=t.safeRe=[],l=t.src=[],u=t.t={};let f=0;const h="[a-zA-Z0-9-]",g=[["\\s",1],["\\d",i],[h,n]],_=x=>{for(const[R,b]of g)x=x.split(`${R}*`).join(`${R}{0,${b}}`).split(`${R}+`).join(`${R}{1,${b}}`);return x},E=(x,R,b)=>{const v=_(R),S=f++;s(x,S,R),u[x]=S,l[S]=R,a[S]=new RegExp(R,b?"g":void 0),o[S]=new RegExp(v,b?"g":void 0)};E("NUMERICIDENTIFIER","0|[1-9]\\d*"),E("NUMERICIDENTIFIERLOOSE","\\d+"),E("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),E("MAINVERSION",`(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})\\.(${l[u.NUMERICIDENTIFIER]})`),E("MAINVERSIONLOOSE",`(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})\\.(${l[u.NUMERICIDENTIFIERLOOSE]})`),E("PRERELEASEIDENTIFIER",`(?:${l[u.NUMERICIDENTIFIER]}|${l[u.NONNUMERICIDENTIFIER]})`),E("PRERELEASEIDENTIFIERLOOSE",`(?:${l[u.NUMERICIDENTIFIERLOOSE]}|${l[u.NONNUMERICIDENTIFIER]})`),E("PRERELEASE",`(?:-(${l[u.PRERELEASEIDENTIFIER]}(?:\\.${l[u.PRERELEASEIDENTIFIER]})*))`),E("PRERELEASELOOSE",`(?:-?(${l[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[u.PRERELEASEIDENTIFIERLOOSE]})*))`),E("BUILDIDENTIFIER",`${h}+`),E("BUILD",`(?:\\+(${l[u.BUILDIDENTIFIER]}(?:\\.${l[u.BUILDIDENTIFIER]})*))`),E("FULLPLAIN",`v?${l[u.MAINVERSION]}${l[u.PRERELEASE]}?${l[u.BUILD]}?`),E("FULL",`^${l[u.FULLPLAIN]}$`),E("LOOSEPLAIN",`[v=\\s]*${l[u.MAINVERSIONLOOSE]}${l[u.PRERELEASELOOSE]}?${l[u.BUILD]}?`),E("LOOSE",`^${l[u.LOOSEPLAIN]}$`),E("GTLT","((?:<|>)?=?)"),E("XRANGEIDENTIFIERLOOSE",`${l[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),E("XRANGEIDENTIFIER",`${l[u.NUMERICIDENTIFIER]}|x|X|\\*`),E("XRANGEPLAIN",`[v=\\s]*(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:\\.(${l[u.XRANGEIDENTIFIER]})(?:${l[u.PRERELEASE]})?${l[u.BUILD]}?)?)?`),E("XRANGEPLAINLOOSE",`[v=\\s]*(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[u.XRANGEIDENTIFIERLOOSE]})(?:${l[u.PRERELEASELOOSE]})?${l[u.BUILD]}?)?)?`),E("XRANGE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAIN]}$`),E("XRANGELOOSE",`^${l[u.GTLT]}\\s*${l[u.XRANGEPLAINLOOSE]}$`),E("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),E("COERCE",`${l[u.COERCEPLAIN]}(?:$|[^\\d])`),E("COERCEFULL",l[u.COERCEPLAIN]+`(?:${l[u.PRERELEASE]})?(?:${l[u.BUILD]})?(?:$|[^\\d])`),E("COERCERTL",l[u.COERCE],!0),E("COERCERTLFULL",l[u.COERCEFULL],!0),E("LONETILDE","(?:~>?)"),E("TILDETRIM",`(\\s*)${l[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",E("TILDE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAIN]}$`),E("TILDELOOSE",`^${l[u.LONETILDE]}${l[u.XRANGEPLAINLOOSE]}$`),E("LONECARET","(?:\\^)"),E("CARETTRIM",`(\\s*)${l[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",E("CARET",`^${l[u.LONECARET]}${l[u.XRANGEPLAIN]}$`),E("CARETLOOSE",`^${l[u.LONECARET]}${l[u.XRANGEPLAINLOOSE]}$`),E("COMPARATORLOOSE",`^${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]})$|^$`),E("COMPARATOR",`^${l[u.GTLT]}\\s*(${l[u.FULLPLAIN]})$|^$`),E("COMPARATORTRIM",`(\\s*)${l[u.GTLT]}\\s*(${l[u.LOOSEPLAIN]}|${l[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",E("HYPHENRANGE",`^\\s*(${l[u.XRANGEPLAIN]})\\s+-\\s+(${l[u.XRANGEPLAIN]})\\s*$`),E("HYPHENRANGELOOSE",`^\\s*(${l[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[u.XRANGEPLAINLOOSE]})\\s*$`),E("STAR","(<|>)?=?\\s*\\*"),E("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),E("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(ho,ho.exports);var pn=ho.exports;const Sg=Object.freeze({loose:!0}),Rg=Object.freeze({}),Cg=e=>e?typeof e!="object"?Sg:e:Rg;var Wo=Cg;const hc=/^[0-9]+$/,Zu=(e,t)=>{const r=hc.test(e),n=hc.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},kg=(e,t)=>Zu(t,e);var Ku={compareIdentifiers:Zu,rcompareIdentifiers:kg};const kn=Ri,{MAX_LENGTH:fc,MAX_SAFE_INTEGER:In}=Si,{safeRe:pc,t:gc}=pn,Ig=Wo,{compareIdentifiers:ir}=Ku;let xg=class ut{constructor(t,r){if(r=Ig(r),t instanceof ut){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>fc)throw new TypeError(`version is longer than ${fc} characters`);kn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?pc[gc.LOOSE]:pc[gc.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>In||this.major<0)throw new TypeError("Invalid major version");if(this.minor>In||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>In||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s<In)return s}return i}):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(t){if(kn("SemVer.compare",this.version,this.options,t),!(t instanceof ut)){if(typeof t=="string"&&t===this.version)return 0;t=new ut(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof ut||(t=new ut(t,this.options)),ir(this.major,t.major)||ir(this.minor,t.minor)||ir(this.patch,t.patch)}comparePre(t){if(t instanceof ut||(t=new ut(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],i=t.prerelease[r];if(kn("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ir(n,i)}while(++r)}compareBuild(t){t instanceof ut||(t=new ut(t,this.options));let r=0;do{const n=this.build[r],i=t.build[r];if(kn("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return ir(n,i)}while(++r)}inc(t,r,n){switch(t){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 i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),ir(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var je=xg;const _c=je,Ag=(e,t,r=!1)=>{if(e instanceof _c)return e;try{return new _c(e,t)}catch(n){if(!r)return null;throw n}};var Ar=Ag;const Tg=Ar,Mg=(e,t)=>{const r=Tg(e,t);return r?r.version:null};var Ng=Mg;const Lg=Ar,Bg=(e,t)=>{const r=Lg(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var Pg=Bg;const mc=je,Og=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new mc(e instanceof mc?e.version:e,r).inc(t,n,i).version}catch{return null}};var $g=Og;const bc=Ar,Fg=(e,t)=>{const r=bc(e,null,!0),n=bc(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,a=s?r:n,o=s?n:r,l=!!a.prerelease.length;if(!!o.prerelease.length&&!l)return!o.patch&&!o.minor?"major":a.patch?"patch":a.minor?"minor":"major";const f=l?"pre":"";return r.major!==n.major?f+"major":r.minor!==n.minor?f+"minor":r.patch!==n.patch?f+"patch":"prerelease"};var Dg=Fg;const jg=je,Ug=(e,t)=>new jg(e,t).major;var Hg=Ug;const Wg=je,Vg=(e,t)=>new Wg(e,t).minor;var zg=Vg;const qg=je,Gg=(e,t)=>new qg(e,t).patch;var Jg=Gg;const Zg=Ar,Kg=(e,t)=>{const r=Zg(e,t);return r&&r.prerelease.length?r.prerelease:null};var Qg=Kg;const yc=je,Yg=(e,t,r)=>new yc(e,r).compare(new yc(t,r));var it=Yg;const Xg=it,e_=(e,t,r)=>Xg(t,e,r);var t_=e_;const r_=it,n_=(e,t)=>r_(e,t,!0);var i_=n_;const wc=je,s_=(e,t,r)=>{const n=new wc(e,r),i=new wc(t,r);return n.compare(i)||n.compareBuild(i)};var Vo=s_;const o_=Vo,a_=(e,t)=>e.sort((r,n)=>o_(r,n,t));var c_=a_;const l_=Vo,u_=(e,t)=>e.sort((r,n)=>l_(n,r,t));var d_=u_;const h_=it,f_=(e,t,r)=>h_(e,t,r)>0;var Ci=f_;const p_=it,g_=(e,t,r)=>p_(e,t,r)<0;var zo=g_;const __=it,m_=(e,t,r)=>__(e,t,r)===0;var Qu=m_;const b_=it,y_=(e,t,r)=>b_(e,t,r)!==0;var Yu=y_;const w_=it,E_=(e,t,r)=>w_(e,t,r)>=0;var qo=E_;const v_=it,S_=(e,t,r)=>v_(e,t,r)<=0;var Go=S_;const R_=Qu,C_=Yu,k_=Ci,I_=qo,x_=zo,A_=Go,T_=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return R_(e,r,n);case"!=":return C_(e,r,n);case">":return k_(e,r,n);case">=":return I_(e,r,n);case"<":return x_(e,r,n);case"<=":return A_(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Xu=T_;const M_=je,N_=Ar,{safeRe:xn,t:An}=pn,L_=(e,t)=>{if(e instanceof M_)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?xn[An.COERCEFULL]:xn[An.COERCE]);else{const l=t.includePrerelease?xn[An.COERCERTLFULL]:xn[An.COERCERTL];let u;for(;(u=l.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),l.lastIndex=u.index+u[1].length+u[2].length;l.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",o=t.includePrerelease&&r[6]?`+${r[6]}`:"";return N_(`${n}.${i}.${s}${a}${o}`,t)};var B_=L_;class P_{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var O_=P_,Vs,Ec;function st(){if(Ec)return Vs;Ec=1;const e=/\s+/g;class t{constructor(O,V){if(V=i(V),O instanceof t)return O.loose===!!V.loose&&O.includePrerelease===!!V.includePrerelease?O:new t(O.raw,V);if(O instanceof s)return this.raw=O.value,this.set=[[O]],this.formatted=void 0,this;if(this.options=V,this.loose=!!V.loose,this.includePrerelease=!!V.includePrerelease,this.raw=O.trim().replace(e," "),this.set=this.raw.split("||").map(j=>this.parseRange(j.trim())).filter(j=>j.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const j=this.set[0];if(this.set=this.set.filter(q=>!x(q[0])),this.set.length===0)this.set=[j];else if(this.set.length>1){for(const q of this.set)if(q.length===1&&R(q[0])){this.set=[q];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let O=0;O<this.set.length;O++){O>0&&(this.formatted+="||");const V=this.set[O];for(let j=0;j<V.length;j++)j>0&&(this.formatted+=" "),this.formatted+=V[j].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(O){const j=((this.options.includePrerelease&&_)|(this.options.loose&&E))+":"+O,q=n.get(j);if(q)return q;const U=this.options.loose,Q=U?l[u.HYPHENRANGELOOSE]:l[u.HYPHENRANGE];O=O.replace(Q,ae(this.options.includePrerelease)),a("hyphen replace",O),O=O.replace(l[u.COMPARATORTRIM],f),a("comparator trim",O),O=O.replace(l[u.TILDETRIM],h),a("tilde trim",O),O=O.replace(l[u.CARETTRIM],g),a("caret trim",O);let G=O.split(" ").map(ce=>v(ce,this.options)).join(" ").split(/\s+/).map(ce=>oe(ce,this.options));U&&(G=G.filter(ce=>(a("loose invalid filter",ce,this.options),!!ce.match(l[u.COMPARATORLOOSE])))),a("range list",G);const z=new Map,re=G.map(ce=>new s(ce,this.options));for(const ce of re){if(x(ce))return[ce];z.set(ce.value,ce)}z.size>1&&z.has("")&&z.delete("");const Ee=[...z.values()];return n.set(j,Ee),Ee}intersects(O,V){if(!(O instanceof t))throw new TypeError("a Range is required");return this.set.some(j=>b(j,V)&&O.set.some(q=>b(q,V)&&j.every(U=>q.every(Q=>U.intersects(Q,V)))))}test(O){if(!O)return!1;if(typeof O=="string")try{O=new o(O,this.options)}catch{return!1}for(let V=0;V<this.set.length;V++)if(pe(this.set[V],O,this.options))return!0;return!1}}Vs=t;const r=O_,n=new r,i=Wo,s=ki(),a=Ri,o=je,{safeRe:l,t:u,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:g}=pn,{FLAG_INCLUDE_PRERELEASE:_,FLAG_LOOSE:E}=Si,x=$=>$.value==="<0.0.0-0",R=$=>$.value==="",b=($,O)=>{let V=!0;const j=$.slice();let q=j.pop();for(;V&&j.length;)V=j.every(U=>q.intersects(U,O)),q=j.pop();return V},v=($,O)=>(a("comp",$,O),$=B($,O),a("caret",$),$=M($,O),a("tildes",$),$=H($,O),a("xrange",$),$=ie($,O),a("stars",$),$),S=$=>!$||$.toLowerCase()==="x"||$==="*",M=($,O)=>$.trim().split(/\s+/).map(V=>A(V,O)).join(" "),A=($,O)=>{const V=O.loose?l[u.TILDELOOSE]:l[u.TILDE];return $.replace(V,(j,q,U,Q,G)=>{a("tilde",$,j,q,U,Q,G);let z;return S(q)?z="":S(U)?z=`>=${q}.0.0 <${+q+1}.0.0-0`:S(Q)?z=`>=${q}.${U}.0 <${q}.${+U+1}.0-0`:G?(a("replaceTilde pr",G),z=`>=${q}.${U}.${Q}-${G} <${q}.${+U+1}.0-0`):z=`>=${q}.${U}.${Q} <${q}.${+U+1}.0-0`,a("tilde return",z),z})},B=($,O)=>$.trim().split(/\s+/).map(V=>K(V,O)).join(" "),K=($,O)=>{a("caret",$,O);const V=O.loose?l[u.CARETLOOSE]:l[u.CARET],j=O.includePrerelease?"-0":"";return $.replace(V,(q,U,Q,G,z)=>{a("caret",$,q,U,Q,G,z);let re;return S(U)?re="":S(Q)?re=`>=${U}.0.0${j} <${+U+1}.0.0-0`:S(G)?U==="0"?re=`>=${U}.${Q}.0${j} <${U}.${+Q+1}.0-0`:re=`>=${U}.${Q}.0${j} <${+U+1}.0.0-0`:z?(a("replaceCaret pr",z),U==="0"?Q==="0"?re=`>=${U}.${Q}.${G}-${z} <${U}.${Q}.${+G+1}-0`:re=`>=${U}.${Q}.${G}-${z} <${U}.${+Q+1}.0-0`:re=`>=${U}.${Q}.${G}-${z} <${+U+1}.0.0-0`):(a("no pr"),U==="0"?Q==="0"?re=`>=${U}.${Q}.${G}${j} <${U}.${Q}.${+G+1}-0`:re=`>=${U}.${Q}.${G}${j} <${U}.${+Q+1}.0-0`:re=`>=${U}.${Q}.${G} <${+U+1}.0.0-0`),a("caret return",re),re})},H=($,O)=>(a("replaceXRanges",$,O),$.split(/\s+/).map(V=>D(V,O)).join(" ")),D=($,O)=>{$=$.trim();const V=O.loose?l[u.XRANGELOOSE]:l[u.XRANGE];return $.replace(V,(j,q,U,Q,G,z)=>{a("xRange",$,j,q,U,Q,G,z);const re=S(U),Ee=re||S(Q),ce=Ee||S(G),k=ce;return q==="="&&k&&(q=""),z=O.includePrerelease?"-0":"",re?q===">"||q==="<"?j="<0.0.0-0":j="*":q&&k?(Ee&&(Q=0),G=0,q===">"?(q=">=",Ee?(U=+U+1,Q=0,G=0):(Q=+Q+1,G=0)):q==="<="&&(q="<",Ee?U=+U+1:Q=+Q+1),q==="<"&&(z="-0"),j=`${q+U}.${Q}.${G}${z}`):Ee?j=`>=${U}.0.0${z} <${+U+1}.0.0-0`:ce&&(j=`>=${U}.${Q}.0${z} <${U}.${+Q+1}.0-0`),a("xRange return",j),j})},ie=($,O)=>(a("replaceStars",$,O),$.trim().replace(l[u.STAR],"")),oe=($,O)=>(a("replaceGTE0",$,O),$.trim().replace(l[O.includePrerelease?u.GTE0PRE:u.GTE0],"")),ae=$=>(O,V,j,q,U,Q,G,z,re,Ee,ce,k)=>(S(j)?V="":S(q)?V=`>=${j}.0.0${$?"-0":""}`:S(U)?V=`>=${j}.${q}.0${$?"-0":""}`:Q?V=`>=${V}`:V=`>=${V}${$?"-0":""}`,S(re)?z="":S(Ee)?z=`<${+re+1}.0.0-0`:S(ce)?z=`<${re}.${+Ee+1}.0-0`:k?z=`<=${re}.${Ee}.${ce}-${k}`:$?z=`<${re}.${Ee}.${+ce+1}-0`:z=`<=${z}`,`${V} ${z}`.trim()),pe=($,O,V)=>{for(let j=0;j<$.length;j++)if(!$[j].test(O))return!1;if(O.prerelease.length&&!V.includePrerelease){for(let j=0;j<$.length;j++)if(a($[j].semver),$[j].semver!==s.ANY&&$[j].semver.prerelease.length>0){const q=$[j].semver;if(q.major===O.major&&q.minor===O.minor&&q.patch===O.patch)return!0}return!1}return!0};return Vs}var zs,vc;function ki(){if(vc)return zs;vc=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(f,h){if(h=r(h),f instanceof t){if(f.loose===!!h.loose)return f;f=f.value}f=f.trim().split(/\s+/).join(" "),a("comparator",f,h),this.options=h,this.loose=!!h.loose,this.parse(f),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(f){const h=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],g=f.match(h);if(!g)throw new TypeError(`Invalid comparator: ${f}`);this.operator=g[1]!==void 0?g[1]:"",this.operator==="="&&(this.operator=""),g[2]?this.semver=new o(g[2],this.options.loose):this.semver=e}toString(){return this.value}test(f){if(a("Comparator.test",f,this.options.loose),this.semver===e||f===e)return!0;if(typeof f=="string")try{f=new o(f,this.options)}catch{return!1}return s(f,this.operator,this.semver,this.options)}intersects(f,h){if(!(f instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(f.value,h).test(this.value):f.operator===""?f.value===""?!0:new l(this.value,h).test(f.semver):(h=r(h),h.includePrerelease&&(this.value==="<0.0.0-0"||f.value==="<0.0.0-0")||!h.includePrerelease&&(this.value.startsWith("<0.0.0")||f.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&f.operator.startsWith(">")||this.operator.startsWith("<")&&f.operator.startsWith("<")||this.semver.version===f.semver.version&&this.operator.includes("=")&&f.operator.includes("=")||s(this.semver,"<",f.semver,h)&&this.operator.startsWith(">")&&f.operator.startsWith("<")||s(this.semver,">",f.semver,h)&&this.operator.startsWith("<")&&f.operator.startsWith(">")))}}zs=t;const r=Wo,{safeRe:n,t:i}=pn,s=Xu,a=Ri,o=je,l=st();return zs}const $_=st(),F_=(e,t,r)=>{try{t=new $_(t,r)}catch{return!1}return t.test(e)};var Ii=F_;const D_=st(),j_=(e,t)=>new D_(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var U_=j_;const H_=je,W_=st(),V_=(e,t,r)=>{let n=null,i=null,s=null;try{s=new W_(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===-1)&&(n=a,i=new H_(n,r))}),n};var z_=V_;const q_=je,G_=st(),J_=(e,t,r)=>{let n=null,i=null,s=null;try{s=new G_(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===1)&&(n=a,i=new q_(n,r))}),n};var Z_=J_;const qs=je,K_=st(),Sc=Ci,Q_=(e,t)=>{e=new K_(e,t);let r=new qs("0.0.0");if(e.test(r)||(r=new qs("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){const i=e.set[n];let s=null;i.forEach(a=>{const o=new qs(a.semver.version);switch(a.operator){case">":o.prerelease.length===0?o.patch++:o.prerelease.push(0),o.raw=o.format();case"":case">=":(!s||Sc(o,s))&&(s=o);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Sc(r,s))&&(r=s)}return r&&e.test(r)?r:null};var Y_=Q_;const X_=st(),em=(e,t)=>{try{return new X_(e,t).range||"*"}catch{return null}};var tm=em;const rm=je,ed=ki(),{ANY:nm}=ed,im=st(),sm=Ii,Rc=Ci,Cc=zo,om=Go,am=qo,cm=(e,t,r,n)=>{e=new rm(e,n),t=new im(t,n);let i,s,a,o,l;switch(r){case">":i=Rc,s=om,a=Cc,o=">",l=">=";break;case"<":i=Cc,s=am,a=Rc,o="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(sm(e,t,n))return!1;for(let u=0;u<t.set.length;++u){const f=t.set[u];let h=null,g=null;if(f.forEach(_=>{_.semver===nm&&(_=new ed(">=0.0.0")),h=h||_,g=g||_,i(_.semver,h.semver,n)?h=_:a(_.semver,g.semver,n)&&(g=_)}),h.operator===o||h.operator===l||(!g.operator||g.operator===o)&&s(e,g.semver))return!1;if(g.operator===l&&a(e,g.semver))return!1}return!0};var Jo=cm;const lm=Jo,um=(e,t,r)=>lm(e,t,">",r);var dm=um;const hm=Jo,fm=(e,t,r)=>hm(e,t,"<",r);var pm=fm;const kc=st(),gm=(e,t,r)=>(e=new kc(e,r),t=new kc(t,r),e.intersects(t,r));var _m=gm;const mm=Ii,bm=it;var ym=(e,t,r)=>{const n=[];let i=null,s=null;const a=e.sort((f,h)=>bm(f,h,r));for(const f of a)mm(f,t,r)?(s=f,i||(i=f)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const o=[];for(const[f,h]of n)f===h?o.push(f):!h&&f===a[0]?o.push("*"):h?f===a[0]?o.push(`<=${h}`):o.push(`${f} - ${h}`):o.push(`>=${f}`);const l=o.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return l.length<u.length?l:t};const Ic=st(),Zo=ki(),{ANY:Gs}=Zo,Mr=Ii,Ko=it,wm=(e,t,r={})=>{if(e===t)return!0;e=new Ic(e,r),t=new Ic(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const a=vm(i,s,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},Em=[new Zo(">=0.0.0-0")],xc=[new Zo(">=0.0.0")],vm=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Gs){if(t.length===1&&t[0].semver===Gs)return!0;r.includePrerelease?e=Em:e=xc}if(t.length===1&&t[0].semver===Gs){if(r.includePrerelease)return!0;t=xc}const n=new Set;let i,s;for(const _ of e)_.operator===">"||_.operator===">="?i=Ac(i,_,r):_.operator==="<"||_.operator==="<="?s=Tc(s,_,r):n.add(_.semver);if(n.size>1)return null;let a;if(i&&s){if(a=Ko(i.semver,s.semver,r),a>0)return null;if(a===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const _ of n){if(i&&!Mr(_,String(i),r)||s&&!Mr(_,String(s),r))return null;for(const E of t)if(!Mr(_,String(E),r))return!1;return!0}let o,l,u,f,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,g=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;h&&h.prerelease.length===1&&s.operator==="<"&&h.prerelease[0]===0&&(h=!1);for(const _ of t){if(f=f||_.operator===">"||_.operator===">=",u=u||_.operator==="<"||_.operator==="<=",i){if(g&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===g.major&&_.semver.minor===g.minor&&_.semver.patch===g.patch&&(g=!1),_.operator===">"||_.operator===">="){if(o=Ac(i,_,r),o===_&&o!==i)return!1}else if(i.operator===">="&&!Mr(i.semver,String(_),r))return!1}if(s){if(h&&_.semver.prerelease&&_.semver.prerelease.length&&_.semver.major===h.major&&_.semver.minor===h.minor&&_.semver.patch===h.patch&&(h=!1),_.operator==="<"||_.operator==="<="){if(l=Tc(s,_,r),l===_&&l!==s)return!1}else if(s.operator==="<="&&!Mr(s.semver,String(_),r))return!1}if(!_.operator&&(s||i)&&a!==0)return!1}return!(i&&u&&!s&&a!==0||s&&f&&!i&&a!==0||g||h)},Ac=(e,t,r)=>{if(!e)return t;const n=Ko(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Tc=(e,t,r)=>{if(!e)return t;const n=Ko(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var Sm=wm;const Js=pn,Mc=Si,Rm=je,Nc=Ku,Cm=Ar,km=Ng,Im=Pg,xm=$g,Am=Dg,Tm=Hg,Mm=zg,Nm=Jg,Lm=Qg,Bm=it,Pm=t_,Om=i_,$m=Vo,Fm=c_,Dm=d_,jm=Ci,Um=zo,Hm=Qu,Wm=Yu,Vm=qo,zm=Go,qm=Xu,Gm=B_,Jm=ki(),Zm=st(),Km=Ii,Qm=U_,Ym=z_,Xm=Z_,eb=Y_,tb=tm,rb=Jo,nb=dm,ib=pm,sb=_m,ob=ym,ab=Sm;var cb={parse:Cm,valid:km,clean:Im,inc:xm,diff:Am,major:Tm,minor:Mm,patch:Nm,prerelease:Lm,compare:Bm,rcompare:Pm,compareLoose:Om,compareBuild:$m,sort:Fm,rsort:Dm,gt:jm,lt:Um,eq:Hm,neq:Wm,gte:Vm,lte:zm,cmp:qm,coerce:Gm,Comparator:Jm,Range:Zm,satisfies:Km,toComparators:Qm,maxSatisfying:Ym,minSatisfying:Xm,minVersion:eb,validRange:tb,outside:rb,gtr:nb,ltr:ib,intersects:sb,simplifyRange:ob,subset:ab,SemVer:Rm,re:Js.re,src:Js.src,tokens:Js.t,SEMVER_SPEC_VERSION:Mc.SEMVER_SPEC_VERSION,RELEASE_TYPES:Mc.RELEASE_TYPES,compareIdentifiers:Nc.compareIdentifiers,rcompareIdentifiers:Nc.rcompareIdentifiers};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=cb,r=Yt,n=Be;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",h=>(0,t.valid)(h)===null?`Expected SemVer version, got "${h}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",h=>(0,t.validRange)(h)===null?`Expected SemVer range, got "${h}"`:!0);function i(h){return(0,r.is)(h,e.VersionStruct)}e.isValidSemVerVersion=i;function s(h){return(0,r.is)(h,e.VersionRangeStruct)}e.isValidSemVerRange=s;function a(h){(0,n.assertStruct)(h,e.VersionStruct)}e.assertIsSemVerVersion=a;function o(h){(0,n.assertStruct)(h,e.VersionRangeStruct)}e.assertIsSemVerRange=o;function l(h,g){return(0,t.gt)(h,g)}e.gtVersion=l;function u(h,g){return(0,t.gtr)(h,g)}e.gtRange=u;function f(h,g){return(0,t.satisfies)(h,g,{includePrerelease:!0})}e.satisfiesVersionRange=f})(Gu);(function(e){var t=Z&&Z.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Z&&Z.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Be,e),r(hn,e),r(he,e),r(Ei,e),r(mt,e),r(yr,e),r(ju,e),r(fn,e),r(Uu,e),r(Hu,e),r(wr,e),r(Wu,e),r(bt,e),r(Vu,e),r(zu,e),r(qu,e),r(Gu,e)})(Eu);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=Eu;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")})(wu);var td=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yi,"__esModule",{value:!0});yi.PollingBlockTracker=void 0;const lb=td(Bo),ub=td(Pp),db=cn,Lc=wu,Bc=(0,Lc.createModuleLogger)(Lc.projectLogger,"polling-block-tracker"),hb=(0,lb.default)(),fb=1e3;class pb extends db.BaseBlockTracker{constructor(t={}){var r;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(r=t.blockResetDuration)!==null&&r!==void 0?r:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*fb,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const r=Pc(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:
8
+ ${(t=r.stack)!==null&&t!==void 0?t:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Pc(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:hb(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),Bc("Making request",t);const r=await(0,ub.default)(n=>this._provider.sendAsync(t,n))();if(Bc("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block:
9
+ ${r.error.message}`);return r.result}}yi.PollingBlockTracker=pb;function Pc(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}var xi={},gb=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xi,"__esModule",{value:!0});xi.SubscribeBlockTracker=void 0;const _b=gb(Bo),mb=cn,bb=(0,_b.default)();class yb extends mb.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:bb(),method:t,params:r,jsonrpc:"2.0"},(s,a)=>{s?i(s):n(a.result)})})}_handleSubData(t,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)}}xi.SubscribeBlockTracker=yb;(function(e){var t=Z&&Z.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Z&&Z.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(yi,e),r(xi,e)})(yu);var Qo={},Ai={},gn={};Object.defineProperty(gn,"__esModule",{value:!0});gn.getUniqueId=void 0;const rd=4294967295;let Zs=Math.floor(Math.random()*rd);function wb(){return Zs=(Zs+1)%rd,Zs}gn.getUniqueId=wb;Object.defineProperty(Ai,"__esModule",{value:!0});Ai.createIdRemapMiddleware=void 0;const Eb=gn;function vb(){return(e,t,r,n)=>{const i=e.id,s=Eb.getUniqueId();e.id=s,t.id=s,r(a=>{e.id=i,t.id=i,a()})}}Ai.createIdRemapMiddleware=vb;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.createAsyncMiddleware=void 0;function Sb(e){return async(t,r,n,i)=>{let s;const a=new Promise(f=>{s=f});let o=null,l=!1;const u=async()=>{l=!0,n(f=>{o=f,s()}),await a};try{await e(t,r,u),l?(await a,o(null)):i(null)}catch(f){o?o(f):i(f)}}}Ti.createAsyncMiddleware=Sb;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.createScaffoldMiddleware=void 0;function Rb(e){return(t,r,n,i)=>{const s=e[t.method];return s===void 0?n():typeof s=="function"?s(t,r,n,i):(r.result=s,i())}}Mi.createScaffoldMiddleware=Rb;var _n={},Yo={};Object.defineProperty(Yo,"__esModule",{value:!0});const Cb=Un;function Oc(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function kb(e){const t=e.length,r=new Array(t);for(let n=0;n<t;n+=1)r[n]=e[n];return r}let Ib=class extends Cb.EventEmitter{emit(t,...r){let n=t==="error";const i=this._events;if(i!==void 0)n=n&&i.error===void 0;else if(!n)return!1;if(n){let a;if(r.length>0&&([a]=r),a instanceof Error)throw a;const o=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw o.context=a,o}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Oc(s,this,r);else{const a=s.length,o=kb(s);for(let l=0;l<a;l+=1)Oc(o[l],this,r)}return!0}};Yo.default=Ib;var nd={},Nt={},xb=Ur;Ur.default=Ur;Ur.stable=od;Ur.stableStringify=od;var Fn="[...]",id="[Circular]",qt=[],Wt=[];function sd(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Ur(e,t,r,n){typeof n>"u"&&(n=sd()),fo(e,"",0,[],void 0,0,n);var i;try{Wt.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,ad(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;qt.length!==0;){var s=qt.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function dr(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),qt.push([n,r,t,i])):Wt.push([t,r,e]):(n[r]=e,qt.push([n,r,t]))}function fo(e,t,r,n,i,s,a){s+=1;var o;if(typeof e=="object"&&e!==null){for(o=0;o<n.length;o++)if(n[o]===e){dr(id,e,t,i);return}if(typeof a.depthLimit<"u"&&s>a.depthLimit){dr(Fn,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){dr(Fn,e,t,i);return}if(n.push(e),Array.isArray(e))for(o=0;o<e.length;o++)fo(e[o],o,o,n,e,s,a);else{var l=Object.keys(e);for(o=0;o<l.length;o++){var u=l[o];fo(e[u],u,o,n,e,s,a)}}n.pop()}}function Ab(e,t){return e<t?-1:e>t?1:0}function od(e,t,r,n){typeof n>"u"&&(n=sd());var i=po(e,"",0,[],void 0,0,n)||e,s;try{Wt.length===0?s=JSON.stringify(i,t,r):s=JSON.stringify(i,ad(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;qt.length!==0;){var a=qt.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function po(e,t,r,n,i,s,a){s+=1;var o;if(typeof e=="object"&&e!==null){for(o=0;o<n.length;o++)if(n[o]===e){dr(id,e,t,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof a.depthLimit<"u"&&s>a.depthLimit){dr(Fn,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){dr(Fn,e,t,i);return}if(n.push(e),Array.isArray(e))for(o=0;o<e.length;o++)po(e[o],o,o,n,e,s,a);else{var l={},u=Object.keys(e).sort(Ab);for(o=0;o<u.length;o++){var f=u[o];po(e[f],f,o,n,e,s,a),l[f]=e[f]}if(typeof i<"u")qt.push([i,t,e]),i[t]=l;else return l}n.pop()}}function ad(e){return e=typeof e<"u"?e:function(t,r){return r},function(t,r){if(Wt.length>0)for(var n=0;n<Wt.length;n++){var i=Wt[n];if(i[1]===t&&i[0]===r){r=i[2],Wt.splice(n,1);break}}return e.call(this,t,r)}}Object.defineProperty(Nt,"__esModule",{value:!0});Nt.EthereumProviderError=Nt.EthereumRpcError=void 0;const Tb=xb;class cd extends Error{constructor(t,r,n){if(!Number.isInteger(t))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=t,n!==void 0&&(this.data=n)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return Tb.default(this.serialize(),Lb,2)}}Nt.EthereumRpcError=cd;class Mb extends cd{constructor(t,r,n){if(!Nb(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}}Nt.EthereumProviderError=Mb;function Nb(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function Lb(e,t){if(t!=="[Circular]")return t}var Xo={},Lt={};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.errorValues=Lt.errorCodes=void 0;Lt.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}};Lt.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Lt,r=Nt,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:a(n)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function a(g,_=i){if(Number.isInteger(g)){const E=g.toString();if(h(t.errorValues,E))return t.errorValues[E].message;if(u(g))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return _}e.getMessageFromCode=a;function o(g){if(!Number.isInteger(g))return!1;const _=g.toString();return!!(t.errorValues[_]||u(g))}e.isValidCode=o;function l(g,{fallbackError:_=s,shouldIncludeStack:E=!1}={}){var x,R;if(!_||!Number.isInteger(_.code)||typeof _.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(g instanceof r.EthereumRpcError)return g.serialize();const b={};if(g&&typeof g=="object"&&!Array.isArray(g)&&h(g,"code")&&o(g.code)){const S=g;b.code=S.code,S.message&&typeof S.message=="string"?(b.message=S.message,h(S,"data")&&(b.data=S.data)):(b.message=a(b.code),b.data={originalError:f(g)})}else{b.code=_.code;const S=(x=g)===null||x===void 0?void 0:x.message;b.message=S&&typeof S=="string"?S:_.message,b.data={originalError:f(g)}}const v=(R=g)===null||R===void 0?void 0:R.stack;return E&&g&&v&&typeof v=="string"&&(b.stack=v),b}e.serializeError=l;function u(g){return g>=-32099&&g<=-32e3}function f(g){return g&&typeof g=="object"&&!Array.isArray(g)?Object.assign({},g):g}function h(g,_){return Object.prototype.hasOwnProperty.call(g,_)}})(Xo);var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.ethErrors=void 0;const ea=Nt,ld=Xo,Oe=Lt;Ni.ethErrors={rpc:{parse:e=>Ge(Oe.errorCodes.rpc.parse,e),invalidRequest:e=>Ge(Oe.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Ge(Oe.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Ge(Oe.errorCodes.rpc.methodNotFound,e),internal:e=>Ge(Oe.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Ge(t,e)},invalidInput:e=>Ge(Oe.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Ge(Oe.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Ge(Oe.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Ge(Oe.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Ge(Oe.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Ge(Oe.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Nr(Oe.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>Nr(Oe.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>Nr(Oe.errorCodes.provider.unsupportedMethod,e),disconnected:e=>Nr(Oe.errorCodes.provider.disconnected,e),chainDisconnected:e=>Nr(Oe.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new ea.EthereumProviderError(t,r,n)}}};function Ge(e,t){const[r,n]=ud(t);return new ea.EthereumRpcError(e,r||ld.getMessageFromCode(e),n)}function Nr(e,t){const[r,n]=ud(t);return new ea.EthereumProviderError(e,r||ld.getMessageFromCode(e),n)}function ud(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Nt;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Xo;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ni;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Lt;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(nd);var Bb=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_n,"__esModule",{value:!0});_n.JsonRpcEngine=void 0;const Pb=Bb(Yo),Je=nd;class Et extends Pb.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,n,i)=>{try{const[s,a,o]=await Et._runAllMiddleware(t,r,this._middleware);return a?(await Et._runReturnHandlers(o),i(s)):n(async l=>{try{await Et._runReturnHandlers(o)}catch(u){return l(u)}return l()})}catch(s){return i(s)}}}async _handleBatch(t,r){try{const n=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(n,i)=>{r(i)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const a=new Je.EthereumRpcError(Je.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return r(a,{id:void 0,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new Je.EthereumRpcError(Je.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return r(a,{id:t.id,jsonrpc:"2.0",error:a})}const n=Object.assign({},t),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(a){s=a}return s&&(delete i.result,i.error||(i.error=Je.serializeError(s))),r(s,i)}async _processRequest(t,r){const[n,i,s]=await Et._runAllMiddleware(t,r,this._middleware);if(Et._checkForCompletion(t,r,i),await Et._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(t,r,n){const i=[];let s=null,a=!1;for(const o of n)if([s,a]=await Et._runMiddleware(t,r,o,i),a)break;return[s,a,i.reverse()]}static _runMiddleware(t,r,n,i){return new Promise(s=>{const a=l=>{const u=l||r.error;u&&(r.error=Je.serializeError(u)),s([u,!0])},o=l=>{r.error?a(r.error):(l&&(typeof l!="function"&&a(new Je.EthereumRpcError(Je.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof l}" for request:
10
+ ${Ks(t)}`,{request:t})),i.push(l)),s([null,!1]))};try{n(t,r,o,a)}catch(l){a(l)}})}static async _runReturnHandlers(t){for(const r of t)await new Promise((n,i)=>{r(s=>s?i(s):n())})}static _checkForCompletion(t,r,n){if(!("result"in r)&&!("error"in r))throw new Je.EthereumRpcError(Je.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:
11
+ ${Ks(t)}`,{request:t});if(!n)throw new Je.EthereumRpcError(Je.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:
12
+ ${Ks(t)}`,{request:t})}}_n.JsonRpcEngine=Et;function Ks(e){return JSON.stringify(e,null,2)}var Li={};Object.defineProperty(Li,"__esModule",{value:!0});Li.mergeMiddleware=void 0;const Ob=_n;function $b(e){const t=new Ob.JsonRpcEngine;return e.forEach(r=>t.push(r)),t.asMiddleware()}Li.mergeMiddleware=$b;(function(e){var t=Z&&Z.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Z&&Z.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ai,e),r(Ti,e),r(Mi,e),r(gn,e),r(_n,e),r(Li,e)})(Qo);var dd={},ta={};const ra=Hr(_d);var Bi={};Object.defineProperty(Bi,"__esModule",{value:!0});var $c=ra,Fb=function(){function e(t){if(this._maxConcurrency=t,this._queue=[],t<=0)throw new Error("semaphore must be initialized to a positive value");this._value=t}return e.prototype.acquire=function(){var t=this,r=this.isLocked(),n=new Promise(function(i){return t._queue.push(i)});return r||this._dispatch(),n},e.prototype.runExclusive=function(t){return $c.__awaiter(this,void 0,void 0,function(){var r,n,i;return $c.__generator(this,function(s){switch(s.label){case 0:return[4,this.acquire()];case 1:r=s.sent(),n=r[0],i=r[1],s.label=2;case 2:return s.trys.push([2,,4,5]),[4,t(n)];case 3:return[2,s.sent()];case 4:return i(),[7];case 5:return[2]}})})},e.prototype.isLocked=function(){return this._value<=0},e.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var t=this._currentReleaser;this._currentReleaser=void 0,t()}},e.prototype._dispatch=function(){var t=this,r=this._queue.shift();if(r){var n=!1;this._currentReleaser=function(){n||(n=!0,t._value++,t._dispatch())},r([this._value--,this._currentReleaser])}},e}();Bi.default=Fb;Object.defineProperty(ta,"__esModule",{value:!0});var Fc=ra,Db=Bi,jb=function(){function e(){this._semaphore=new Db.default(1)}return e.prototype.acquire=function(){return Fc.__awaiter(this,void 0,void 0,function(){var t,r;return Fc.__generator(this,function(n){switch(n.label){case 0:return[4,this._semaphore.acquire()];case 1:return t=n.sent(),r=t[1],[2,r]}})})},e.prototype.runExclusive=function(t){return this._semaphore.runExclusive(function(){return t()})},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();ta.default=jb;var Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.withTimeout=void 0;var Tn=ra;function Ub(e,t,r){var n=this;return r===void 0&&(r=new Error("timeout")),{acquire:function(){return new Promise(function(i,s){return Tn.__awaiter(n,void 0,void 0,function(){var a,o,l;return Tn.__generator(this,function(u){switch(u.label){case 0:return a=!1,setTimeout(function(){a=!0,s(r)},t),[4,e.acquire()];case 1:return o=u.sent(),a?(l=Array.isArray(o)?o[1]:o,l()):i(o),[2]}})})})},runExclusive:function(i){return Tn.__awaiter(this,void 0,void 0,function(){var s,a;return Tn.__generator(this,function(o){switch(o.label){case 0:s=function(){},o.label=1;case 1:return o.trys.push([1,,7,8]),[4,this.acquire()];case 2:return a=o.sent(),Array.isArray(a)?(s=a[1],[4,i(a[0])]):[3,4];case 3:return[2,o.sent()];case 4:return s=a,[4,i()];case 5:return[2,o.sent()];case 6:return[3,8];case 7:return s(),[7];case 8:return[2]}})})},release:function(){e.release()},isLocked:function(){return e.isLocked()}}}Pi.withTimeout=Ub;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=ta;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var r=Bi;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=Pi;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})})(dd);var Hb=Vb,Wb=Object.prototype.hasOwnProperty;function Vb(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)Wb.call(r,n)&&(e[n]=r[n])}return e}const zb=Hb,qb=Bo();var Gb=Y;function Y(e){const t=this;t.currentProvider=e}Y.prototype.getBalance=mn(2,"eth_getBalance");Y.prototype.getCode=mn(2,"eth_getCode");Y.prototype.getTransactionCount=mn(2,"eth_getTransactionCount");Y.prototype.getStorageAt=mn(3,"eth_getStorageAt");Y.prototype.call=mn(2,"eth_call");Y.prototype.protocolVersion=se("eth_protocolVersion");Y.prototype.syncing=se("eth_syncing");Y.prototype.coinbase=se("eth_coinbase");Y.prototype.mining=se("eth_mining");Y.prototype.hashrate=se("eth_hashrate");Y.prototype.gasPrice=se("eth_gasPrice");Y.prototype.accounts=se("eth_accounts");Y.prototype.blockNumber=se("eth_blockNumber");Y.prototype.getBlockTransactionCountByHash=se("eth_getBlockTransactionCountByHash");Y.prototype.getBlockTransactionCountByNumber=se("eth_getBlockTransactionCountByNumber");Y.prototype.getUncleCountByBlockHash=se("eth_getUncleCountByBlockHash");Y.prototype.getUncleCountByBlockNumber=se("eth_getUncleCountByBlockNumber");Y.prototype.sign=se("eth_sign");Y.prototype.sendTransaction=se("eth_sendTransaction");Y.prototype.sendRawTransaction=se("eth_sendRawTransaction");Y.prototype.estimateGas=se("eth_estimateGas");Y.prototype.getBlockByHash=se("eth_getBlockByHash");Y.prototype.getBlockByNumber=se("eth_getBlockByNumber");Y.prototype.getTransactionByHash=se("eth_getTransactionByHash");Y.prototype.getTransactionByBlockHashAndIndex=se("eth_getTransactionByBlockHashAndIndex");Y.prototype.getTransactionByBlockNumberAndIndex=se("eth_getTransactionByBlockNumberAndIndex");Y.prototype.getTransactionReceipt=se("eth_getTransactionReceipt");Y.prototype.getUncleByBlockHashAndIndex=se("eth_getUncleByBlockHashAndIndex");Y.prototype.getUncleByBlockNumberAndIndex=se("eth_getUncleByBlockNumberAndIndex");Y.prototype.getCompilers=se("eth_getCompilers");Y.prototype.compileLLL=se("eth_compileLLL");Y.prototype.compileSolidity=se("eth_compileSolidity");Y.prototype.compileSerpent=se("eth_compileSerpent");Y.prototype.newFilter=se("eth_newFilter");Y.prototype.newBlockFilter=se("eth_newBlockFilter");Y.prototype.newPendingTransactionFilter=se("eth_newPendingTransactionFilter");Y.prototype.uninstallFilter=se("eth_uninstallFilter");Y.prototype.getFilterChanges=se("eth_getFilterChanges");Y.prototype.getFilterLogs=se("eth_getFilterLogs");Y.prototype.getLogs=se("eth_getLogs");Y.prototype.getWork=se("eth_getWork");Y.prototype.submitWork=se("eth_submitWork");Y.prototype.submitHashrate=se("eth_submitHashrate");Y.prototype.sendAsync=function(e,t){this.currentProvider.sendAsync(Jb(e),function(n,i){if(!n&&i.error&&(n=new Error("EthQuery - RPC Error - "+i.error.message)),n)return t(n);t(null,i.result)})};function se(e){return function(){const t=this;var r=[].slice.call(arguments),n=r.pop();t.sendAsync({method:e,params:r},n)}}function mn(e,t){return function(){const r=this;var n=[].slice.call(arguments),i=n.pop();n.length<e&&n.push("latest"),r.sendAsync({method:t,params:n},i)}}function Jb(e){return zb({id:qb(),jsonrpc:"2.0",params:[]},e)}const Dc=(e,t,r,n)=>function(...i){const s=t.promiseModule;return new s((a,o)=>{t.multiArgs?i.push((...u)=>{t.errorFirst?u[0]?o(u):(u.shift(),a(u)):a(u)}):t.errorFirst?i.push((u,f)=>{u?o(u):a(f)}):i.push(a),Reflect.apply(e,this===r?n:this,i)})},jc=new WeakMap;var Zb=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(!(e!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${e===null?"null":r}\``);const n=(a,o)=>{let l=jc.get(a);if(l||(l={},jc.set(a,l)),o in l)return l[o];const u=E=>typeof E=="string"||typeof o=="symbol"?o===E:E.test(o),f=Reflect.getOwnPropertyDescriptor(a,o),h=f===void 0||f.writable||f.configurable,_=(t.include?t.include.some(u):!t.exclude.some(u))&&h;return l[o]=_,_},i=new WeakMap,s=new Proxy(e,{apply(a,o,l){const u=i.get(a);if(u)return Reflect.apply(u,o,l);const f=t.excludeMain?a:Dc(a,t,s,a);return i.set(a,f),Reflect.apply(f,o,l)},get(a,o){const l=a[o];if(!n(a,o)||l===Function.prototype[o])return l;const u=i.get(l);if(u)return u;if(typeof l=="function"){const f=Dc(l,t,s,a);return i.set(l,f),f}return l}});return s};const Kb=ln.default;let Qb=class extends Kb{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(t){this.updates=this.updates.concat(t),t.forEach(r=>this.emit("update",r))}addInitialResults(t){}getChangesAndClear(){const t=this.updates;return this.updates=[],t}};var na=Qb;const Yb=na;let Xb=class extends Yb{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(t){this.allResults=this.allResults.concat(t),super.addResults(t)}addInitialResults(t){this.allResults=this.allResults.concat(t),super.addInitialResults(t)}getAllResults(){return this.allResults}};var ey=Xb,bn={minBlockRef:ty,maxBlockRef:ry,sortBlockRefs:ia,bnToHex:ny,blockRefIsNumber:iy,hexToInt:Dn,incrementHexInt:sy,intToHex:hd,unsafeRandomBytes:oy};function ty(...e){return ia(e)[0]}function ry(...e){const t=ia(e);return t[t.length-1]}function ia(e){return e.sort((t,r)=>t==="latest"||r==="earliest"?1:r==="latest"||t==="earliest"?-1:Dn(t)-Dn(r))}function ny(e){return"0x"+e.toString(16)}function iy(e){return e&&!["earliest","latest","pending"].includes(e)}function Dn(e){return e==null?e:Number.parseInt(e,16)}function sy(e){if(e==null)return e;const t=Dn(e);return hd(t+1)}function hd(e){if(e==null)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function oy(e){let t="0x";for(let r=0;r<e;r++)t+=Uc(),t+=Uc();return t}function Uc(){return Math.floor(Math.random()*16).toString(16)}const ay=Gb,cy=Zb,ly=ey,{bnToHex:vw,hexToInt:Mn,incrementHexInt:uy,minBlockRef:dy,blockRefIsNumber:hy}=bn;let fy=class extends ly{constructor({provider:t,params:r}){super(),this.type="log",this.ethQuery=new ay(t),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:t}){let r=this.params.fromBlock;["latest","pending"].includes(r)&&(r=t),r==="earliest"&&(r="0x0"),this.params.fromBlock=r;const n=dy(this.params.toBlock,t),i=Object.assign({},this.params,{toBlock:n}),s=await this._fetchLogs(i);this.addInitialResults(s)}async update({oldBlock:t,newBlock:r}){const n=r;let i;t?i=uy(t):i=r;const s=Object.assign({},this.params,{fromBlock:i,toBlock:n}),o=(await this._fetchLogs(s)).filter(l=>this.matchLog(l));this.addResults(o)}async _fetchLogs(t){return await cy(n=>this.ethQuery.getLogs(t,n))()}matchLog(t){if(Mn(this.params.fromBlock)>=Mn(t.blockNumber)||hy(this.params.toBlock)&&Mn(this.params.toBlock)<=Mn(t.blockNumber))return!1;const r=t.address&&t.address.toLowerCase();return this.params.address&&r&&!this.params.address.includes(r)?!1:this.params.topics.every((i,s)=>{let a=t.topics[s];if(!a)return!1;a=a.toLowerCase();let o=Array.isArray(i)?i:[i];return o.includes(null)?!0:(o=o.map(f=>f.toLowerCase()),o.includes(a))})}};var py=fy,sa=gy;async function gy({provider:e,fromBlock:t,toBlock:r}){t||(t=r);const n=Hc(t),s=Hc(r)-n+1,a=Array(s).fill().map((l,u)=>n+u).map(_y);let o=await Promise.all(a.map(l=>by(e,"eth_getBlockByNumber",[l,!1])));return o=o.filter(l=>l!==null),o}function Hc(e){return e==null?e:Number.parseInt(e,16)}function _y(e){return e==null?e:"0x"+e.toString(16)}function my(e,t){return new Promise((r,n)=>{e.sendAsync(t,(i,s)=>{i?n(i):s.error?n(s.error):s.result?r(s.result):n(new Error("Result was empty"))})})}async function by(e,t,r){for(let n=0;n<3;n++)try{return await my(e,{id:1,jsonrpc:"2.0",method:t,params:r})}catch(i){console.error(`provider.sendAsync failed: ${i.stack||i.message||i}`)}return null}const yy=na,wy=sa,{incrementHexInt:Ey}=bn;let vy=class extends yy{constructor({provider:t,params:r}){super(),this.type="block",this.provider=t}async update({oldBlock:t,newBlock:r}){const n=r,i=Ey(t),a=(await wy({provider:this.provider,fromBlock:i,toBlock:n})).map(o=>o.hash);this.addResults(a)}};var Sy=vy;const Ry=na,Cy=sa,{incrementHexInt:ky}=bn;let Iy=class extends Ry{constructor({provider:t}){super(),this.type="tx",this.provider=t}async update({oldBlock:t}){const r=t,n=ky(t),i=await Cy({provider:this.provider,fromBlock:n,toBlock:r}),s=[];for(const a of i)s.push(...a.transactions);this.addResults(s)}};var xy=Iy;const Ay=dd.Mutex,{createAsyncMiddleware:Ty,createScaffoldMiddleware:My}=Qo,Ny=py,Ly=Sy,By=xy,{intToHex:fd,hexToInt:Qs}=bn;var Py=Oy;function Oy({blockTracker:e,provider:t}){let r=0,n={};const i=new Ay,s=$y({mutex:i}),a=My({eth_newFilter:s(Ys(l)),eth_newBlockFilter:s(Ys(u)),eth_newPendingTransactionFilter:s(Ys(f)),eth_uninstallFilter:s(Pn(_)),eth_getFilterChanges:s(Pn(h)),eth_getFilterLogs:s(Pn(g))}),o=async({oldBlock:v,newBlock:S})=>{if(n.length===0)return;const M=await i.acquire();try{await Promise.all(sr(n).map(async A=>{try{await A.update({oldBlock:v,newBlock:S})}catch(B){console.error(B)}}))}catch(A){console.error(A)}M()};return a.newLogFilter=l,a.newBlockFilter=u,a.newPendingTransactionFilter=f,a.uninstallFilter=_,a.getFilterChanges=h,a.getFilterLogs=g,a.destroy=()=>{R()},a;async function l(v){const S=new Ny({provider:t,params:v});return await E(S),S}async function u(){const v=new Ly({provider:t});return await E(v),v}async function f(){const v=new By({provider:t});return await E(v),v}async function h(v){const S=Qs(v),M=n[S];if(!M)throw new Error(`No filter for index "${S}"`);return M.getChangesAndClear()}async function g(v){const S=Qs(v),M=n[S];if(!M)throw new Error(`No filter for index "${S}"`);let A=[];return M.type==="log"&&(A=M.getAllResults()),A}async function _(v){const S=Qs(v),A=!!n[S];return A&&await x(S),A}async function E(v){const S=sr(n).length,M=await e.getLatestBlock();await v.initialize({currentBlock:M}),r++,n[r]=v,v.id=r,v.idHex=fd(r);const A=sr(n).length;return b({prevFilterCount:S,newFilterCount:A}),r}async function x(v){const S=sr(n).length;delete n[v];const M=sr(n).length;b({prevFilterCount:S,newFilterCount:M})}async function R(){const v=sr(n).length;n={},b({prevFilterCount:v,newFilterCount:0})}function b({prevFilterCount:v,newFilterCount:S}){if(v===0&&S>0){e.on("sync",o);return}if(v>0&&S===0){e.removeListener("sync",o);return}}}function Ys(e){return Pn(async(...t)=>{const r=await e(...t);return fd(r.id)})}function Pn(e){return Ty(async(t,r)=>{const n=await e.apply(null,t.params);r.result=n})}function $y({mutex:e}){return t=>async(r,n,i,s)=>{(await e.acquire())(),t(r,n,i,s)}}function sr(e,t){const r=[];for(let n in e)r.push(e[n]);return r}const Fy=ln.default,{createAsyncMiddleware:Wc,createScaffoldMiddleware:Dy}=Qo,jy=Py,{unsafeRandomBytes:Uy,incrementHexInt:Hy}=bn,Wy=sa;var Vy=zy;function zy({blockTracker:e,provider:t}){const r={},n=jy({blockTracker:e,provider:t});let i=!1;const s=new Fy,a=Dy({eth_subscribe:Wc(o),eth_unsubscribe:Wc(l)});return a.destroy=f,{events:s,middleware:a};async function o(h,g){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const _=h.params[0],E=Uy(16);let x;switch(_){case"newHeads":x=R({subId:E});break;case"logs":const v=h.params[1],S=await n.newLogFilter(v);x=b({subId:E,filter:S});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${_}"`)}r[E]=x,g.result=E;return;function R({subId:v}){const S={type:_,destroy:async()=>{e.removeListener("sync",S.update)},update:async({oldBlock:M,newBlock:A})=>{const B=A,K=Hy(M);(await Wy({provider:t,fromBlock:K,toBlock:B})).map(qy).filter(ie=>ie!==null).forEach(ie=>{u(v,ie)})}};return e.on("sync",S.update),S}function b({subId:v,filter:S}){return S.on("update",A=>u(v,A)),{type:_,destroy:async()=>await n.uninstallFilter(S.idHex)}}}async function l(h,g){if(i)throw new Error("SubscriptionManager - attempting to use after destroying");const _=h.params[0],E=r[_];if(!E){g.result=!1;return}delete r[_],await E.destroy(),g.result=!0}function u(h,g){s.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:h,result:g}})}function f(){s.removeAllListeners();for(const h in r)r[h].destroy(),delete r[h];i=!0}}function qy(e){return e==null?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty(bi,"__esModule",{value:!0});bi.SubscriptionManager=void 0;const Gy=yu,Jy=Vy,Vc=()=>{};class Zy{constructor(t){const r=new Gy.PollingBlockTracker({provider:t,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:n,middleware:i}=Jy({blockTracker:r,provider:t});this.events=n,this.subscriptionMiddleware=i}async handleRequest(t){const r={};return await this.subscriptionMiddleware(t,r,Vc,Vc),r}destroy(){this.subscriptionMiddleware.destroy()}}bi.SubscriptionManager=Zy;var pd=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(hr,"__esModule",{value:!0});hr.CoinbaseWalletProvider=void 0;const Ky=pd(jn),Qy=Jd,ue=Wr,ne=W,Yy=Gr,zc=Ke,Nn=Rr,We=Er,Xs=pd(Tp),Lr=Sr,Xy=br,ew=bi,qc="DefaultChainId",Gc="DefaultJsonRpcUrl";class tw extends Qy.EventEmitter{constructor(t){var r,n;super(),this._filterPolyfill=new Xy.FilterPolyfill(this),this._subscriptionManager=new ew.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=t.chainId,this._jsonRpcUrlFromOpts=t.jsonRpcUrl,this._overrideIsMetaMask=t.overrideIsMetaMask,this._relayProvider=t.relayProvider,this._storage=t.storage,this._relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=(r=t.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this.isCoinbaseBrowser=(n=t.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this.qrUrl=t.qrUrl;const i=this.getChainId(),s=(0,ne.prepend0x)(i.toString(16));this.emit("connect",{chainIdStr:s});const a=this._storage.getItem(zc.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const o=a.split(" ");o[0]!==""&&(this._addresses=o.map(l=>(0,ne.ensureAddressString)(l)),this.emit("accountsChanged",o))}this._subscriptionManager.events.on("notification",o=>{this.emit("message",{type:o.method,data:o.params})}),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",o=>{var l;if(!(o.origin!==location.origin||o.source!==window)&&o.data.type==="walletLinkMessage"&&o.data.data.action==="dappChainSwitched"){const u=o.data.data.chainId,f=(l=o.data.data.jsonRpcUrl)!==null&&l!==void 0?l:this.jsonRpcUrl;this.updateProviderInfo(f,Number(u))}})}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,ne.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 t;return(t=this._storage.getItem(Gc))!==null&&t!==void 0?t:this._jsonRpcUrlFromOpts}set jsonRpcUrl(t){this._storage.setItem(Gc,t)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(t,r){this.isCoinbaseBrowser||(this._chainIdFromOpts=r,this._jsonRpcUrlFromOpts=t),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(t,r){this.jsonRpcUrl=t;const n=this.getChainId();this._storage.setItem(qc,r.toString(10)),((0,ne.ensureIntNumber)(r)!==n||!this.hasMadeFirstChainChangedEmission)&&(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(t,r,n,i,s,a){const l=await(await this.initializeRelay()).watchAsset(t,r,n,i,s,a==null?void 0:a.toString()).promise;return(0,We.isErrorResponse)(l)?!1:!!l.result}async addEthereumChain(t,r,n,i,s,a){var o,l;if((0,ne.ensureIntNumber)(t)===this.getChainId())return!1;const u=await this.initializeRelay(),f=u.inlineAddEthereumChain(t.toString());!this._isAuthorized()&&!f&&await u.requestEthereumAccounts().promise;const h=await u.addEthereumChain(t.toString(),r,s,n,i,a).promise;return(0,We.isErrorResponse)(h)?!1:(((o=h.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(r[0],t),((l=h.result)===null||l===void 0?void 0:l.isApproved)===!0)}async switchEthereumChain(t){const n=await(await this.initializeRelay()).switchEthereumChain(t.toString(10),this.selectedAddress||void 0).promise;if((0,We.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===ue.standardErrorCodes.provider.unsupportedChain?ue.standardErrors.provider.unsupportedChain():ue.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const i=n.result;i.isApproved&&i.rpcUrl.length>0&&this.updateProviderInfo(i.rpcUrl,t)}setAppInfo(t,r){this.initializeRelay().then(n=>n.setAppInfo(t,r))}async enable(){var t;return(t=this.diagnostic)===null||t===void 0||t.log(Lr.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?Nn.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(t,r){try{const n=this._send(t,r);if(n instanceof Promise)return n.catch(i=>{throw(0,ue.serializeError)(i,t)})}catch(n){throw(0,ue.serializeError)(n,t)}}_send(t,r){if(typeof t=="string"){const i=t,s=Array.isArray(r)?r:r!==void 0?[r]:[],a={jsonrpc:"2.0",id:0,method:i,params:s};return this._sendRequestAsync(a).then(o=>o.result)}if(typeof r=="function"){const i=t,s=r;return this._sendAsync(i,s)}if(Array.isArray(t))return t.map(s=>this._sendRequest(s));const n=t;return this._sendRequest(n)}async sendAsync(t,r){try{return this._sendAsync(t,r).catch(n=>{throw(0,ue.serializeError)(n,t)})}catch(n){return Promise.reject((0,ue.serializeError)(n,t))}}async _sendAsync(t,r){if(typeof r!="function")throw new Error("callback is required");if(Array.isArray(t)){const i=r;this._sendMultipleRequestsAsync(t).then(s=>i(null,s)).catch(s=>i(s,null));return}const n=r;return this._sendRequestAsync(t).then(i=>n(null,i)).catch(i=>n(i,null))}async request(t){try{return this._request(t).catch(r=>{throw(0,ue.serializeError)(r,t.method)})}catch(r){return Promise.reject((0,ue.serializeError)(r,t.method))}}async _request(t){if(!t||typeof t!="object"||Array.isArray(t))throw ue.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:t});const{method:r,params:n}=t;if(typeof r!="string"||r.length===0)throw ue.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:t});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw ue.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:t});const i=n===void 0?[]:n,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:r,params:i,jsonrpc:"2.0",id:s})).result}async scanQRCode(t){const n=await(await this.initializeRelay()).scanQRCode((0,ne.ensureRegExpString)(t)).promise;if((0,We.isErrorResponse)(n))throw(0,ue.serializeError)(n.errorMessage,"scanQRCode");if(typeof n.result!="string")throw(0,ue.serializeError)("result was not a string","scanQRCode");return n.result}async genericRequest(t,r){const i=await(await this.initializeRelay()).genericRequest(t,r).promise;if((0,We.isErrorResponse)(i))throw(0,ue.serializeError)(i.errorMessage,"generic");if(typeof i.result!="string")throw(0,ue.serializeError)("result was not a string","generic");return i.result}async connectAndSignIn(t){var r;(r=this.diagnostic)===null||r===void 0||r.log(Lr.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?Nn.Session.hash(this._relay.session.id):void 0});let n;try{const s=await this.initializeRelay();if(!(s instanceof Yy.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(n=await s.connectAndSignIn(t).promise,(0,We.isErrorResponse)(n))throw new Error(n.errorMessage)}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?ue.standardErrors.provider.userRejectedRequest("User denied account authorization"):s}if(!n.result)throw new Error("accounts received is empty");const{accounts:i}=n.result;return this._setAddresses(i),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),n.result}async selectProvider(t){const n=await(await this.initializeRelay()).selectProvider(t).promise;if((0,We.isErrorResponse)(n))throw(0,ue.serializeError)(n.errorMessage,"selectProvider");if(typeof n.result!="string")throw(0,ue.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(t){const r={jsonrpc:"2.0",id:t.id},{method:n}=t;if(r.result=this._handleSynchronousMethods(t),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(t,r){if(!Array.isArray(t))throw new Error("addresses is not an array");const n=t.map(i=>(0,ne.ensureAddressString)(i));JSON.stringify(n)!==JSON.stringify(this._addresses)&&(this._addresses=n,this.emit("accountsChanged",this._addresses),this._storage.setItem(zc.LOCAL_STORAGE_ADDRESSES_KEY,n.join(" ")))}_sendRequestAsync(t){return new Promise((r,n)=>{try{const i=this._handleSynchronousMethods(t);if(i!==void 0)return r({jsonrpc:"2.0",id:t.id,result:i});const s=this._handleAsynchronousFilterMethods(t);if(s!==void 0){s.then(o=>r(Object.assign(Object.assign({},o),{id:t.id}))).catch(o=>n(o));return}const a=this._handleSubscriptionMethods(t);if(a!==void 0){a.then(o=>r({jsonrpc:"2.0",id:t.id,result:o.result})).catch(o=>n(o));return}}catch(i){return n(i)}this._handleAsynchronousMethods(t).then(i=>i&&r(Object.assign(Object.assign({},i),{id:t.id}))).catch(i=>n(i))})}_sendMultipleRequestsAsync(t){return Promise.all(t.map(r=>this._sendRequestAsync(r)))}_handleSynchronousMethods(t){const{method:r}=t,n=t.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(t){const{method:r}=t,n=t.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(t,this.jsonRpcUrl).catch(s=>{var a;throw(s.code===ue.standardErrorCodes.rpc.methodNotFound||s.code===ue.standardErrorCodes.rpc.methodNotSupported)&&((a=this.diagnostic)===null||a===void 0||a.log(Lr.EVENTS.METHOD_NOT_IMPLEMENTED,{method:t.method,sessionIdHash:this._relay?Nn.Session.hash(this._relay.session.id):void 0})),s})}_handleAsynchronousFilterMethods(t){const{method:r}=t,n=t.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(t){switch(t.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(t)}}_isKnownAddress(t){try{const r=(0,ne.ensureAddressString)(t);return this._addresses.map(i=>(0,ne.ensureAddressString)(i)).includes(r)}catch{}return!1}_ensureKnownAddress(t){var r;if(!this._isKnownAddress(t))throw(r=this.diagnostic)===null||r===void 0||r.log(Lr.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(t){const r=t.from?(0,ne.ensureAddressString)(t.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=t.to?(0,ne.ensureAddressString)(t.to):null,i=t.value!=null?(0,ne.ensureBN)(t.value):new Ky.default(0),s=t.data?(0,ne.ensureBuffer)(t.data):Buffer.alloc(0),a=t.nonce!=null?(0,ne.ensureIntNumber)(t.nonce):null,o=t.gasPrice!=null?(0,ne.ensureBN)(t.gasPrice):null,l=t.maxFeePerGas!=null?(0,ne.ensureBN)(t.maxFeePerGas):null,u=t.maxPriorityFeePerGas!=null?(0,ne.ensureBN)(t.maxPriorityFeePerGas):null,f=t.gas!=null?(0,ne.ensureBN)(t.gas):null,h=t.chainId?(0,ne.ensureIntNumber)(t.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:i,data:s,nonce:a,gasPriceInWei:o,maxFeePerGas:l,maxPriorityFeePerGas:u,gasLimit:f,chainId:h}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw ue.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw ue.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(t,r,n,i){this._ensureKnownAddress(r);try{const a=await(await this.initializeRelay()).signEthereumMessage(t,r,n,i).promise;if((0,We.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(s){throw typeof s.message=="string"&&s.message.match(/(denied|rejected)/i)?ue.standardErrors.provider.userRejectedRequest("User denied message signature"):s}}async _ethereumAddressFromSignedMessage(t,r,n){const s=await(await this.initializeRelay()).ethereumAddressFromSignedMessage(t,r,n).promise;if((0,We.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,ne.hexStringFromIntNumber)(this.getChainId())}getChainId(){const t=this._storage.getItem(qc);if(!t)return(0,ne.ensureIntNumber)(this._chainIdFromOpts);const r=parseInt(t,10);return(0,ne.ensureIntNumber)(r)}async _eth_requestAccounts(){var t;if((t=this.diagnostic)===null||t===void 0||t.log(Lr.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?Nn.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,We.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?ue.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(t){this._requireAuthorization();const r=(0,ne.ensureAddressString)(t[0]),n=(0,ne.ensureBuffer)(t[1]);return this._signEthereumMessage(n,r,!1)}_eth_ecRecover(t){const r=(0,ne.ensureBuffer)(t[0]),n=(0,ne.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(r,n,!1)}_personal_sign(t){this._requireAuthorization();const r=(0,ne.ensureBuffer)(t[0]),n=(0,ne.ensureAddressString)(t[1]);return this._signEthereumMessage(r,n,!0)}_personal_ecRecover(t){const r=(0,ne.ensureBuffer)(t[0]),n=(0,ne.ensureBuffer)(t[1]);return this._ethereumAddressFromSignedMessage(r,n,!0)}async _eth_signTransaction(t){this._requireAuthorization();const r=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signEthereumTransaction(r).promise;if((0,We.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?ue.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_sendRawTransaction(t){const r=(0,ne.ensureBuffer)(t[0]),i=await(await this.initializeRelay()).submitEthereumTransaction(r,this.getChainId()).promise;if((0,We.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}async _eth_sendTransaction(t){this._requireAuthorization();const r=this._prepareTransactionParams(t[0]||{});try{const i=await(await this.initializeRelay()).signAndSubmitEthereumTransaction(r).promise;if((0,We.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?ue.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(t){this._requireAuthorization();const r=(0,ne.ensureParsedJSONObject)(t[0]),n=(0,ne.ensureAddressString)(t[1]);this._ensureKnownAddress(n);const i=Xs.default.hashForSignTypedDataLegacy({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(i,n,!1,s)}async _eth_signTypedData_v3(t){this._requireAuthorization();const r=(0,ne.ensureAddressString)(t[0]),n=(0,ne.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(r);const i=Xs.default.hashForSignTypedData_v3({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(i,r,!1,s)}async _eth_signTypedData_v4(t){this._requireAuthorization();const r=(0,ne.ensureAddressString)(t[0]),n=(0,ne.ensureParsedJSONObject)(t[1]);this._ensureKnownAddress(r);const i=Xs.default.hashForSignTypedData_v4({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(i,r,!1,s)}async _cbwallet_arbitrary(t){const r=t[0],n=t[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(t){var r,n,i,s;const a=t[0];if(((r=a.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(!a.chainName||a.chainName.trim()==="")throw ue.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw ue.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(a.chainId,16);return await this.addEthereumChain(o,(n=a.rpcUrls)!==null&&n!==void 0?n:[],(i=a.blockExplorerUrls)!==null&&i!==void 0?i:[],a.chainName,(s=a.iconUrls)!==null&&s!==void 0?s:[],a.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(t){const r=t[0];return await this.switchEthereumChain(parseInt(r.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(t){const r=Array.isArray(t)?t[0]:t;if(!r.type)throw ue.standardErrors.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw ue.standardErrors.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw ue.standardErrors.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw ue.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:s,image:a,decimals:o}=r.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(r.type,i,s,o,a,n)}}_eth_uninstallFilter(t){const r=(0,ne.ensureHexString)(t[0]);return this._filterPolyfill.uninstallFilter(r)}async _eth_newFilter(t){const r=t[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(t){const r=(0,ne.ensureHexString)(t[0]);return this._filterPolyfill.getFilterChanges(r)}_eth_getFilterLogs(t){const r=(0,ne.ensureHexString)(t[0]);return this._filterPolyfill.getFilterLogs(r)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then(t=>(t.setAccountsCallback((r,n)=>this._setAddresses(r,n)),t.setChainCallback((r,n)=>{this.updateProviderInfo(n,parseInt(r,10))}),t.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=t,t))}}hr.CoinbaseWalletProvider=tw;var Oi={};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.RelayEventManager=void 0;const rw=W;class nw{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const t=this._nextRequestId,r=(0,rw.prepend0x)(t.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),t}}Oi.RelayEventManager=nw;Object.defineProperty($r,"__esModule",{value:!0});$r.CoinbaseWalletSDK=void 0;const iw=Hn,sw=Wn,Jc=W,ow=Jn,aw=hr,cw=Gr,lw=an,uw=Oi,dw=en,hw=Jr,gd=vr;class $i{constructor(t){var r,n,i;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const s=t.linkAPIUrl||sw.LINK_API_URL;typeof t.overrideIsMetaMask>"u"?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=t.overrideIsMetaMask,this._overrideIsCoinbaseWallet=(r=t.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this._overrideIsCoinbaseBrowser=(n=t.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this._diagnosticLogger=t.diagnosticLogger,this._reloadOnDisconnect=(i=t.reloadOnDisconnect)!==null&&i!==void 0?i:!0;const a=new URL(s),o=`${a.protocol}//${a.host}`;if(this._storage=new ow.ScopedLocalStorage(`-walletlink:${o}`),this._storage.setItem("version",$i.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new uw.RelayEventManager;const l=(0,Jc.isMobileWeb)(),u=t.uiConstructor||(h=>l?new lw.MobileRelayUI(h):new dw.WalletLinkRelayUI(h)),f={linkAPIUrl:s,version:gd.LIB_VERSION,darkMode:!!t.darkMode,headlessMode:!!t.headlessMode,uiConstructor:u,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:t.enableMobileWalletLink};this._relay=l?new cw.MobileRelay(f):new hw.WalletLinkRelay(f),this.setAppInfo(t.appName,t.appLogoUrl),!t.headlessMode&&this._relay.attachUI()}makeWeb3Provider(t="",r=1){const n=this.walletExtension;if(n)return this.isCipherProvider(n)||n.setProviderInfo(t,r),this._reloadOnDisconnect===!1&&typeof n.disableReloadOnDisconnect=="function"&&n.disableReloadOnDisconnect(),n;const i=this.coinbaseBrowser;if(i)return i;const s=this._relay;if(!s||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return t||s.setConnectDisabled(!0),new aw.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(s),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:t,chainId:r,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(t,r){var n;this._appName=t||"DApp",this._appLogoUrl=r||(0,Jc.getFavicon)();const i=this.walletExtension;i?this.isCipherProvider(i)||i.setAppInfo(this._appName,this._appLogoUrl):(n=this._relay)===null||n===void 0||n.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var t;const r=this===null||this===void 0?void 0:this.walletExtension;r?r.close():(t=this._relay)===null||t===void 0||t.resetAndReload()}getQrUrl(){var t,r;return(r=(t=this._relay)===null||t===void 0?void 0:t.getQRCodeUrl())!==null&&r!==void 0?r:null}getCoinbaseWalletLogo(t,r=240){return(0,iw.walletLogo)(t,r)}get walletExtension(){var t;return(t=window.coinbaseWalletExtension)!==null&&t!==void 0?t:window.walletLinkExtension}get coinbaseBrowser(){var t,r;try{const n=(t=window.ethereum)!==null&&t!==void 0?t:(r=window.top)===null||r===void 0?void 0:r.ethereum;return n&&"isCoinbaseBrowser"in n&&n.isCoinbaseBrowser?n:void 0}catch{return}}isCipherProvider(t){return typeof t.isCipher=="boolean"&&t.isCipher}}$r.CoinbaseWalletSDK=$i;$i.VERSION=gd.LIB_VERSION;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletProvider=e.CoinbaseWalletSDK=void 0;const t=$r,r=hr;var n=$r;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var i=hr;Object.defineProperty(e,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return i.CoinbaseWalletProvider}}),e.default=t.CoinbaseWalletSDK,typeof window<"u"&&(window.CoinbaseWalletSDK=t.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=t.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)})(go);const fw=md(go),kw=bd({__proto__:null,default:fw},[go]);export{kw as i};