From 533faf67241df173a65c4ba69ef4b53ec31b07c1 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Tue, 23 Jul 2024 14:00:06 +0300 Subject: [PATCH 1/2] register: remove vet-keyfile --- ...owser-external_commonjs-proxy-B7j9NnZI.js} | 2 +- .../{ccip-CqyhqZTu.js => ccip-DV9665T2.js} | 2 +- ...{clsx.m-BnvdjbFk.js => clsx.m-DBHroLNK.js} | 2 +- .../{index-gj1MhC63.js => index-BQNtOdwk.js} | 2 +- .../{index-DRmNTW-M.js => index-BiTIzhEC.js} | 2 +- .../{index-C3h8FZ1j.js => index-Dm7MnfGv.js} | 8 ++--- .../{index-D5GudqB0.js => index-LMHFV9Bq.js} | 2 +- .../{index-CxVP-eNA.js => index-vWY8jeiL.js} | 4 +-- ...ex.es-DLVXSpXp.js => index.es-2cj2DIKP.js} | 6 ++-- kinode/src/register-ui/build/index.html | 2 +- .../register-ui/src/pages/ImportKeyfile.tsx | 14 -------- kinode/src/register.rs | 36 ++----------------- lib/src/core.rs | 13 ------- 13 files changed, 18 insertions(+), 77 deletions(-) rename kinode/src/register-ui/build/assets/{___vite-browser-external_commonjs-proxy-CQs3Tny8.js => ___vite-browser-external_commonjs-proxy-B7j9NnZI.js} (98%) rename kinode/src/register-ui/build/assets/{ccip-CqyhqZTu.js => ccip-DV9665T2.js} (97%) rename kinode/src/register-ui/build/assets/{clsx.m-BnvdjbFk.js => clsx.m-DBHroLNK.js} (99%) rename kinode/src/register-ui/build/assets/{index-gj1MhC63.js => index-BQNtOdwk.js} (99%) rename kinode/src/register-ui/build/assets/{index-DRmNTW-M.js => index-BiTIzhEC.js} (99%) rename kinode/src/register-ui/build/assets/{index-C3h8FZ1j.js => index-Dm7MnfGv.js} (99%) rename kinode/src/register-ui/build/assets/{index-D5GudqB0.js => index-LMHFV9Bq.js} (99%) rename kinode/src/register-ui/build/assets/{index-CxVP-eNA.js => index-vWY8jeiL.js} (97%) rename kinode/src/register-ui/build/assets/{index.es-DLVXSpXp.js => index.es-2cj2DIKP.js} (99%) diff --git a/kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-CQs3Tny8.js b/kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-B7j9NnZI.js similarity index 98% rename from kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-CQs3Tny8.js rename to kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-B7j9NnZI.js index 42bd8f347..ac8f09773 100644 --- a/kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-CQs3Tny8.js +++ b/kinode/src/register-ui/build/assets/___vite-browser-external_commonjs-proxy-B7j9NnZI.js @@ -1 +1 @@ -import{f as e,h as t}from"./index-C3h8FZ1j.js";var n,r={exports:{}},i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}r.exports=u,r.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,n)}(e,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var f=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function v(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function a(e,t,n,r){var i,o,s,u;if(c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=v(e))>0&&s.length>i&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=p.bind(r);return i.listener=n,r.wrapFn=i,i}function h(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var f=i[e];if(void 0===f)return!1;if("function"==typeof f)o(f,this,t);else{var c=f.length,v=d(f,c);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return h(this,e,!0)},u.prototype.rawListeners=function(e){return h(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};var g=r.exports;const L=e(g),_=t(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));export{L as W,g as e,_ as r}; +import{f as e,h as t}from"./index-Dm7MnfGv.js";var n,r={exports:{}},i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}r.exports=u,r.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&m(e,"error",t,n)}(e,i,{once:!0})}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var f=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function v(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function a(e,t,n,r){var i,o,s,u;if(c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"==typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=v(e))>0&&s.length>i&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return e}function p(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=p.bind(r);return i.listener=n,r.wrapFn=i,i}function h(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var f=i[e];if(void 0===f)return!1;if("function"==typeof f)o(f,this,t);else{var c=f.length,v=d(f,c);for(n=0;n=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return h(this,e,!0)},u.prototype.rawListeners=function(e){return h(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]};var g=r.exports;const L=e(g),_=t(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));export{L as W,g as e,_ as r}; diff --git a/kinode/src/register-ui/build/assets/ccip-CqyhqZTu.js b/kinode/src/register-ui/build/assets/ccip-DV9665T2.js similarity index 97% rename from kinode/src/register-ui/build/assets/ccip-CqyhqZTu.js rename to kinode/src/register-ui/build/assets/ccip-DV9665T2.js index 5e750b324..d7542fbfb 100644 --- a/kinode/src/register-ui/build/assets/ccip-CqyhqZTu.js +++ b/kinode/src/register-ui/build/assets/ccip-DV9665T2.js @@ -1 +1 @@ -import{B as e,g as a,s as t,d as s,i as r,c as n,a as o,e as c,H as l,b as d}from"./index-C3h8FZ1j.js";class u extends e{constructor({callbackSelector:e,cause:t,data:s,extraData:r,sender:n,urls:o}){var c;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(null==(c=t.metaMessages)?void 0:c.length)?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${a(e)}`))],` Sender: ${n}`,` Data: ${s}`,` Callback selector: ${e}`,` Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class i extends e{constructor({result:e,url:s}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${a(s)}`,`Response: ${t(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class f extends e{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}const p="0x556f1830",b={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function h(e,{blockNumber:a,blockTag:t,data:l,to:d}){const{args:i}=s({data:l,abi:[b]}),[p,h,y,w,g]=i,{ccipRead:k}=e,x=k&&"function"==typeof(null==k?void 0:k.request)?k.request:m;try{if(!r(d,p))throw new f({sender:p,to:d});const s=await x({data:y,sender:p,urls:h}),{data:l}=await n(e,{blockNumber:a,blockTag:t,data:o([w,c([{type:"bytes"},{type:"bytes"}],[s,g])]),to:d});return l}catch(O){throw new u({callbackSelector:w,cause:O,data:l,extraData:g,sender:p,urls:h})}}async function m({data:e,sender:a,urls:s}){var r;let n=new Error("An unknown error occurred.");for(let c=0;c` ${a(e)}`))],` Sender: ${n}`,` Data: ${s}`,` Callback selector: ${e}`,` Extra data: ${r}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class i extends e{constructor({result:e,url:s}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${a(s)}`,`Response: ${t(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class f extends e{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}const p="0x556f1830",b={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function h(e,{blockNumber:a,blockTag:t,data:l,to:d}){const{args:i}=s({data:l,abi:[b]}),[p,h,y,w,g]=i,{ccipRead:k}=e,x=k&&"function"==typeof(null==k?void 0:k.request)?k.request:m;try{if(!r(d,p))throw new f({sender:p,to:d});const s=await x({data:y,sender:p,urls:h}),{data:l}=await n(e,{blockNumber:a,blockTag:t,data:o([w,c([{type:"bytes"},{type:"bytes"}],[s,g])]),to:d});return l}catch(O){throw new u({callbackSelector:w,cause:O,data:l,extraData:g,sender:p,urls:h})}}async function m({data:e,sender:a,urls:s}){var r;let n=new Error("An unknown error occurred.");for(let c=0;c0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return l.alloc(0);for(var e,r,i,n=l.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,l.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0===(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=l.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0===(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:f,value:function(t,e){return u(this,r(r({},e),{},{depth:0,customInspect:!1}))}}]),t}()}function u(t,e){c(t,e),f(t)}function f(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function c(t,e){t.emit("error",e)}var d={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(c,this,t)):process.nextTick(c,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?process.nextTick(f,r):(r._writableState.errorEmitted=!0,process.nextTick(u,r,t)):process.nextTick(u,r,t):e?(process.nextTick(f,r),e(t)):process.nextTick(f,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}},p={};var _={};function b(t,e,r){r||(r=Error);var i=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);i.prototype.name=r.name,i.prototype.code=t,_[t]=i}function g(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}b("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),b("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,a;if("string"==typeof e&&(n="not ",e.substr(0,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(g(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(g(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),b("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),b("ERR_STREAM_PREMATURE_CLOSE","Premature close"),b("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),b("ERR_STREAM_WRITE_AFTER_END","write after end"),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),p.codes=_;var y=p.codes.ERR_INVALID_OPT_VALUE;var w={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new y(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},v={exports:{}};"function"==typeof Object.create?v.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:v.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var m,S,E,R,k=v.exports,T=function(t,e){if(M("noDeprecation"))return t;var r=!1;return function(){if(!r){if(M("throwDeprecation"))throw new Error(e);M("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}};function M(t){try{if(!e.localStorage)return!1}catch(i){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}function B(){if(S)return m;function r(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}var i;S=1,m=j,j.WritableState=O;var n={deprecate:T},a=h,s=t.Buffer,o=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,u=d,f=w.getHighWaterMark,c=p.codes,_=c.ERR_INVALID_ARG_TYPE,b=c.ERR_METHOD_NOT_IMPLEMENTED,g=c.ERR_MULTIPLE_CALLBACK,y=c.ERR_STREAM_CANNOT_PIPE,v=c.ERR_STREAM_DESTROYED,E=c.ERR_STREAM_NULL_VALUES,R=c.ERR_STREAM_WRITE_AFTER_END,M=c.ERR_UNKNOWN_ENCODING,B=u.errorOrDestroy;function L(){}function O(t,e,n){i=i||x(),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(D,t,e),t._writableState.errorEmitted=!0,B(t,i)):(n(i),t._writableState.errorEmitted=!0,B(t,i),D(t,e))}(t,r,i,e,n);else{var a=C(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?process.nextTick(N,t,r,a,n):N(t,r,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function j(t){var e=this instanceof(i=i||x());if(!e&&!l.call(j,this))return new j(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function A(t,e,r,i,n,a,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):r?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function N(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),D(t,e)}function I(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var n=e.bufferedRequestCount,a=new Array(n),s=e.corkedRequestsFree;s.entry=i;for(var o=0,h=!0;i;)a[o]=i,i.isBuf||(h=!1),i=i.next,o+=1;a.allBuffers=h,A(t,e,!0,e.length,a,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new r(e),e.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,u=i.encoding,f=i.callback;if(A(t,e,!1,e.objectMode?1:l.length,l,u,f),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(r){e.pendingcb--,r&&B(t,r),e.prefinished=!0,t.emit("prefinish"),D(t,e)}))}function D(t,e){var r=C(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return k(j,a),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===j&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},j.prototype.pipe=function(){B(this,new y)},j.prototype.write=function(t,e,r){var i,n=this._writableState,a=!1,h=!n.objectMode&&(i=t,s.isBuffer(i)||i instanceof o);return h&&!s.isBuffer(t)&&(t=function(t){return s.from(t)}(t)),"function"==typeof e&&(r=e,e=null),h?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=L),n.ending?function(t,e){var r=new R;B(t,r),process.nextTick(e,r)}(this,r):(h||function(t,e,r,i){var n;return null===r?n=new E:"string"==typeof r||e.objectMode||(n=new _("chunk",["string","Buffer"],r)),!n||(B(t,n),process.nextTick(i,n),!1)}(this,n,t,r))&&(n.pendingcb++,a=function(t,e,r,i,n,a){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=s.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var h=e.objectMode?1:i.length;e.length+=h;var l=e.length-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(j.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),j.prototype._write=function(t,e,r){r(new b("_write()"))},j.prototype._writev=null,j.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,D(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(j.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(j.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),j.prototype.destroy=u.destroy,j.prototype._undestroy=u.undestroy,j.prototype._destroy=function(t,e){e(t)},m}function x(){if(R)return E;R=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};E=s;var e=V(),r=B();k(s,e);for(var i=t(r.prototype),n=0;n0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return l.alloc(0);for(var e,r,i,n=l.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=n,i=s,l.prototype.copy.call(e,r,i),s+=a.data.length,a=a.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0===(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=l.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0===(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:f,value:function(t,e){return u(this,r(r({},e),{},{depth:0,customInspect:!1}))}}]),t}()}function u(t,e){c(t,e),f(t)}function f(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function c(t,e){t.emit("error",e)}var d={destroy:function(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(c,this,t)):process.nextTick(c,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?process.nextTick(f,r):(r._writableState.errorEmitted=!0,process.nextTick(u,r,t)):process.nextTick(u,r,t):e?(process.nextTick(f,r),e(t)):process.nextTick(f,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}},p={};var _={};function b(t,e,r){r||(r=Error);var i=function(t){var r,i;function n(r,i,n){return t.call(this,function(t,r,i){return"string"==typeof e?e:e(t,r,i)}(r,i,n))||this}return i=t,(r=n).prototype=Object.create(i.prototype),r.prototype.constructor=r,r.__proto__=i,n}(r);i.prototype.name=r.name,i.prototype.code=t,_[t]=i}function g(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}b("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),b("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,a;if("string"==typeof e&&(n="not ",e.substr(0,n.length)===n)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(g(e,"type"));else{var s=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(s," ").concat(i," ").concat(g(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),b("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),b("ERR_STREAM_PREMATURE_CLOSE","Premature close"),b("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),b("ERR_STREAM_WRITE_AFTER_END","write after end"),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),p.codes=_;var y=p.codes.ERR_INVALID_OPT_VALUE;var w={getHighWaterMark:function(t,e,r,i){var n=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,i,r);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new y(i?r:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}},v={exports:{}};"function"==typeof Object.create?v.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:v.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var m,S,E,R,k=v.exports,T=function(t,e){if(M("noDeprecation"))return t;var r=!1;return function(){if(!r){if(M("throwDeprecation"))throw new Error(e);M("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}};function M(t){try{if(!e.localStorage)return!1}catch(i){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}function B(){if(S)return m;function r(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}var i;S=1,m=j,j.WritableState=O;var n={deprecate:T},a=h,s=t.Buffer,o=(void 0!==e?e:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var l,u=d,f=w.getHighWaterMark,c=p.codes,_=c.ERR_INVALID_ARG_TYPE,b=c.ERR_METHOD_NOT_IMPLEMENTED,g=c.ERR_MULTIPLE_CALLBACK,y=c.ERR_STREAM_CANNOT_PIPE,v=c.ERR_STREAM_DESTROYED,E=c.ERR_STREAM_NULL_VALUES,R=c.ERR_STREAM_WRITE_AFTER_END,M=c.ERR_UNKNOWN_ENCODING,B=u.errorOrDestroy;function L(){}function O(t,e,n){i=i||x(),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=f(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if("function"!=typeof n)throw new g;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(process.nextTick(n,i),process.nextTick(D,t,e),t._writableState.errorEmitted=!0,B(t,i)):(n(i),t._writableState.errorEmitted=!0,B(t,i),D(t,e))}(t,r,i,e,n);else{var a=C(r)||t.destroyed;a||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?process.nextTick(N,t,r,a,n):N(t,r,a,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function j(t){var e=this instanceof(i=i||x());if(!e&&!l.call(j,this))return new j(t);this._writableState=new O(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function A(t,e,r,i,n,a,s){e.writelen=i,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):r?t._writev(n,e.onwrite):t._write(n,a,e.onwrite),e.sync=!1}function N(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),D(t,e)}function I(t,e){e.bufferProcessing=!0;var i=e.bufferedRequest;if(t._writev&&i&&i.next){var n=e.bufferedRequestCount,a=new Array(n),s=e.corkedRequestsFree;s.entry=i;for(var o=0,h=!0;i;)a[o]=i,i.isBuf||(h=!1),i=i.next,o+=1;a.allBuffers=h,A(t,e,!0,e.length,a,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new r(e),e.bufferedRequestCount=0}else{for(;i;){var l=i.chunk,u=i.encoding,f=i.callback;if(A(t,e,!1,e.objectMode?1:l.length,l,u,f),i=i.next,e.bufferedRequestCount--,e.writing)break}null===i&&(e.lastBufferedRequest=null)}e.bufferedRequest=i,e.bufferProcessing=!1}function C(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function P(t,e){t._final((function(r){e.pendingcb--,r&&B(t,r),e.prefinished=!0,t.emit("prefinish"),D(t,e)}))}function D(t,e){var r=C(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,process.nextTick(P,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}return k(j,a),O.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(O.prototype,"buffer",{get:n.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(j,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===j&&(t&&t._writableState instanceof O)}})):l=function(t){return t instanceof this},j.prototype.pipe=function(){B(this,new y)},j.prototype.write=function(t,e,r){var i,n=this._writableState,a=!1,h=!n.objectMode&&(i=t,s.isBuffer(i)||i instanceof o);return h&&!s.isBuffer(t)&&(t=function(t){return s.from(t)}(t)),"function"==typeof e&&(r=e,e=null),h?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=L),n.ending?function(t,e){var r=new R;B(t,r),process.nextTick(e,r)}(this,r):(h||function(t,e,r,i){var n;return null===r?n=new E:"string"==typeof r||e.objectMode||(n=new _("chunk",["string","Buffer"],r)),!n||(B(t,n),process.nextTick(i,n),!1)}(this,n,t,r))&&(n.pendingcb++,a=function(t,e,r,i,n,a){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=s.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var h=e.objectMode?1:i.length;e.length+=h;var l=e.length-1))throw new M(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(j.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(j.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),j.prototype._write=function(t,e,r){r(new b("_write()"))},j.prototype._writev=null,j.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,D(t,e),r&&(e.finished?process.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(j.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(j.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),j.prototype.destroy=u.destroy,j.prototype._undestroy=u.undestroy,j.prototype._destroy=function(t,e){e(t)},m}function x(){if(R)return E;R=1;var t=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};E=s;var e=V(),r=B();k(s,e);for(var i=t(r.prototype),n=0;n */ !function(e,r){var i=t,n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function s(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,r),r.Buffer=s),s.prototype=Object.create(n.prototype),a(n,s),s.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},s.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},s.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},s.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}}(O,O.exports);var j,A=O.exports;function N(){if(j)return L;j=1;var t=A.Buffer,e=t.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(r){var i;switch(this.encoding=function(r){var i=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(r);if("string"!=typeof i&&(t.isEncoding===e||!e(r)))throw new Error("Unknown encoding: "+r);return i||r}(r),this.encoding){case"utf16le":this.text=a,this.end=s,i=4;break;case"utf8":this.fillLast=n,i=4;break;case"base64":this.text=o,this.end=h,i=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(i)}function i(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function a(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function s(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function o(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function l(t){return t.toString(this.encoding)}function u(t){return t&&t.length?this.write(t):""}return L.StringDecoder=r,r.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return a>0&&(t.lastNeed=a-1),a;if(--n=0)return a>0&&(t.lastNeed=a-2),a;if(--n=0)return a>0&&(2===a?a=0:t.lastNeed=a-3),a;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},r.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length},L}var I=p.codes.ERR_STREAM_PREMATURE_CLOSE;function C(){}var P,D,z,q,U,W,F=function t(e,r,i){if("function"==typeof r)return t(e,null,r);r||(r={}),i=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n0)if("string"==typeof e||s.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i)s.endEmitted?B(t,new M):I(t,s,e,!0);else if(s.ended)B(t,new R);else{if(s.destroyed)return!1;s.reading=!1,s.decoder&&!r?(e=s.decoder.write(e),s.objectMode||0!==e.length?I(t,s,e,!1):V(t,s)):I(t,s,e,!1)}else i||(s.reading=!1,V(t,s));return!s.ended&&(s.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=C?t=C:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function D(t){var e=t._readableState;f("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,process.nextTick(F,t))}function F(t){var e=t._readableState;f("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,Q(t)}function V(t,e){e.readingMore||(e.readingMore=!0,process.nextTick(G,t,e))}function G(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function K(t){f("readable nexttick read 0"),t.read(0)}function J(t,e){f("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Q(t),e.flowing&&!e.reading&&t.read(0)}function Q(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function X(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function Z(t){var e=t._readableState;f("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,process.nextTick($,e,t))}function $(t,e){if(f("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function tt(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?Z(this):D(this),null;if(0===(t=P(t,e))&&e.ended)return 0===e.length&&Z(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?X(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Z(this)),null!==i&&this.emit("data",i),i},j.prototype._read=function(t){B(this,new T("_read()"))},j.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,f("pipe count=%d opts=%j",i.pipesCount,e);var n=(!e||!1!==e.end)&&t!==process.stdout&&t!==process.stderr?o:_;function s(e,n){f("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",d),t.removeListener("finish",p),t.removeListener("drain",h),t.removeListener("error",c),t.removeListener("unpipe",s),r.removeListener("end",o),r.removeListener("end",_),r.removeListener("data",u),l=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function o(){f("onend"),t.end()}i.endEmitted?process.nextTick(n):r.once("end",n),t.on("unpipe",s);var h=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,Q(t))}}(r);t.on("drain",h);var l=!1;function u(e){f("ondata");var n=t.write(e);f("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==tt(i.pipes,t))&&!l&&(f("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function c(e){f("onerror",e),_(),t.removeListener("error",c),0===a(t,"error")&&B(t,e)}function d(){t.removeListener("finish",p),_()}function p(){f("onfinish"),t.removeListener("close",d),_()}function _(){f("unpipe"),r.unpipe(t)}return r.on("data",u),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",c),t.once("close",d),t.once("finish",p),t.emit("pipe",r),i.flowing||(f("pipe resume"),r.resume()),t},j.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,f("on readable",i.length,i.reading),i.length?D(this):i.reading||process.nextTick(K,this))),r},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(t,e){var r=s.prototype.removeListener.call(this,t,e);return"readable"===t&&process.nextTick(Y,this),r},j.prototype.removeAllListeners=function(t){var e=s.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||process.nextTick(Y,this),e},j.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,process.nextTick(J,t,e))}(this,t)),t.paused=!1,this},j.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(f("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(f("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a0,(function(t){i||(i=t),t&&a.forEach(ft),s||(a.forEach(ft),n(i))}))}));return e.reduce(ct)};dt=o.exports,(dt=o.exports=V()).Stream=dt,dt.Readable=dt,dt.Writable=B(),dt.Duplex=x(),dt.Transform=G,dt.PassThrough=nt,dt.finished=F,dt.pipeline=pt;var _t=o.exports;const{Transform:bt}=_t;const{Transform:gt}=_t;const yt=t=>class e extends bt{constructor(e,r,i,n,a){super(a),this._rate=e,this._capacity=r,this._delimitedSuffix=i,this._hashBitLength=n,this._options=a,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let i=null;try{this.update(t,e)}catch(n){i=n}r(i)}_flush(t){let e=null;try{this.push(this.digest())}catch(r){e=r}t(e)}update(t,e){if(!Buffer.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(t)||(t=Buffer.from(t,e)),this._state.absorb(t),this}digest(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let e=this._state.squeeze(this._hashBitLength/8);return void 0!==t&&(e=e.toString(t)),this._resetState(),e}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}},wt=t=>class e extends gt{constructor(e,r,i,n){super(n),this._rate=e,this._capacity=r,this._delimitedSuffix=i,this._options=n,this._state=new t,this._state.initialize(e,r),this._finalized=!1}_transform(t,e,r){let i=null;try{this.update(t,e)}catch(n){i=n}r(i)}_flush(){}_read(t){this.push(this.squeeze(t))}update(t,e){if(!Buffer.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(t)||(t=Buffer.from(t,e)),this._state.absorb(t),this}squeeze(t,e){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let r=this._state.squeeze(t);return void 0!==e&&(r=r.toString(e)),r}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const t=new e(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(t._state),t._finalized=this._finalized,t}};var vt={};const mt=[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];vt.p1600=function(t){for(let e=0;e<24;++e){const r=t[0]^t[10]^t[20]^t[30]^t[40],i=t[1]^t[11]^t[21]^t[31]^t[41],n=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],s=t[4]^t[14]^t[24]^t[34]^t[44],o=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],l=t[7]^t[17]^t[27]^t[37]^t[47],u=t[8]^t[18]^t[28]^t[38]^t[48],f=t[9]^t[19]^t[29]^t[39]^t[49];let c=u^(n<<1|a>>>31),d=f^(a<<1|n>>>31);const p=t[0]^c,_=t[1]^d,b=t[10]^c,g=t[11]^d,y=t[20]^c,w=t[21]^d,v=t[30]^c,m=t[31]^d,S=t[40]^c,E=t[41]^d;c=r^(s<<1|o>>>31),d=i^(o<<1|s>>>31);const R=t[2]^c,k=t[3]^d,T=t[12]^c,M=t[13]^d,B=t[22]^c,x=t[23]^d,L=t[32]^c,O=t[33]^d,j=t[42]^c,A=t[43]^d;c=n^(h<<1|l>>>31),d=a^(l<<1|h>>>31);const N=t[4]^c,I=t[5]^d,C=t[14]^c,P=t[15]^d,D=t[24]^c,z=t[25]^d,q=t[34]^c,U=t[35]^d,W=t[44]^c,F=t[45]^d;c=s^(u<<1|f>>>31),d=o^(f<<1|u>>>31);const H=t[6]^c,V=t[7]^d,G=t[16]^c,Y=t[17]^d,K=t[26]^c,J=t[27]^d,Q=t[36]^c,X=t[37]^d,Z=t[46]^c,$=t[47]^d;c=h^(r<<1|i>>>31),d=l^(i<<1|r>>>31);const tt=t[8]^c,et=t[9]^d,rt=t[18]^c,it=t[19]^d,nt=t[28]^c,at=t[29]^d,st=t[38]^c,ot=t[39]^d,ht=t[48]^c,lt=t[49]^d,ut=p,ft=_,ct=g<<4|b>>>28,dt=b<<4|g>>>28,pt=y<<3|w>>>29,_t=w<<3|y>>>29,bt=m<<9|v>>>23,gt=v<<9|m>>>23,yt=S<<18|E>>>14,wt=E<<18|S>>>14,vt=R<<1|k>>>31,St=k<<1|R>>>31,Et=M<<12|T>>>20,Rt=T<<12|M>>>20,kt=B<<10|x>>>22,Tt=x<<10|B>>>22,Mt=O<<13|L>>>19,Bt=L<<13|O>>>19,xt=j<<2|A>>>30,Lt=A<<2|j>>>30,Ot=I<<30|N>>>2,jt=N<<30|I>>>2,At=C<<6|P>>>26,Nt=P<<6|C>>>26,It=z<<11|D>>>21,Ct=D<<11|z>>>21,Pt=q<<15|U>>>17,Dt=U<<15|q>>>17,zt=F<<29|W>>>3,qt=W<<29|F>>>3,Ut=H<<28|V>>>4,Wt=V<<28|H>>>4,Ft=Y<<23|G>>>9,Ht=G<<23|Y>>>9,Vt=K<<25|J>>>7,Gt=J<<25|K>>>7,Yt=Q<<21|X>>>11,Kt=X<<21|Q>>>11,Jt=$<<24|Z>>>8,Qt=Z<<24|$>>>8,Xt=tt<<27|et>>>5,Zt=et<<27|tt>>>5,$t=rt<<20|it>>>12,te=it<<20|rt>>>12,ee=at<<7|nt>>>25,re=nt<<7|at>>>25,ie=st<<8|ot>>>24,ne=ot<<8|st>>>24,ae=ht<<14|lt>>>18,se=lt<<14|ht>>>18;t[0]=ut^~Et&It,t[1]=ft^~Rt&Ct,t[10]=Ut^~$t&pt,t[11]=Wt^~te&_t,t[20]=vt^~At&Vt,t[21]=St^~Nt&Gt,t[30]=Xt^~ct&kt,t[31]=Zt^~dt&Tt,t[40]=Ot^~Ft&ee,t[41]=jt^~Ht&re,t[2]=Et^~It&Yt,t[3]=Rt^~Ct&Kt,t[12]=$t^~pt&Mt,t[13]=te^~_t&Bt,t[22]=At^~Vt&ie,t[23]=Nt^~Gt&ne,t[32]=ct^~kt&Pt,t[33]=dt^~Tt&Dt,t[42]=Ft^~ee&bt,t[43]=Ht^~re>,t[4]=It^~Yt&ae,t[5]=Ct^~Kt&se,t[14]=pt^~Mt&zt,t[15]=_t^~Bt&qt,t[24]=Vt^~ie&yt,t[25]=Gt^~ne&wt,t[34]=kt^~Pt&Jt,t[35]=Tt^~Dt&Qt,t[44]=ee^~bt&xt,t[45]=re^~gt&Lt,t[6]=Yt^~ae&ut,t[7]=Kt^~se&ft,t[16]=Mt^~zt&Ut,t[17]=Bt^~qt&Wt,t[26]=ie^~yt&vt,t[27]=ne^~wt&St,t[36]=Pt^~Jt&Xt,t[37]=Dt^~Qt&Zt,t[46]=bt^~xt&Ot,t[47]=gt^~Lt&jt,t[8]=ae^~ut&Et,t[9]=se^~ft&Rt,t[18]=zt^~Ut&$t,t[19]=qt^~Wt&te,t[28]=yt^~vt&At,t[29]=wt^~St&Nt,t[38]=Jt^~Xt&ct,t[39]=Qt^~Zt&dt,t[48]=xt^~Ot&Ft,t[49]=Lt^~jt&Ht,t[0]^=mt[2*e],t[1]^=mt[2*e+1]}};const St=vt;function Et(){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}Et.prototype.initialize=function(t,e){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=t/8,this.count=0,this.squeezing=!1},Et.prototype.absorb=function(t){for(let e=0;e>>this.count%4*8&255,this.count+=1,this.count===this.blockSize&&(St.p1600(this.state),this.count=0);return e},Et.prototype.copy=function(t){for(let e=0;e<50;++e)t.state[e]=this.state[e];t.blockSize=this.blockSize,t.count=this.count,t.squeezing=this.squeezing};var Rt=function(t){const e=yt(t),r=wt(t);return function(t,i){switch("string"==typeof t?t.toLowerCase():t){case"keccak224":return new e(1152,448,null,224,i);case"keccak256":return new e(1088,512,null,256,i);case"keccak384":return new e(832,768,null,384,i);case"keccak512":return new e(576,1024,null,512,i);case"sha3-224":return new e(1152,448,6,224,i);case"sha3-256":return new e(1088,512,6,256,i);case"sha3-384":return new e(832,768,6,384,i);case"sha3-512":return new e(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+t)}}}(Et),kt={exports:{}},Tt=A.Buffer;function Mt(t,e){this._block=Tt.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}Mt.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=Tt.from(t,e));for(var r=this._block,i=this._blockSize,n=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(4294967295&r)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a},Mt.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Bt=Mt,xt=k,Lt=Bt,Ot=A.Buffer,jt=[1518500249,1859775393,-1894007588,-899497514],At=new Array(80);function Nt(){this.init(),this._w=At,Lt.call(this,64,56)}function It(t){return t<<30|t>>>2}function Ct(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}xt(Nt,Lt),Nt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Nt.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,o=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=r[h-3]^r[h-8]^r[h-14]^r[h-16];for(var l=0;l<80;++l){var u=~~(l/20),f=0|((e=i)<<5|e>>>27)+Ct(u,n,a,s)+o+r[l]+jt[u];o=s,s=a,a=It(n),n=i,i=f}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0},Nt.prototype._hash=function(){var t=Ot.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Pt=Nt,Dt=k,zt=Bt,qt=A.Buffer,Ut=[1518500249,1859775393,-1894007588,-899497514],Wt=new Array(80);function Ft(){this.init(),this._w=Wt,zt.call(this,64,56)}function Ht(t){return t<<5|t>>>27}function Vt(t){return t<<30|t>>>2}function Gt(t,e,r,i){return 0===t?e&r|~e&i:2===t?e&r|e&i|r&i:e^r^i}Dt(Ft,zt),Ft.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Ft.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,o=0|this._e,h=0;h<16;++h)r[h]=t.readInt32BE(4*h);for(;h<80;++h)r[h]=(e=r[h-3]^r[h-8]^r[h-14]^r[h-16])<<1|e>>>31;for(var l=0;l<80;++l){var u=~~(l/20),f=Ht(i)+Gt(u,n,a,s)+o+r[l]+Ut[u]|0;o=s,s=a,a=Vt(n),n=i,i=f}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0},Ft.prototype._hash=function(){var t=qt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var Yt=Ft,Kt=k,Jt=Bt,Qt=A.Buffer,Xt=[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],Zt=new Array(64);function $t(){this.init(),this._w=Zt,Jt.call(this,64,56)}function te(t,e,r){return r^t&(e^r)}function ee(t,e,r){return t&e|r&(t|e)}function re(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function ie(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function ne(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}Kt($t,Jt),$t.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},$t.prototype._update=function(t){for(var e,r=this._w,i=0|this._a,n=0|this._b,a=0|this._c,s=0|this._d,o=0|this._e,h=0|this._f,l=0|this._g,u=0|this._h,f=0;f<16;++f)r[f]=t.readInt32BE(4*f);for(;f<64;++f)r[f]=0|(((e=r[f-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+r[f-7]+ne(r[f-15])+r[f-16];for(var c=0;c<64;++c){var d=u+ie(o)+te(o,h,l)+Xt[c]+r[c]|0,p=re(i)+ee(i,n,a)|0;u=l,l=h,h=o,o=s+d|0,s=a,a=n,n=i,i=d+p|0}this._a=i+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0,this._f=h+this._f|0,this._g=l+this._g|0,this._h=u+this._h|0},$t.prototype._hash=function(){var t=Qt.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var ae=$t,se=k,oe=ae,he=Bt,le=A.Buffer,ue=new Array(64);function fe(){this.init(),this._w=ue,he.call(this,64,56)}se(fe,oe),fe.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},fe.prototype._hash=function(){var t=le.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var ce=fe,de=k,pe=Bt,_e=A.Buffer,be=[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],ge=new Array(160);function ye(){this.init(),this._w=ge,pe.call(this,128,112)}function we(t,e,r){return r^t&(e^r)}function ve(t,e,r){return t&e|r&(t|e)}function me(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Se(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Ee(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Re(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function ke(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Te(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function Me(t,e){return t>>>0>>0?1:0}de(ye,pe),ye.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},ye.prototype._update=function(t){for(var e=this._w,r=0|this._ah,i=0|this._bh,n=0|this._ch,a=0|this._dh,s=0|this._eh,o=0|this._fh,h=0|this._gh,l=0|this._hh,u=0|this._al,f=0|this._bl,c=0|this._cl,d=0|this._dl,p=0|this._el,_=0|this._fl,b=0|this._gl,g=0|this._hl,y=0;y<32;y+=2)e[y]=t.readInt32BE(4*y),e[y+1]=t.readInt32BE(4*y+4);for(;y<160;y+=2){var w=e[y-30],v=e[y-30+1],m=Ee(w,v),S=Re(v,w),E=ke(w=e[y-4],v=e[y-4+1]),R=Te(v,w),k=e[y-14],T=e[y-14+1],M=e[y-32],B=e[y-32+1],x=S+T|0,L=m+k+Me(x,S)|0;L=(L=L+E+Me(x=x+R|0,R)|0)+M+Me(x=x+B|0,B)|0,e[y]=L,e[y+1]=x}for(var O=0;O<160;O+=2){L=e[O],x=e[O+1];var j=ve(r,i,n),A=ve(u,f,c),N=me(r,u),I=me(u,r),C=Se(s,p),P=Se(p,s),D=be[O],z=be[O+1],q=we(s,o,h),U=we(p,_,b),W=g+P|0,F=l+C+Me(W,g)|0;F=(F=(F=F+q+Me(W=W+U|0,U)|0)+D+Me(W=W+z|0,z)|0)+L+Me(W=W+x|0,x)|0;var H=I+A|0,V=N+j+Me(H,I)|0;l=h,g=b,h=o,b=_,o=s,_=p,s=a+F+Me(p=d+W|0,d)|0,a=n,d=c,n=i,c=f,i=r,f=u,r=F+V+Me(u=W+H|0,W)|0}this._al=this._al+u|0,this._bl=this._bl+f|0,this._cl=this._cl+c|0,this._dl=this._dl+d|0,this._el=this._el+p|0,this._fl=this._fl+_|0,this._gl=this._gl+b|0,this._hl=this._hl+g|0,this._ah=this._ah+r+Me(this._al,u)|0,this._bh=this._bh+i+Me(this._bl,f)|0,this._ch=this._ch+n+Me(this._cl,c)|0,this._dh=this._dh+a+Me(this._dl,d)|0,this._eh=this._eh+s+Me(this._el,p)|0,this._fh=this._fh+o+Me(this._fl,_)|0,this._gh=this._gh+h+Me(this._gl,b)|0,this._hh=this._hh+l+Me(this._hl,g)|0},ye.prototype._hash=function(){var t=_e.allocUnsafe(64);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var Be=ye,xe=k,Le=Be,Oe=Bt,je=A.Buffer,Ae=new Array(160);function Ne(){this.init(),this._w=Ae,Oe.call(this,128,112)}xe(Ne,Le),Ne.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},Ne.prototype._hash=function(){var t=je.allocUnsafe(48);function e(e,r,i){t.writeInt32BE(e,i),t.writeInt32BE(r,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var Ie=Ne,Ce=kt.exports=function(t){t=t.toLowerCase();var e=Ce[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};Ce.sha=Pt,Ce.sha1=Yt,Ce.sha224=ce,Ce.sha256=ae,Ce.sha384=Ie,Ce.sha512=Be;var Pe=kt.exports;function De(t){var e,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t))for(e=0;e{let r;switch(e){case"standard":default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.LINK_API_URL=void 0,h.LINK_API_URL="https://www.walletlink.org";var d={},p={exports:{}};!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function s(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n.Buffer}catch(I){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function l(e,t,n,s){for(var i=0,o=0,a=Math.min(e.length,n),c=t;c=49?l-49+10:l>=17?l-17+10:l,r(l>=0&&o0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var s=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(s++,this.negative=1),s=0;s-=3)o=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[i]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(s=0,i=0;s>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)s=c(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=s>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=s>>>26):i+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,s=1;s<=67108863;s*=t)n++;n--,s=s/t|0;for(var i=e.length-r,o=i%n,a=Math.min(i,i-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(I){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var s=0|e.words[0],i=0|t.words[0],o=s*i,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var l=1;l>>26,h=67108863&c,d=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=d;p++){var f=l-p|0;u+=(o=(s=0|e.words[f])*(i=0|t.words[p])+h)/67108864|0,h=67108863&o}r.words[l]=0|h,c=0|u}return 0!==c?r.words[l]=0|c:r.length--,r._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var s=0,i=0,o=0;o>>24-s&16777215,(s+=2)>=26&&(s-=26,o--),n=0!==i||o!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=p[e],u=f[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(u).toString(e);n=(h=h.idivn(u)).isZero()?m+n:d[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var s=this.byteLength(),i=n||Math.max(1,s);r(s<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,s),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,s=0,i=0;s>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var s=0;s0&&(this.words[s]=~this.words[s]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,s=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var s=0,i=0;i>>26;for(;0!==s&&i>>26;if(this.length=r.length,0!==s)this.words[this.length]=s,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,s=this.cmp(e);if(0===s)return this.negative=0,this.length=1,this.words[0]=0,this;s>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,p=0|o[1],f=8191&p,m=p>>>13,g=0|o[2],v=8191&g,y=g>>>13,w=0|o[3],_=8191&w,b=w>>>13,E=0|o[4],k=8191&E,M=E>>>13,S=0|o[5],C=8191&S,I=S>>>13,R=0|o[6],x=8191&R,A=R>>>13,N=0|o[7],O=8191&N,P=N>>>13,L=0|o[8],T=8191&L,j=L>>>13,B=0|o[9],D=8191&B,F=B>>>13,$=0|a[0],U=8191&$,H=$>>>13,V=0|a[1],q=8191&V,W=V>>>13,z=0|a[2],J=8191&z,G=z>>>13,Z=0|a[3],Q=8191&Z,Y=Z>>>13,K=0|a[4],X=8191&K,ee=K>>>13,te=0|a[5],re=8191&te,ne=te>>>13,se=0|a[6],ie=8191&se,oe=se>>>13,ae=0|a[7],ce=8191&ae,le=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,pe=0|a[9],fe=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(l+(n=Math.imul(h,U))|0)+((8191&(s=(s=Math.imul(h,H))+Math.imul(d,U)|0))<<13)|0;l=((i=Math.imul(d,H))+(s>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(f,U),s=(s=Math.imul(f,H))+Math.imul(m,U)|0,i=Math.imul(m,H);var ve=(l+(n=n+Math.imul(h,q)|0)|0)+((8191&(s=(s=s+Math.imul(h,W)|0)+Math.imul(d,q)|0))<<13)|0;l=((i=i+Math.imul(d,W)|0)+(s>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,U),s=(s=Math.imul(v,H))+Math.imul(y,U)|0,i=Math.imul(y,H),n=n+Math.imul(f,q)|0,s=(s=s+Math.imul(f,W)|0)+Math.imul(m,q)|0,i=i+Math.imul(m,W)|0;var ye=(l+(n=n+Math.imul(h,J)|0)|0)+((8191&(s=(s=s+Math.imul(h,G)|0)+Math.imul(d,J)|0))<<13)|0;l=((i=i+Math.imul(d,G)|0)+(s>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(_,U),s=(s=Math.imul(_,H))+Math.imul(b,U)|0,i=Math.imul(b,H),n=n+Math.imul(v,q)|0,s=(s=s+Math.imul(v,W)|0)+Math.imul(y,q)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(f,J)|0,s=(s=s+Math.imul(f,G)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,G)|0;var we=(l+(n=n+Math.imul(h,Q)|0)|0)+((8191&(s=(s=s+Math.imul(h,Y)|0)+Math.imul(d,Q)|0))<<13)|0;l=((i=i+Math.imul(d,Y)|0)+(s>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,U),s=(s=Math.imul(k,H))+Math.imul(M,U)|0,i=Math.imul(M,H),n=n+Math.imul(_,q)|0,s=(s=s+Math.imul(_,W)|0)+Math.imul(b,q)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(v,J)|0,s=(s=s+Math.imul(v,G)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(f,Q)|0,s=(s=s+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var _e=(l+(n=n+Math.imul(h,X)|0)|0)+((8191&(s=(s=s+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;l=((i=i+Math.imul(d,ee)|0)+(s>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,U),s=(s=Math.imul(C,H))+Math.imul(I,U)|0,i=Math.imul(I,H),n=n+Math.imul(k,q)|0,s=(s=s+Math.imul(k,W)|0)+Math.imul(M,q)|0,i=i+Math.imul(M,W)|0,n=n+Math.imul(_,J)|0,s=(s=s+Math.imul(_,G)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(v,Q)|0,s=(s=s+Math.imul(v,Y)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(f,X)|0,s=(s=s+Math.imul(f,ee)|0)+Math.imul(m,X)|0,i=i+Math.imul(m,ee)|0;var be=(l+(n=n+Math.imul(h,re)|0)|0)+((8191&(s=(s=s+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;l=((i=i+Math.imul(d,ne)|0)+(s>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(x,U),s=(s=Math.imul(x,H))+Math.imul(A,U)|0,i=Math.imul(A,H),n=n+Math.imul(C,q)|0,s=(s=s+Math.imul(C,W)|0)+Math.imul(I,q)|0,i=i+Math.imul(I,W)|0,n=n+Math.imul(k,J)|0,s=(s=s+Math.imul(k,G)|0)+Math.imul(M,J)|0,i=i+Math.imul(M,G)|0,n=n+Math.imul(_,Q)|0,s=(s=s+Math.imul(_,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,n=n+Math.imul(v,X)|0,s=(s=s+Math.imul(v,ee)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(f,re)|0,s=(s=s+Math.imul(f,ne)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,ne)|0;var Ee=(l+(n=n+Math.imul(h,ie)|0)|0)+((8191&(s=(s=s+Math.imul(h,oe)|0)+Math.imul(d,ie)|0))<<13)|0;l=((i=i+Math.imul(d,oe)|0)+(s>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(O,U),s=(s=Math.imul(O,H))+Math.imul(P,U)|0,i=Math.imul(P,H),n=n+Math.imul(x,q)|0,s=(s=s+Math.imul(x,W)|0)+Math.imul(A,q)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(C,J)|0,s=(s=s+Math.imul(C,G)|0)+Math.imul(I,J)|0,i=i+Math.imul(I,G)|0,n=n+Math.imul(k,Q)|0,s=(s=s+Math.imul(k,Y)|0)+Math.imul(M,Q)|0,i=i+Math.imul(M,Y)|0,n=n+Math.imul(_,X)|0,s=(s=s+Math.imul(_,ee)|0)+Math.imul(b,X)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(v,re)|0,s=(s=s+Math.imul(v,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(f,ie)|0,s=(s=s+Math.imul(f,oe)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,oe)|0;var ke=(l+(n=n+Math.imul(h,ce)|0)|0)+((8191&(s=(s=s+Math.imul(h,le)|0)+Math.imul(d,ce)|0))<<13)|0;l=((i=i+Math.imul(d,le)|0)+(s>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(T,U),s=(s=Math.imul(T,H))+Math.imul(j,U)|0,i=Math.imul(j,H),n=n+Math.imul(O,q)|0,s=(s=s+Math.imul(O,W)|0)+Math.imul(P,q)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(x,J)|0,s=(s=s+Math.imul(x,G)|0)+Math.imul(A,J)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(C,Q)|0,s=(s=s+Math.imul(C,Y)|0)+Math.imul(I,Q)|0,i=i+Math.imul(I,Y)|0,n=n+Math.imul(k,X)|0,s=(s=s+Math.imul(k,ee)|0)+Math.imul(M,X)|0,i=i+Math.imul(M,ee)|0,n=n+Math.imul(_,re)|0,s=(s=s+Math.imul(_,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(v,ie)|0,s=(s=s+Math.imul(v,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(f,ce)|0,s=(s=s+Math.imul(f,le)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,le)|0;var Me=(l+(n=n+Math.imul(h,he)|0)|0)+((8191&(s=(s=s+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;l=((i=i+Math.imul(d,de)|0)+(s>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(D,U),s=(s=Math.imul(D,H))+Math.imul(F,U)|0,i=Math.imul(F,H),n=n+Math.imul(T,q)|0,s=(s=s+Math.imul(T,W)|0)+Math.imul(j,q)|0,i=i+Math.imul(j,W)|0,n=n+Math.imul(O,J)|0,s=(s=s+Math.imul(O,G)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(x,Q)|0,s=(s=s+Math.imul(x,Y)|0)+Math.imul(A,Q)|0,i=i+Math.imul(A,Y)|0,n=n+Math.imul(C,X)|0,s=(s=s+Math.imul(C,ee)|0)+Math.imul(I,X)|0,i=i+Math.imul(I,ee)|0,n=n+Math.imul(k,re)|0,s=(s=s+Math.imul(k,ne)|0)+Math.imul(M,re)|0,i=i+Math.imul(M,ne)|0,n=n+Math.imul(_,ie)|0,s=(s=s+Math.imul(_,oe)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,oe)|0,n=n+Math.imul(v,ce)|0,s=(s=s+Math.imul(v,le)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,le)|0,n=n+Math.imul(f,he)|0,s=(s=s+Math.imul(f,de)|0)+Math.imul(m,he)|0,i=i+Math.imul(m,de)|0;var Se=(l+(n=n+Math.imul(h,fe)|0)|0)+((8191&(s=(s=s+Math.imul(h,me)|0)+Math.imul(d,fe)|0))<<13)|0;l=((i=i+Math.imul(d,me)|0)+(s>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(D,q),s=(s=Math.imul(D,W))+Math.imul(F,q)|0,i=Math.imul(F,W),n=n+Math.imul(T,J)|0,s=(s=s+Math.imul(T,G)|0)+Math.imul(j,J)|0,i=i+Math.imul(j,G)|0,n=n+Math.imul(O,Q)|0,s=(s=s+Math.imul(O,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(x,X)|0,s=(s=s+Math.imul(x,ee)|0)+Math.imul(A,X)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(C,re)|0,s=(s=s+Math.imul(C,ne)|0)+Math.imul(I,re)|0,i=i+Math.imul(I,ne)|0,n=n+Math.imul(k,ie)|0,s=(s=s+Math.imul(k,oe)|0)+Math.imul(M,ie)|0,i=i+Math.imul(M,oe)|0,n=n+Math.imul(_,ce)|0,s=(s=s+Math.imul(_,le)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,le)|0,n=n+Math.imul(v,he)|0,s=(s=s+Math.imul(v,de)|0)+Math.imul(y,he)|0,i=i+Math.imul(y,de)|0;var Ce=(l+(n=n+Math.imul(f,fe)|0)|0)+((8191&(s=(s=s+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;l=((i=i+Math.imul(m,me)|0)+(s>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(D,J),s=(s=Math.imul(D,G))+Math.imul(F,J)|0,i=Math.imul(F,G),n=n+Math.imul(T,Q)|0,s=(s=s+Math.imul(T,Y)|0)+Math.imul(j,Q)|0,i=i+Math.imul(j,Y)|0,n=n+Math.imul(O,X)|0,s=(s=s+Math.imul(O,ee)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,s=(s=s+Math.imul(x,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(C,ie)|0,s=(s=s+Math.imul(C,oe)|0)+Math.imul(I,ie)|0,i=i+Math.imul(I,oe)|0,n=n+Math.imul(k,ce)|0,s=(s=s+Math.imul(k,le)|0)+Math.imul(M,ce)|0,i=i+Math.imul(M,le)|0,n=n+Math.imul(_,he)|0,s=(s=s+Math.imul(_,de)|0)+Math.imul(b,he)|0,i=i+Math.imul(b,de)|0;var Ie=(l+(n=n+Math.imul(v,fe)|0)|0)+((8191&(s=(s=s+Math.imul(v,me)|0)+Math.imul(y,fe)|0))<<13)|0;l=((i=i+Math.imul(y,me)|0)+(s>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,Q),s=(s=Math.imul(D,Y))+Math.imul(F,Q)|0,i=Math.imul(F,Y),n=n+Math.imul(T,X)|0,s=(s=s+Math.imul(T,ee)|0)+Math.imul(j,X)|0,i=i+Math.imul(j,ee)|0,n=n+Math.imul(O,re)|0,s=(s=s+Math.imul(O,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(x,ie)|0,s=(s=s+Math.imul(x,oe)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,oe)|0,n=n+Math.imul(C,ce)|0,s=(s=s+Math.imul(C,le)|0)+Math.imul(I,ce)|0,i=i+Math.imul(I,le)|0,n=n+Math.imul(k,he)|0,s=(s=s+Math.imul(k,de)|0)+Math.imul(M,he)|0,i=i+Math.imul(M,de)|0;var Re=(l+(n=n+Math.imul(_,fe)|0)|0)+((8191&(s=(s=s+Math.imul(_,me)|0)+Math.imul(b,fe)|0))<<13)|0;l=((i=i+Math.imul(b,me)|0)+(s>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(D,X),s=(s=Math.imul(D,ee))+Math.imul(F,X)|0,i=Math.imul(F,ee),n=n+Math.imul(T,re)|0,s=(s=s+Math.imul(T,ne)|0)+Math.imul(j,re)|0,i=i+Math.imul(j,ne)|0,n=n+Math.imul(O,ie)|0,s=(s=s+Math.imul(O,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(x,ce)|0,s=(s=s+Math.imul(x,le)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,le)|0,n=n+Math.imul(C,he)|0,s=(s=s+Math.imul(C,de)|0)+Math.imul(I,he)|0,i=i+Math.imul(I,de)|0;var xe=(l+(n=n+Math.imul(k,fe)|0)|0)+((8191&(s=(s=s+Math.imul(k,me)|0)+Math.imul(M,fe)|0))<<13)|0;l=((i=i+Math.imul(M,me)|0)+(s>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(D,re),s=(s=Math.imul(D,ne))+Math.imul(F,re)|0,i=Math.imul(F,ne),n=n+Math.imul(T,ie)|0,s=(s=s+Math.imul(T,oe)|0)+Math.imul(j,ie)|0,i=i+Math.imul(j,oe)|0,n=n+Math.imul(O,ce)|0,s=(s=s+Math.imul(O,le)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,le)|0,n=n+Math.imul(x,he)|0,s=(s=s+Math.imul(x,de)|0)+Math.imul(A,he)|0,i=i+Math.imul(A,de)|0;var Ae=(l+(n=n+Math.imul(C,fe)|0)|0)+((8191&(s=(s=s+Math.imul(C,me)|0)+Math.imul(I,fe)|0))<<13)|0;l=((i=i+Math.imul(I,me)|0)+(s>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(D,ie),s=(s=Math.imul(D,oe))+Math.imul(F,ie)|0,i=Math.imul(F,oe),n=n+Math.imul(T,ce)|0,s=(s=s+Math.imul(T,le)|0)+Math.imul(j,ce)|0,i=i+Math.imul(j,le)|0,n=n+Math.imul(O,he)|0,s=(s=s+Math.imul(O,de)|0)+Math.imul(P,he)|0,i=i+Math.imul(P,de)|0;var Ne=(l+(n=n+Math.imul(x,fe)|0)|0)+((8191&(s=(s=s+Math.imul(x,me)|0)+Math.imul(A,fe)|0))<<13)|0;l=((i=i+Math.imul(A,me)|0)+(s>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(D,ce),s=(s=Math.imul(D,le))+Math.imul(F,ce)|0,i=Math.imul(F,le),n=n+Math.imul(T,he)|0,s=(s=s+Math.imul(T,de)|0)+Math.imul(j,he)|0,i=i+Math.imul(j,de)|0;var Oe=(l+(n=n+Math.imul(O,fe)|0)|0)+((8191&(s=(s=s+Math.imul(O,me)|0)+Math.imul(P,fe)|0))<<13)|0;l=((i=i+Math.imul(P,me)|0)+(s>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(D,he),s=(s=Math.imul(D,de))+Math.imul(F,he)|0,i=Math.imul(F,de);var Pe=(l+(n=n+Math.imul(T,fe)|0)|0)+((8191&(s=(s=s+Math.imul(T,me)|0)+Math.imul(j,fe)|0))<<13)|0;l=((i=i+Math.imul(j,me)|0)+(s>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Le=(l+(n=Math.imul(D,fe))|0)+((8191&(s=(s=Math.imul(D,me))+Math.imul(F,fe)|0))<<13)|0;return l=((i=Math.imul(F,me))+(s>>>13)|0)+(Le>>>26)|0,Le&=67108863,c[0]=ge,c[1]=ve,c[2]=ye,c[3]=we,c[4]=_e,c[5]=be,c[6]=Ee,c[7]=ke,c[8]=Me,c[9]=Se,c[10]=Ce,c[11]=Ie,c[12]=Re,c[13]=xe,c[14]=Ae,c[15]=Ne,c[16]=Oe,c[17]=Pe,c[18]=Le,0!==l&&(c[19]=l,r.length++),r};function v(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,s=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=a,n=o,o=s}return 0!==n?r.words[i]=n:r.length--,r._strip()}function y(e,t,r){return v(e,t,r)}Math.imul||(g=m),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?v(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,s=0;s>=26,n+=i/67108864|0,n+=o>>>26,this.words[s]=67108863&o}return 0!==n&&(this.words[s]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>s&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,s=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==s){for(t=this.length-1;t>=0;t--)this.words[t+s]=this.words[t];for(t=0;t=0),s=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),a=67108863^67108863>>>i<o)for(this.length-=o,l=0;l=0&&(0!==u||l>=s);l--){var h=0|this.words[l];this.words[l]=u<<26-i|h>>>i,u=h&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,s=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var s=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[s+n]=67108863&i}for(;s>26,this.words[s+n]=67108863&i;if(0===a)return this._strip();for(r(-1===a),a=0,s=0;s>26,this.words[s]=67108863&i;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),s=e,o=0|s.words[s.length-1];0!=(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,c=n.length-s.length;if("mod"!==t){(a=new i(null)).length=c+1,a.words=new Array(a.length);for(var l=0;l=0;h--){var d=67108864*(0|n.words[s.length+h])+(0|n.words[s.length+h-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var s,o,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),s=e.andln(1),i=r.cmp(n);return i<0||1===s&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,s=0,i=this.length-1;i>=0;i--)s=(n*s+(0|this.words[i]))%e;return t?-s:s},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,s=this.length-1;s>=0;s--){var i=(0|this.words[s])+67108864*n;this.words[s]=i/e|0,n=i%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s=new i(1),o=new i(0),a=new i(0),c=new i(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),h=t.clone();!t.isZero();){for(var d=0,p=1;!(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(u),o.isub(h)),s.iushrn(1),o.iushrn(1);for(var f=0,m=1;!(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(c)):(n.isub(t),a.isub(s),c.isub(o))}return{a:a,b:c,gcd:n.iushln(l)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s,o=new i(1),a=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;!(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,d=1;!(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a)):(n.isub(t),a.isub(o))}return(s=0===t.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(e),s},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var s=t.cmp(r);if(s<0){var i=t;t=r,r=i}else if(0===s||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,s=1<>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var s=0|this.words[0];t=s===e?0:se.length)return 1;if(this.length=0;r--){var n=0|this.words[r],s=0|e.words[r];if(n!==s){ns&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},s(b,_),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),s=0;s>>22,i=o}i>>>=22,e.words[s-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=s,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new E;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,s),d=this.pow(e,s.addn(1).iushrn(1)),p=this.pow(e,s),f=o;0!==p.cmp(a);){for(var m=p,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;n--){for(var l=t.words[n],u=c-1;u>=0;u--){var h=l>>u&1;s!==r[0]&&(s=this.sqr(s)),0!==h||0!==o?(o<<=1,o|=h,(4==++a||0===n&&0===u)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}c=26}return s},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},s(C,S),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),i=s;return s.cmp(this.m)>=0?i=s.isub(this.m):s.cmpn(0)<0&&(i=s.iadd(this.m)),i._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(p,e);var f=p.exports,m={},g={};Object.defineProperty(g,"__esModule",{value:!0}),g.errorValues=g.standardErrorCodes=void 0,g.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}},g.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 v={},y={};!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=g,r="Unspecified error message.";function n(n,s=r){if(n&&Number.isInteger(n)){const r=n.toString();if(a(t.errorValues,r))return t.errorValues[r].message;if(i(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return s}function s(e){if(!Number.isInteger(e))return!1;const r=e.toString();return!!t.errorValues[r]||!!i(e)}function i(e){return e>=-32099&&e<=-32e3}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=n,e.isValidCode=s,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:i=!1}={}){const l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&s(e.code)){const t=e;l.code=t.code,t.message&&"string"==typeof t.message?(l.message=t.message,a(t,"data")&&(l.data=t.data)):(l.message=n(l.code),l.data={originalError:o(e)})}else l.code=t.standardErrorCodes.rpc.internal,l.message=c(e,"message")?e.message:r,l.data={originalError:o(e)};return i&&(l.stack=c(e,"stack")?e.stack:void 0),l}}(y),Object.defineProperty(v,"__esModule",{value:!0}),v.standardErrors=void 0;const w=g,_=y;function b(e,t){const[r,n]=k(t);return new M(e,r||(0,_.getMessageFromCode)(e),n)}function E(e,t){const[r,n]=k(t);return new S(e,r||(0,_.getMessageFromCode)(e),n)}function k(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}v.standardErrors={rpc:{parse:e=>b(w.standardErrorCodes.rpc.parse,e),invalidRequest:e=>b(w.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>b(w.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>b(w.standardErrorCodes.rpc.methodNotFound,e),internal:e=>b(w.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return b(t,e)},invalidInput:e=>b(w.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>b(w.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>b(w.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>b(w.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>b(w.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>b(w.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>E(w.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>E(w.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>E(w.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>E(w.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>E(w.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>E(w.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new S(t,r,n)}}};let M=class extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}},S=class extends M{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};var C={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.isErrorResponse=void 0,I.isErrorResponse=function(e){return void 0!==e.errorMessage};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.LIB_VERSION=void 0,R.LIB_VERSION="3.9.3",Object.defineProperty(C,"__esModule",{value:!0}),C.serializeError=void 0;const x=I,A=R,N=g,O=y;C.serializeError=function(e,t){const r=(0,O.serialize)(function(e){if("string"==typeof e)return{message:e,code:N.standardErrorCodes.rpc.internal};if((0,x.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",A.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=function(e,t){const r=null==e?void 0:e.method;if(r)return r;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(r.data,t);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=g;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=v;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=C;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=y;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})}(m);var P,L,T={};function j(){return e=>e}Object.defineProperty(T,"__esModule",{value:!0}),T.ProviderType=T.RegExpString=T.IntNumber=T.BigIntString=T.AddressString=T.HexString=T.OpaqueType=void 0,T.OpaqueType=j,T.HexString=e=>e,T.AddressString=e=>e,T.BigIntString=e=>e,T.IntNumber=function(e){return Math.floor(e)},T.RegExpString=e=>e,(L=P||(T.ProviderType=P={})).CoinbaseWallet="CoinbaseWallet",L.MetaMask="MetaMask",L.Unselected="";var B=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.isMobileWeb=d.getLocation=d.isInIFrame=d.createQrUrl=d.getFavicon=d.range=d.isBigNumber=d.ensureParsedJSONObject=d.ensureBN=d.ensureRegExpString=d.ensureIntNumber=d.ensureBuffer=d.ensureAddressString=d.ensureEvenLengthHexString=d.ensureHexString=d.isHexString=d.prepend0x=d.strip0x=d.has0xPrefix=d.hexStringFromIntNumber=d.intNumberFromHexString=d.bigIntStringFromBN=d.hexStringFromBuffer=d.hexStringToUint8Array=d.uint8ArrayToHex=d.randomBytesHex=void 0;const D=B(f),F=m,$=T,U=/^[0-9]*$/,H=/^[a-f0-9]*$/;function V(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function q(e){return e.startsWith("0x")||e.startsWith("0X")}function W(e){return q(e)?e.slice(2):e}function z(e){return q(e)?`0x${e.slice(2)}`:`0x${e}`}function J(e){if("string"!=typeof e)return!1;const t=W(e).toLowerCase();return H.test(t)}function G(e,t=!1){if("string"==typeof e){const r=W(e).toLowerCase();if(H.test(r))return(0,$.HexString)(t?`0x${r}`:r)}throw F.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Z(e,t=!1){let r=G(e,!1);return r.length%2==1&&(r=(0,$.HexString)(`0${r}`)),t?(0,$.HexString)(`0x${r}`):r}function Q(e){if("number"==typeof e&&Number.isInteger(e))return(0,$.IntNumber)(e);if("string"==typeof e){if(U.test(e))return(0,$.IntNumber)(Number(e));if(J(e))return(0,$.IntNumber)(new D.default(Z(e,!1),16).toNumber())}throw F.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Y(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}function K(){try{return null!==window.frameElement}catch(e){return!1}}d.randomBytesHex=function(e){return V(crypto.getRandomValues(new Uint8Array(e)))},d.uint8ArrayToHex=V,d.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},d.hexStringFromBuffer=function(e,t=!1){const r=e.toString("hex");return(0,$.HexString)(t?`0x${r}`:r)},d.bigIntStringFromBN=function(e){return(0,$.BigIntString)(e.toString(10))},d.intNumberFromHexString=function(e){return(0,$.IntNumber)(new D.default(Z(e,!1),16).toNumber())},d.hexStringFromIntNumber=function(e){return(0,$.HexString)(`0x${new D.default(e).toString(16)}`)},d.has0xPrefix=q,d.strip0x=W,d.prepend0x=z,d.isHexString=J,d.ensureHexString=G,d.ensureEvenLengthHexString=Z,d.ensureAddressString=function(e){if("string"==typeof e){const t=W(e).toLowerCase();if(J(t)&&40===t.length)return(0,$.AddressString)(z(t))}throw F.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},d.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(J(e)){const t=Z(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw F.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},d.ensureIntNumber=Q,d.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,$.RegExpString)(e.toString());throw F.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},d.ensureBN=function(e){if(null!==e&&(D.default.isBN(e)||Y(e)))return new D.default(e.toString(10),10);if("number"==typeof e)return new D.default(Q(e));if("string"==typeof e){if(U.test(e))return new D.default(e,10);if(J(e))return new D.default(Z(e,!1),16)}throw F.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},d.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw F.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},d.isBigNumber=Y,d.range=function(e,t){return Array.from({length:t-e},((t,r)=>e+r))},d.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`},d.createQrUrl=function(e,t,r,n,s,i){const o=n?"parent-id":"id";return`${r}/#/link?${new URLSearchParams({[o]:e,secret:t,server:r,v:s,chainId:i.toString()}).toString()}`},d.isInIFrame=K,d.getLocation=function(){try{return K()&&window.top?window.top.location:window.location}catch(e){return window.location}},d.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)};var X={};Object.defineProperty(X,"__esModule",{value:!0}),X.ScopedLocalStorage=void 0;X.ScopedLocalStorage=class{constructor(e){this.scope=e}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(e)))}scopedKey(e){return`${this.scope}:${e}`}};var ee={},te={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,i=n.length,o=new Array(i);se.json())).then((t=>{if(!t)throw ae.standardErrors.rpc.parse({});const r=t,{error:n}=r;if(n)throw(0,ae.serializeError)(n,e.method);return r}))}};var ce={};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Session=void 0;const le=i,ue=d,he="session:id",de="session:secret",pe="session:linked";class fe{constructor(e,t,r,n){this._storage=e,this._id=t||(0,ue.randomBytesHex)(16),this._secret=r||(0,ue.randomBytesHex)(32),this._key=(new le.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!n}static load(e){const t=e.getItem(he),r=e.getItem(pe),n=e.getItem(de);return t&&n?new fe(e,t,n,"1"===r):null}static hash(e){return(new le.sha256).update(e).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(he,this._id),this._storage.setItem(de,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(pe,this._linked?"1":"0")}}ce.Session=fe;var me={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.Cipher=void 0;const ve=d;ge.Cipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.importKey("raw",(0,ve.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,i=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},n,s.encode(e)),o=i.slice(i.byteLength-16),a=i.slice(0,i.byteLength-16),c=new Uint8Array(o),l=new Uint8Array(a),u=new Uint8Array([...r,...c,...l]);return(0,ve.uint8ArrayToHex)(u)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((r,n)=>{!async function(){const s=await crypto.subtle.importKey("raw",(0,ve.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=(0,ve.hexStringToUint8Array)(e),o=i.slice(0,12),a=i.slice(12,28),c=i.slice(28),l=new Uint8Array([...c,...a]),u={name:"AES-GCM",iv:new Uint8Array(o)};try{const e=await window.crypto.subtle.decrypt(u,s,l),t=new TextDecoder;r(t.decode(e))}catch(h){n(h)}}()}))}};var ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.WalletLinkHTTP=void 0;ye.WalletLinkHTTP=class{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const n=`${t}:${r}`;this.auth=`Basic ${btoa(n)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:n}=await t.json();if(n)throw new Error(`Check unseen events failed: ${n}`);const s=null!==(e=null==r?void 0:r.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${t.status}`)}};var we,_e,be={};Object.defineProperty(be,"__esModule",{value:!0}),be.WalletLinkWebSocket=be.ConnectionState=void 0,(_e=we||(be.ConnectionState=we={}))[_e.DISCONNECTED=0]="DISCONNECTED",_e[_e.CONNECTING=1]="CONNECTING",_e[_e.CONNECTED=2]="CONNECTED";be.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var r;let n;try{this.webSocket=n=new this.WebSocketClass(this.url)}catch(s){return void t(s)}null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.CONNECTING),n.onclose=e=>{var r;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.DISCONNECTED)},n.onopen=t=>{var r;if(e(),null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},n.onmessage=e=>{var t,r;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(r=this.incomingDataListener)||void 0===r||r.call(this,t)}catch(n){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,we.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(r){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(me,"__esModule",{value:!0}),me.WalletLinkConnection=void 0;const Ee=T,ke=ge,Me=ie,Se=oe,Ce=ce,Ie=ye,Re=be;me.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:r,diagnostic:n,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Ee.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach(((t,r)=>{const n=e[r];void 0!==n&&t(n)}))},this.handleDestroyed=e=>{var t,r;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload(),null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Ce.Session.hash(this.session.id)}))},this.handleAccountUpdated=async e=>{var t,r;try{const r=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(r)}catch(n){null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.metadataUpdated(e,n)}catch(s){null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:e})}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(Se.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(Se.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(e),s=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.chainUpdated(n,s)}catch(s){null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new ke.Cipher(e.secret),this.diagnostic=n,this.listener=r;const i=new Re.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener((async t=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.CONNECTED_STATE_CHANGE,{state:t,sessionIdHash:Ce.Session.hash(e.id)});let n=!1;switch(t){case Re.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||i.connect().catch((()=>{e()}))};e()}break;case Re.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),n=!0}catch(s){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case Re.ConnectionState.CONNECTING:}this.connected!==n&&(this.connected=n)})),i.setIncomingDataListener((t=>{var r,n,s;switch(t.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const n="IsLinkedOK"===t.type?t.linked:void 0;null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.LINKED,{sessionIdHash:Ce.Session.hash(e.id),linked:n,type:t.type,onlineGuests:t.onlineGuests}),this.linked=n||t.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Ce.Session.hash(e.id),metadata_keys:t&&t.metadata?Object.keys(t.metadata):void 0}),this.handleSessionMetadataUpdated(t.metadata);break;case"Event":this.handleIncomingEvent(t)}void 0!==t.id&&(null===(s=this.requestResolutions.get(t.id))||void 0===s||s(t))})),this.ws=i,this.http=new Ie.WalletLinkHTTP(t,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");null===(e=this.diagnostic)||void 0===e||e.log(Me.EVENTS.STARTED_CONNECTING,{sessionIdHash:Ce.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),null===(e=this.diagnostic)||void 0===e||e.log(Me.EVENTS.DISCONNECTED,{sessionIdHash:Ce.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t,r;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this)),null===(r=this.listener)||void 0===r||r.connectedUpdated(e)}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(r=this.listener)||void 0===r||r.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t,r;if("Event"===e.type&&"Web3Response"===e.event)try{const r=await this.cipher.decrypt(e.data),n=JSON.parse(r);if("WEB3_RESPONSE"!==n.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(n)}catch(n){null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(r);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,r=!1){const n=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:n,callWebhook:r};return this.setOnceLinked((async()=>{const e=await this.makeRequest(s);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const r=e.id;let n;return this.sendData(e),Promise.race([new Promise(((e,s)=>{n=window.setTimeout((()=>{s(new Error(`request ${r} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(r,(t=>{clearTimeout(n),e(t),this.requestResolutions.delete(r)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var xe={},Ae={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.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 Oe=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.injectCssReset=void 0;const Pe=Oe(Ne);Ae.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Pe.default)),document.documentElement.appendChild(e)};var Le,Te,je,Be,De,Fe,$e,Ue,He,Ve,qe,We,ze={},Je={},Ge=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;function Ye(e,t){for(var r in t)e[r]=t[r];return e}function Ke(e){var t=e.parentNode;t&&t.removeChild(e)}function Xe(e,t,r){var n,s,i,o={};for(i in t)"key"==i?n=t[i]:"ref"==i?s=t[i]:o[i]=t[i];if(arguments.length>2&&(o.children=arguments.length>3?Le.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===o[i]&&(o[i]=e.defaultProps[i]);return et(e,o,n,s,null)}function et(e,t,r,n,s){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++je:s,__i:-1,__u:0};return null==s&&null!=Te.vnode&&Te.vnode(i),i}function tt(e){return e.children}function rt(e,t){this.props=e,this.context=t}function nt(e,t){if(null==t)return e.__?nt(e.__,e.__i+1):null;for(var r;tt&&De.sort(Ue));ot.__r=0}function at(e,t,r,n,s,i,o,a,c,l,u){var h,d,p,f,m,g=n&&n.__k||Ge,v=t.length;for(r.__d=c,function(e,t,r){var n,s,i,o,a,c=t.length,l=r.length,u=l,h=0;for(e.__k=[],n=0;n0?et(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,a=lt(s,r,o,u),s.__i=a,i=null,-1!==a&&(u--,(i=r[a])&&(i.__u|=131072)),null==i||null===i.__v?(-1==a&&h--,"function"!=typeof s.type&&(s.__u|=65536)):a!==o&&(a===o+1?h++:a>o?u>c-o?h+=a-o:h--:a(null==c||131072&c.__u?0:1))for(;o>=0||a=0){if((c=t[o])&&!(131072&c.__u)&&s==c.key&&i===c.type)return o;o--}if(a2&&(a.children=arguments.length>3?Le.call(arguments,2):r),et(e.type,a,n||e.key,s||e.ref,null)},createContext:function(e,t){var r={__c:t="__cC"+We++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var r,n;return this.getChildContext||(r=[],(n={})[t]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&r.some((function(e){e.__e=!0,it(e)}))},this.sub=function(e){r.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r.splice(r.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Provider.__=r.Consumer.contextType=r},createElement:Xe,createRef:function(){return{current:null}},h:Xe,hydrate:function e(t,r){yt(t,r,e)},get isValidElement(){return Be},get options(){return Te},render:yt,toChildArray:function e(t,r){return r=r||[],null==t||"boolean"==typeof t||(Qe(t)?t.some((function(t){e(t,r)})):r.push(t)),r}},Symbol.toStringTag,{value:"Module"})),_t=t(wt);var bt,Et,kt,Mt,St={},Ct=0,It=[],Rt=[],xt=Te,At=xt.__b,Nt=xt.__r,Ot=xt.diffed,Pt=xt.__c,Lt=xt.unmount,Tt=xt.__;function jt(e,t){xt.__h&&xt.__h(Et,e,Ct||t),Ct=0;var r=Et.__H||(Et.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:Rt}),r.__[e]}function Bt(e){return Ct=1,Dt(Jt,e)}function Dt(e,t,r){var n=jt(bt++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Jt(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=Et,!Et.u)){var s=function(e,t,r){if(!n.__c.__H)return!0;var s=n.__c.__H.__.filter((function(e){return!!e.__c}));if(s.every((function(e){return!e.__N})))return!i||i.call(this,e,t,r);var o=!1;return s.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),!(!o&&n.__c.props===e)&&(!i||i.call(this,e,t,r))};Et.u=!0;var i=Et.shouldComponentUpdate,o=Et.componentWillUpdate;Et.componentWillUpdate=function(e,t,r){if(this.__e){var n=i;i=void 0,s(e,t,r),i=n}o&&o.call(this,e,t,r)},Et.shouldComponentUpdate=s}return n.__N||n.__}function Ft(e,t){var r=jt(bt++,4);!xt.__s&&zt(r.__H,t)&&(r.__=e,r.i=t,Et.__h.push(r))}function $t(e,t){var r=jt(bt++,7);return zt(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Ut(){for(var e;e=It.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(qt),e.__H.__h.forEach(Wt),e.__H.__h=[]}catch(t){e.__H.__h=[],xt.__e(t,e.__v)}}xt.__b=function(e){Et=null,At&&At(e)},xt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Tt&&Tt(e,t)},xt.__r=function(e){Nt&&Nt(e),bt=0;var t=(Et=e.__c).__H;t&&(kt===Et?(t.__h=[],Et.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Rt,e.__N=e.i=void 0}))):(t.__h.forEach(qt),t.__h.forEach(Wt),t.__h=[],bt=0)),kt=Et},xt.diffed=function(e){Ot&&Ot(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==It.push(t)&&Mt===xt.requestAnimationFrame||((Mt=xt.requestAnimationFrame)||Vt)(Ut)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Rt&&(e.__=e.__V),e.i=void 0,e.__V=Rt}))),kt=Et=null},xt.__c=function(e,t){t.some((function(e){try{e.__h.forEach(qt),e.__h=e.__h.filter((function(e){return!e.__||Wt(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],xt.__e(r,e.__v)}})),Pt&&Pt(e,t)},xt.unmount=function(e){Lt&&Lt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach((function(e){try{qt(e)}catch(r){t=r}})),r.__H=void 0,t&&xt.__e(t,r.__v))};var Ht="function"==typeof requestAnimationFrame;function Vt(e){var t,r=function(){clearTimeout(n),Ht&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Ht&&(t=requestAnimationFrame(r))}function qt(e){var t=Et,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),Et=t}function Wt(e){var t=Et;e.__c=e.__(),Et=t}function zt(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Jt(e,t){return"function"==typeof t?t(e):t}const Gt=Object.freeze(Object.defineProperty({__proto__:null,useCallback:function(e,t){return Ct=8,$t((function(){return e}),t)},useContext:function(e){var t=Et.context[e.__c],r=jt(bt++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(Et)),t.props.value):e.__},useDebugValue:function(e,t){xt.useDebugValue&&xt.useDebugValue(t?t(e):e)},useEffect:function(e,t){var r=jt(bt++,3);!xt.__s&&zt(r.__H,t)&&(r.__=e,r.i=t,Et.__H.__h.push(r))},useErrorBoundary:function(e){var t=jt(bt++,10),r=Bt();return t.__=e,Et.componentDidCatch||(Et.componentDidCatch=function(e,n){t.__&&t.__(e,n),r[1](e)}),[r[0],function(){r[1](void 0)}]},useId:function(){var e=jt(bt++,11);if(!e.__){for(var t=Et.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__},useImperativeHandle:function(e,t,r){Ct=6,Ft((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==r?r:r.concat(e))},useLayoutEffect:Ft,useMemo:$t,useReducer:Dt,useRef:function(e){return Ct=5,$t((function(){return{current:e}}),[])},useState:Bt},Symbol.toStringTag,{value:"Module"})),Zt=t(Gt);var Qt={},Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.CloseIcon=void 0;const Kt=_t;Yt.CloseIcon=function(e){return(0,Kt.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,Kt.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"}))};var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.CoinbaseWalletRound=void 0;const er=_t;Xt.CoinbaseWalletRound=function(e){return(0,er.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,er.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,er.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,er.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"}))};var tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.QRCodeIcon=void 0;const rr=_t;tr.QRCodeIcon=function(e){return(0,rr.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),(0,rr.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,rr.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,rr.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,rr.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))};var nr={};function sr(e){this.mode=or.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t65536?(n[0]=240|(1835008&s)>>>18,n[1]=128|(258048&s)>>>12,n[2]=128|(4032&s)>>>6,n[3]=128|63&s):s>2048?(n[0]=224|(61440&s)>>>12,n[1]=128|(4032&s)>>>6,n[2]=128|63&s):s>128?(n[0]=192|(1984&s)>>>6,n[1]=128|63&s):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function ir(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}sr.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=ir.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||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=wr.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var s=0;s>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&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=wr.getBCHTypeInfo(r),s=0;s<15;s++){var i=!e&&1==(n>>s&1);s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(s=0;s<15;s++){i=!e&&1==(n>>s&1);s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(6==o&&o--;;){for(var a=0;a<2;a++)if(null==this.modules[n][o-a]){var c=!1;i>>s&1)),wr.getMask(t,n,o-a)&&(c=!c),this.modules[n][o-a]=c,-1==--s&&(i++,s=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},ir.PAD0=236,ir.PAD1=17,ir.createData=function(e,t,r){for(var n=kr.getRSBlocks(e,t),s=new Mr,i=0;i8*a)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*a+")");for(s.getLengthInBits()+4<=8*a&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=8*a||(s.put(ir.PAD0,8),s.getLengthInBits()>=8*a));)s.put(ir.PAD1,8);return ir.createBytes(s,n)},ir.createBytes=function(e,t){for(var r=0,n=0,s=0,i=new Array(t.length),o=new Array(t.length),a=0;a=0?d.get(p):0}}var f=0;for(u=0;u=0;)t^=wr.G15<=0;)t^=wr.G18<>>=1;return t},getPatternPosition:function(e){return wr.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case hr:return(t+r)%2==0;case dr:return t%2==0;case pr:return r%3==0;case fr:return(t+r)%3==0;case mr:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case gr:return t*r%2+t*r%3==0;case vr:return(t*r%2+t*r%3)%2==0;case yr:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Er([1],0),r=0;r5&&(r+=3+i-5)}for(n=0;n=256;)e-=255;return _r.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},br=0;br<8;br++)_r.EXP_TABLE[br]=1<>>7-e%8&1)},put:function(e,t){for(var r=0;r>>t-r-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 Sr=[[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 Cr(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)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!");var r=this.options.content,n=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,s=0,i=0,o=Sr.length;i<=o;i++){var a=Sr[i];if(!a)throw new Error("Content too long: expected "+s+" but got "+r);switch(t){case"L":s=a[0];break;case"M":s=a[1];break;case"Q":s=a[2];break;case"H":s=a[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=s)break;n++}if(n>Sr.length)throw new Error("Content too long");return n}(r,this.options.ecl),s=function(e){switch(e){case"L":return ar;case"M":return cr;case"Q":return lr;case"H":return ur;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new ir(n,s),this.qrcode.addData(r),this.qrcode.make()}Cr.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,s=n?" ":"",i=n?"\r\n":"",o=t.width,a=t.height,c=r.length,l=o/(c+2*t.padding),u=a/(c+2*t.padding),h=void 0!==t.join&&!!t.join,d=void 0!==t.swap&&!!t.swap,p=void 0===t.xmlDeclaration||!!t.xmlDeclaration,f=void 0!==t.predefined&&!!t.predefined,m=f?s+''+i:"",g=s+''+i,v="",y="",w=0;w'+i:s+''+i}}h&&(v=s+'');let C="";if(void 0!==this.options.image&&this.options.image.svg){const e=o*this.options.image.width/100,t=a*this.options.image.height/100;C+=``,C+=this.options.image.svg+i,C+=""}var I="";switch(e.container){case"svg":p&&(I+=''+i),I+=''+i,I+=m+g+v,I+=C,I+="";break;case"svg-viewbox":p&&(I+=''+i),I+=''+i,I+=m+g+v,I+=C,I+="";break;case"g":I+=''+i,I+=m+g+v,I+=C,I+="";break;default:I+=(m+g+v+C).replace(/^\s+/,"")}return I};var Ir=Cr,Rr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nr,"__esModule",{value:!0}),nr.QRCode=void 0;const xr=_t,Ar=Zt,Nr=Rr(Ir);nr.QRCode=e=>{const[t,r]=(0,Ar.useState)("");return(0,Ar.useEffect)((()=>{var t,n;const s=new Nr.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:null!==(t=e.width)&&void 0!==t?t:256,height:null!==(n=e.height)&&void 0!==n?n:256,padding:0,image:e.image}),i=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${i}`)}),[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,xr.h)("img",{src:t,alt:"QR Code"}):null};var Or={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.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 Lr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Or,"__esModule",{value:!0}),Or.Spinner=void 0;const Tr=_t,jr=Lr(Pr);Or.Spinner=e=>{var t;const r=null!==(t=e.size)&&void 0!==t?t:64,n=e.color||"#000";return(0,Tr.h)("div",{class:"-cbwsdk-spinner"},(0,Tr.h)("style",null,jr.default),(0,Tr.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Tr.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.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 Dr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.CoinbaseWalletSteps=Qt.ConnectContent=void 0;const Fr=Dr(o),$r=_t,Ur=d,Hr=R,Vr=Yt,qr=Xt,Wr=tr,zr=nr,Jr=Or,Gr=Dr(Br),Zr="Coinbase Wallet app",Qr="Connect with your self-custody wallet",Yr=en,Kr=e=>"light"===e?"#FFFFFF":"#0A0B0D";function Xr({title:e,description:t,theme:r}){return(0,$r.h)("div",{className:(0,Fr.default)("-cbwsdk-connect-item",r)},(0,$r.h)("div",null,(0,$r.h)(qr.CoinbaseWalletRound,null)),(0,$r.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,$r.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,$r.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function en({theme:e}){return(0,$r.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,$r.h)("li",{className:(0,Fr.default)("-cbwsdk-wallet-steps-item",e)},(0,$r.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,$r.h)("li",{className:(0,Fr.default)("-cbwsdk-wallet-steps-item",e)},(0,$r.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,$r.h)("span",null,"Tap ",(0,$r.h)("strong",null,"Scan")," "),(0,$r.h)("span",{className:(0,Fr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,$r.h)(Wr.QRCodeIcon,{fill:Kr(e)})))))}Qt.ConnectContent=function(e){const{theme:t}=e,r=(0,Ur.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=Yr;return(0,$r.h)("div",{"data-testid":"connect-content",className:(0,Fr.default)("-cbwsdk-connect-content",t)},(0,$r.h)("style",null,Gr.default),(0,$r.h)("div",{className:"-cbwsdk-connect-content-header"},(0,$r.h)("h2",{className:(0,Fr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,$r.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,$r.h)(Vr.CloseIcon,{fill:"light"===t?"#0A0B0D":"#FFFFFF"}))),(0,$r.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,$r.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,$r.h)(Xr,{title:Zr,description:Qr,theme:t})),(0,$r.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,$r.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,$r.h)(zr.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,$r.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Hr.LIB_VERSION}),(0,$r.h)("input",{type:"hidden",value:r})),(0,$r.h)(n,{theme:t}),!e.isConnected&&(0,$r.h)("div",{"data-testid":"connecting-spinner",className:(0,Fr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,$r.h)(Jr.Spinner,{size:36,color:"dark"===t?"#FFF":"#000"}),(0,$r.h)("p",null,"Connecting...")))))},Qt.CoinbaseWalletSteps=en;var tn={},rn={};Object.defineProperty(rn,"__esModule",{value:!0}),rn.ArrowLeftIcon=void 0;const nn=_t;rn.ArrowLeftIcon=function(e){return(0,nn.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,nn.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"}))};var sn={};Object.defineProperty(sn,"__esModule",{value:!0}),sn.LaptopIcon=void 0;const on=_t;sn.LaptopIcon=function(e){return(0,on.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,on.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,on.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"}))};var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.SafeIcon=void 0;const cn=_t;an.SafeIcon=function(e){return(0,cn.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,cn.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"}))};var ln={};Object.defineProperty(ln,"__esModule",{value:!0}),ln.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 un=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tn,"__esModule",{value:!0}),tn.TryExtensionContent=void 0;const hn=un(o),dn=_t,pn=Zt,fn=rn,mn=sn,gn=an,vn=un(ln);tn.TryExtensionContent=function({theme:e}){const[t,r]=(0,pn.useState)(!1),n=(0,pn.useCallback)((()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")}),[]),s=(0,pn.useCallback)((()=>{t?window.location.reload():(n(),r(!0))}),[n,t]);return(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension",e)},(0,dn.h)("style",null,vn.default),(0,dn.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,dn.h)("h3",{class:(0,hn.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,dn.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,dn.h)("button",{class:(0,hn.default)("-cbwsdk-try-extension-cta",e),onClick:s},t?"Refresh":"Install"),(0,dn.h)("div",null,!t&&(0,dn.h)(fn.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:"light"===e?"#0052FF":"#588AF5"})))),(0,dn.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,dn.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,dn.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,dn.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,dn.h)("span",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,dn.h)(mn.LaptopIcon,{fill:"light"===e?"#0A0B0D":"#FFFFFF"}))),(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,dn.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,dn.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,dn.h)("span",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,dn.h)(gn.SafeIcon,{fill:"light"===e?"#0A0B0D":"#FFFFFF"}))),(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))};var yn={};Object.defineProperty(yn,"__esModule",{value:!0}),yn.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 wn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(St,"__esModule",{value:!0}),St.ConnectDialog=void 0;const _n=wn(o),bn=_t,En=Zt,kn=Qt,Mn=tn,Sn=wn(yn);St.ConnectDialog=e=>{const{isOpen:t,darkMode:r}=e,[n,s]=(0,En.useState)(!t),[i,o]=(0,En.useState)(!t);(0,En.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!t)}),10)];return t?s(!1):e.push(window.setTimeout((()=>{s(!0)}),360)),()=>{e.forEach(window.clearTimeout)}}),[t]);const a=r?"dark":"light";return(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,bn.h)("style",null,Sn.default),(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-backdrop",a,i&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,bn.h)("div",{class:"-cbwsdk-connect-dialog"},(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-box",i&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,bn.h)(kn.ConnectContent,{theme:a,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,bn.h)(Mn.TryExtensionContent,{theme:a}))))},Object.defineProperty(ze,"__esModule",{value:!0}),ze.LinkFlow=void 0;const Cn=_t,In=St;ze.LinkFlow=class{constructor(e){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=e.darkMode,this.version=e.version,this.sessionId=e.sessionId,this.sessionSecret=e.sessionSecret,this.linkAPIUrl=e.linkAPIUrl,this.isParentConnection=e.isParentConnection}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",e.appendChild(this.root),this.render()}setConnected(e){this.connected!==e&&(this.connected=e,this.render())}setChainId(e){this.chainId!==e&&(this.chainId=e,this.render())}detach(){var e;this.root&&((0,Cn.render)(null,this.root),null===(e=this.root.parentElement)||void 0===e||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,Cn.render)((0,Cn.h)(In.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)}};var Rn={},xn={};Object.defineProperty(xn,"__esModule",{value:!0}),xn.default=(()=>".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}")(),function(t){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const n=r(o),s=_t,i=Zt,a=r(xn);t.Snackbar=class{constructor(e){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=e.darkMode}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,s.render)((0,s.h)("div",null,(0,s.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,r])=>(0,s.h)(t.SnackbarInstance,Object.assign({},r,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-container")},(0,s.h)("style",null,a.default),(0,s.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:r})=>{const[o,a]=(0,i.useState)(!0),[c,l]=(0,i.useState)(null!=e&&e);(0,i.useEffect)((()=>{const e=[window.setTimeout((()=>{a(!1)}),1),window.setTimeout((()=>{l(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance",o&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{l(!c)}},(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,s.h)("div",{class:"-gear-container"},!c&&(0,s.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map(((e,t)=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,s.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,s.h)("span",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(Rn),Object.defineProperty(xe,"__esModule",{value:!0}),xe.WalletLinkRelayUI=void 0;const An=Ae,Nn=ze,On=Rn;xe.WalletLinkRelayUI=class{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new On.Snackbar({darkMode:e.darkMode}),this.linkFlow=new Nn.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.linkFlow.attach(t),this.snackbar.attach(t),this.attached=!0,(0,An.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return null!==(e=this.standalone)&&void 0!==e&&e}},Object.defineProperty(se,"__esModule",{value:!0}),se.WalletLinkRelay=void 0;const Pn=m,Ln=T,Tn=d,jn=ie,Bn=oe,Dn=ce,Fn=me,$n=I,Un=xe;class Hn extends Bn.RelayAbstract{constructor(e){var t;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{var t;this.isLinked=e;const r=this.storage.getItem(Bn.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this.session.linked=e),this.isUnlinkedErrorState=!1,r){const n=r.split(" "),s="true"===this.storage.getItem("IsStandaloneSigning");if(""!==n[0]&&!e&&this.session.linked&&!s){this.isUnlinkedErrorState=!0;const e=this.getSessionIdHash();null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:e})}}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),Hn.accountRequestCallbackIds.size>0&&(Array.from(Hn.accountRequestCallbackIds.values()).forEach((t=>{const r={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},r),{id:t}))})),Hn.accountRequestCallbackIds.clear())},this.connectedUpdated=e=>{this.ui.setConnected(e)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:r,ui:n,connection:s}=this.subscribe();this._session=r,this.connection=s,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=null===(t=e.reloadOnDisconnect)||void 0===t||t,this.ui=n}subscribe(){const e=Dn.Session.load(this.storage)||new Dn.Session(this.storage).save(),{linkAPIUrl:t,diagnostic:r}=this,n=new Fn.WalletLinkConnection({session:e,linkAPIUrl:t,diagnostic:r,listener:this}),{version:s,darkMode:i}=this.options,o=this.options.uiConstructor({linkAPIUrl:t,version:s,darkMode:i,session:e});return n.connect(),{session:e,ui:o,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{var e,t;const r=this.ui.isStandalone();null===(e=this.diagnostic)||void 0===e||e.log(jn.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const n=Dn.Session.load(this.storage);if((null==n?void 0:n.id)===this._session.id?this.storage.clear():n&&(null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Dn.Session.hash(n.id)})),this._reloadOnDisconnect)return void this.ui.reloadUI();this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:i,connection:o}=this.subscribe();this._session=s,this.connection=o,this.ui=i,r&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()})).catch((e=>{var t;null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,n){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Tn.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:n||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Tn.hexStringFromBuffer)(e,!0),signature:(0,Tn.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Tn.bigIntStringFromBN)(e.weiValue),data:(0,Tn.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,Tn.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Tn.bigIntStringFromBN)(e.weiValue),data:(0,Tn.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,Tn.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,Tn.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,Tn.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Tn.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,Tn.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,Tn.randomBytesHex)(8),n=n=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,n),null==t||t()};return{promise:new Promise(((s,i)=>{this.ui.isStandalone()||(t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:n,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(r,(e=>{if(null==t||t(),(0,$n.isErrorResponse)(e))return i(new Error(e.errorMessage));s(e)})),this.ui.isStandalone()?this.sendRequestStandalone(r,e):this.publishWeb3RequestEvent(r,e)})),cancel:n}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof Un.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,t){var r;const n={type:"WEB3_REQUEST",id:e,request:t},s=Dn.Session.load(this.storage);null===(r=this.diagnostic)||void 0===r||r.log(jn.EVENTS.WEB3_REQUEST,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Dn.Session.hash(s.id):"",isSessionMismatched:((null==s?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",n,!0).then((e=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(jn.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Dn.Session.hash(s.id):"",isSessionMismatched:((null==s?void 0:s.id)!==this._session.id).toString()})})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})}))}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){var t;const{response:r}=e;if(null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash()}),"requestEthereumAccounts"===r.method)return Hn.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void Hn.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,r,n){var s;const i=null!==(s=null==r?void 0:r.message)&&void 0!==s?s:(0,Pn.getMessageFromCode)(n);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i,errorCode:n}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,Tn.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(t),this.handleErrorResponse(t,e.method,r)};return{promise:new Promise(((n,s)=>{if(this.relayEventManager.callbacks.set(t,(e=>{if(this.ui.hideRequestEthereumAccounts(),(0,$n.isErrorResponse)(e))return s(new Error(e.errorMessage));n(e)})),this.ui.inlineAccountsResponse()){const e=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:e}})};this.ui.requestEthereumAccounts({onCancel:r,onAccounts:e})}else{const e=Pn.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>r(e)})}Hn.accountRequestCallbackIds.add(t),this.ui.inlineAccountsResponse()||this.ui.isStandalone()||this.publishWeb3RequestEvent(t,e)})),cancel:r}}selectProvider(e){const t="selectProvider",r=(0,Tn.randomBytesHex)(8);return{cancel:e=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t,e)},promise:new Promise(((t,n)=>{this.relayEventManager.callbacks.set(r,(e=>{if((0,$n.isErrorResponse)(e))return n(new Error(e.errorMessage));t(e)}));this.ui.selectProvider&&this.ui.selectProvider({onApprove:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:e}})},onCancel:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:Ln.ProviderType.Unselected}})},providerOptions:e})}))}}watchAsset(e,t,r,n,s,i){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:n,image:s},chainId:i}};let a=null;const c=(0,Tn.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};this.ui.inlineWatchAsset()||(a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}));return{cancel:l,promise:new Promise(((l,u)=>{this.relayEventManager.callbacks.set(c,(e=>{if(null==a||a(),(0,$n.isErrorResponse)(e))return u(new Error(e.errorMessage));l(e)}));const h=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!1}})},d=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:d,onCancel:h,type:e,address:t,symbol:r,decimals:n,image:s,chainId:i}),this.ui.inlineWatchAsset()||this.ui.isStandalone()||this.publishWeb3RequestEvent(c,o)}))}}addEthereumChain(e,t,r,n,s,i){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:n,chainName:s,iconUrls:r,nativeCurrency:i}};let a=null;const c=(0,Tn.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};this.ui.inlineAddEthereumChain(e)||(a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}));return{promise:new Promise(((t,r)=>{this.relayEventManager.callbacks.set(c,(e=>{if(null==a||a(),(0,$n.isErrorResponse)(e))return r(new Error(e.errorMessage));t(e)}));const n=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},s=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:e}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:n,onApprove:s,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(e)||this.ui.isStandalone()||this.publishWeb3RequestEvent(c,o)})),cancel:l}}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},n=(0,Tn.randomBytesHex)(8);return{promise:new Promise(((t,s)=>{this.relayEventManager.callbacks.set(n,(e=>(0,$n.isErrorResponse)(e)&&e.errorCode?s(Pn.standardErrors.provider.custom({code:e.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,$n.isErrorResponse)(e)?s(new Error(e.errorMessage)):void t(e)));this.ui.switchEthereumChain({onCancel:t=>{var r;if(t){const s=null!==(r=(0,Pn.getErrorCode)(t))&&void 0!==r?r:Pn.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(n,"switchEthereumChain",t instanceof Error?t:Pn.standardErrors.provider.unsupportedChain(e),s)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},onApprove:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:e}}})},chainId:r.params.chainId,address:r.params.address}),this.ui.inlineSwitchEthereumChain()||this.ui.isStandalone()||this.publishWeb3RequestEvent(n,r)})),cancel:e=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,e)}}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return Dn.Session.hash(this._session.id)}sendRequestStandalone(e,t){const r=r=>{this.handleErrorResponse(e,t.method,r)},n=t=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:t})};switch(t.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:t,onSuccess:n,onCancel:r});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:t,onSuccess:n,onCancel:r});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:t,onSuccess:n,onCancel:r});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:t,onSuccess:n});break;default:r()}}}se.WalletLinkRelay=Hn,Hn.accountRequestCallbackIds=new Set;var Vn,qn,Wn,zn={},Jn={},Gn={};Vn=Gn,qn=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),Wn=e&&e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||qn(t,e,r)},Object.defineProperty(Vn,"__esModule",{value:!0}),Wn(Rn,Vn);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.default=(()=>".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}")();var Qn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.RedirectDialog=void 0;const Yn=Qn(o),Kn=_t,Xn=Ae,es=Gn,ts=Qn(Zn);Jn.RedirectDialog=class{constructor(){this.root=null}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Xn.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Kn.render)(null,this.root),e&&(0,Kn.render)((0,Kn.h)(rs,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}};const rs=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:s})=>{const i=r?"dark":"light";return(0,Kn.h)(es.SnackbarContainer,{darkMode:r},(0,Kn.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Kn.h)("style",null,ts.default),(0,Kn.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Kn.h)("div",{class:(0,Yn.default)("-cbwsdk-redirect-dialog-box",i)},(0,Kn.h)("p",null,e),(0,Kn.h)("button",{onClick:n},t))))};Object.defineProperty(zn,"__esModule",{value:!0}),zn.MobileRelayUI=void 0;const ns=Jn;zn.MobileRelayUI=class{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new ns.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const t=new URL("https://go.cb-w.com/walletlink");t.searchParams.append("redirect_url",window.location.href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}},Object.defineProperty(ne,"__esModule",{value:!0}),ne.MobileRelay=void 0;const ss=d,is=se,os=zn;class as extends is.WalletLinkRelay{constructor(e){var t;super(e),this._enableMobileWalletLink=null!==(t=e.enableMobileWalletLink)&&void 0!==t&&t}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise((()=>{const e=(0,ss.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`})),cancel:()=>{}}}publishWeb3RequestEvent(e,t){if(super.publishWeb3RequestEvent(e,t),!(this._enableMobileWalletLink&&this.ui instanceof os.MobileRelayUI))return;let r=!1;switch(t.method){case"requestEthereumAccounts":case"connectAndSignIn":r=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:r=!0,this.ui.openCoinbaseWalletDeeplink()}r&&window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:(new Date).toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}ne.MobileRelay=as;const cs=a,ls=f;function us(e){return Buffer.allocUnsafe(e).fill(0)}function hs(e,t,r){const n=us(t);return e=ds(e),r?e.lengthr)throw new Error("Elements exceed array size: "+r);for(i in s=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)s.push(ks(e,t[i]));if("dynamic"===r){var o=ks("uint256",t.length);s.unshift(o)}return Buffer.concat(s)}if("bytes"===e)return t=new Buffer(t),s=Buffer.concat([ks("uint256",t.length),t]),t.length%32!=0&&(s=Buffer.concat([s,gs.zeros(32-t.length%32)])),s;if(e.startsWith("bytes")){if((r=ws(e))<1||r>32)throw new Error("Invalid bytes width: "+r);return gs.setLengthRight(t,32)}if(e.startsWith("uint")){if((r=ws(e))%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if((n=Es(t)).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)}if(e.startsWith("int")){if((r=ws(e))%8||r<8||r>256)throw new Error("Invalid int width: "+r);if((n=Es(t)).bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}if(e.startsWith("ufixed")){if(r=_s(e),(n=Es(t))<0)throw new Error("Supplied ufixed is negative");return ks("uint256",n.mul(new vs(2).pow(new vs(r[1]))))}if(e.startsWith("fixed"))return r=_s(e),ks("int256",Es(t).mul(new vs(2).pow(new vs(r[1]))));throw new Error("Unsupported or invalid type: "+e)}function Ms(e){return"string"===e||"bytes"===e||"dynamic"===bs(e)}function Ss(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,s=[],i=0;i32)throw new Error("Invalid bytes width: "+r);s.push(gs.setLengthRight(a,r))}else if(o.startsWith("uint")){if((r=ws(o))%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if((n=Es(a)).bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());s.push(n.toArrayLike(Buffer,"be",r/8))}else{if(!o.startsWith("int"))throw new Error("Unsupported or invalid type: "+o);if((r=ws(o))%8||r<8||r>256)throw new Error("Invalid int width: "+r);if((n=Es(a)).bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());s.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}}return Buffer.concat(s)}var Cs={rawEncode:function(e,t){var r=[],n=[],s=32*e.length;for(var i in e){var o=ys(e[i]),a=ks(o,t[i]);Ms(o)?(r.push(ks("uint256",s)),n.push(a),s+=a.length):r.push(a)}return Buffer.concat(r.concat(n))},solidityPack:Ss,soliditySHA3:function(e,t){return gs.keccak(Ss(e,t))}};const Is=ms,Rs=Cs,xs={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"]},As={encodeData(e,t,r,n=!0){const s=["bytes32"],i=[this.hashType(e,r)];if(n){const o=(e,t,s)=>{if(void 0!==r[t])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":Is.keccak(this.encodeData(t,s,r,n))];if(void 0===s)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",Is.keccak(s)];if("string"===t)return"string"==typeof s&&(s=Buffer.from(s,"utf8")),["bytes32",Is.keccak(s)];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),n=s.map((t=>o(e,r,t)));return["bytes32",Is.keccak(Rs.rawEncode(n.map((([e])=>e)),n.map((([,e])=>e))))]}return[t,s]};for(const n of r[e]){const[e,r]=o(n.name,n.type,t[n.name]);s.push(e),i.push(r)}}else for(const o of r[e]){let e=t[o.name];if(void 0!==e)if("bytes"===o.type)s.push("bytes32"),e=Is.keccak(e),i.push(e);else if("string"===o.type)s.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=Is.keccak(e),i.push(e);else if(void 0!==r[o.type])s.push("bytes32"),e=Is.keccak(this.encodeData(o.type,e,r,n)),i.push(e);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),i.push(e)}}return Rs.rawEncode(s,i)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter((t=>t!==e));n=[e].concat(n.sort());for(const s of n){if(!t[s])throw new Error("No type definition specified: "+s);r+=s+"("+t[s].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||void 0===t[e])return r;r.push(e);for(const n of t[e])for(const e of this.findTypeDependencies(n.type,t,r))!r.includes(e)&&r.push(e);return r},hashStruct(e,t,r,n=!0){return Is.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return Is.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in xs.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),"EIP712Domain"!==r.primaryType&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),Is.keccak(Buffer.concat(n))}};var Ns={TYPED_MESSAGE_SCHEMA:xs,TypedDataUtils:As,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const r=e.map((function(e){return"bytes"===e.type?Is.toBuffer(e.value):e.value})),n=e.map((function(e){return e.type})),s=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Rs.soliditySHA3(["bytes32","bytes32"],[Rs.soliditySHA3(new Array(e.length).fill("string"),s),Rs.soliditySHA3(n,r)])}(e.data)},hashForSignTypedData_v3:function(e){return As.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return As.hash(e.data)}};var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.filterFromParam=Os.FilterPolyfill=void 0;const Ps=T,Ls=d,Ts={jsonrpc:"2.0",id:0};function js(e){return{fromBlock:Ds(e.fromBlock),toBlock:Ds(e.toBlock),addresses:void 0===e.address?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}function Bs(e){const t={fromBlock:Fs(e.fromBlock),toBlock:Fs(e.toBlock),topics:e.topics};return null!==e.addresses&&(t.address=e.addresses),t}function Ds(e){if(void 0===e||"latest"===e||"pending"===e)return"latest";if("earliest"===e)return(0,Ps.IntNumber)(0);if((0,Ls.isHexString)(e))return(0,Ls.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function Fs(e){return"latest"===e?e:(0,Ls.hexStringFromIntNumber)(e)}function $s(){return Object.assign(Object.assign({},Ts),{error:{code:-32e3,message:"filter not found"}})}function Us(){return Object.assign(Object.assign({},Ts),{result:[]})}Os.FilterPolyfill=class{constructor(e){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,Ps.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const t=js(e),r=this.makeFilterId(),n=await this.setInitialCursorPosition(r,t.fromBlock);return console.info(`Installing new log filter(${r}):`,t,"initial cursor position:",n),this.logFilters.set(r,t),this.setFilterTimeout(r),(0,Ls.hexStringFromIntNumber)(r)}async newBlockFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.blockFilters.add(e),this.setFilterTimeout(e),(0,Ls.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,Ls.hexStringFromIntNumber)(e)}uninstallFilter(e){const t=(0,Ls.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${t})`),this.deleteFilter(t),!0}getFilterChanges(e){const t=(0,Ls.intNumberFromHexString)(e);return this.timeouts.has(t)&&this.setFilterTimeout(t),this.logFilters.has(t)?this.getLogFilterChanges(t):this.blockFilters.has(t)?this.getBlockFilterChanges(t):this.pendingTransactionFilters.has(t)?this.getPendingTransactionFilterChanges(t):Promise.resolve($s())}async getFilterLogs(e){const t=(0,Ls.intNumberFromHexString)(e),r=this.logFilters.get(t);return r?this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getLogs",params:[Bs(r)]})):$s()}makeFilterId(){return(0,Ps.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise(((t,r)=>{this.provider.sendAsync(e,((e,n)=>e?r(e):Array.isArray(n)||null==n?r(new Error(`unexpected response received: ${JSON.stringify(n)}`)):void t(n)))}))}deleteFilter(e){console.info(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const t=this.logFilters.get(e),r=this.cursors.get(e);if(!r||!t)return $s();const n=await this.getCurrentBlockHeight(),s="latest"===t.toBlock?n:t.toBlock;if(r>n)return Us();if(r>Number(t.toBlock))return Us();console.info(`Fetching logs from ${r} to ${s} for filter ${e}`);const i=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getLogs",params:[Bs(Object.assign(Object.assign({},t),{fromBlock:r,toBlock:s}))]}));if(Array.isArray(i.result)){const t=i.result.map((e=>(0,Ls.intNumberFromHexString)(e.blockNumber||"0x0"))),n=Math.max(...t);if(n&&n>r){const t=(0,Ps.IntNumber)(n+1);console.info(`Moving cursor position for filter (${e}) from ${r} to ${t}`),this.cursors.set(e,t)}}return i}async getBlockFilterChanges(e){const t=this.cursors.get(e);if(!t)return $s();const r=await this.getCurrentBlockHeight();if(t>r)return Us();console.info(`Fetching blocks from ${t} to ${r} for filter (${e})`);const n=(await Promise.all((0,Ls.range)(t,r+1).map((e=>this.getBlockHashByNumber((0,Ps.IntNumber)(e)))))).filter((e=>!!e)),s=(0,Ps.IntNumber)(t+n.length);return console.info(`Moving cursor position for filter (${e}) from ${t} to ${s}`),this.cursors.set(e,s),Object.assign(Object.assign({},Ts),{result:n})}async getPendingTransactionFilterChanges(e){return Promise.resolve(Us())}async setInitialCursorPosition(e,t){const r=await this.getCurrentBlockHeight(),n="number"==typeof t&&t>r?t:r;return this.cursors.set(e,n),n}setFilterTimeout(e){const t=this.timeouts.get(e);t&&window.clearTimeout(t);const r=window.setTimeout((()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)}),3e5);this.timeouts.set(e,r)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const t=await this._getCurrentBlockHeight();this.currentBlockHeight=t,this.resolvers.forEach((e=>e(t))),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise((e=>this.resolvers.push(e)))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_blockNumber",params:[]}));return(0,Ls.intNumberFromHexString)((0,Ls.ensureHexString)(e))}async getBlockHashByNumber(e){const t=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getBlockByNumber",params:[(0,Ls.hexStringFromIntNumber)(e),!1]}));return t.result&&"string"==typeof t.result.hash?(0,Ls.ensureHexString)(t.result.hash):null}},Os.filterFromParam=js;var Hs={},Vs={},qs={},Ws=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}};const zs=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let e=0;e{t.errorFirst?n.push((function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e{throw n}))}}let Ys=class extends Zs.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const s=n[e];if(void 0===s)return!1;if("function"==typeof s)Qs(s,this,t);else{const e=s.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;ne+t,ti=["sync","latest"];class ri extends Xs.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._usePastBlocks=e.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){if(this._currentBlock)return this._currentBlock;return await new Promise((e=>this.once("latest",e)))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){ti.includes(e)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return ti.map((e=>this.listenerCount(e))).reduce(ei)}_shouldUseNewBlock(e){const t=this._currentBlock;if(!t)return!0;const r=ni(e),n=ni(t);return this._usePastBlocks&&rn}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}function ni(e){return Number.parseInt(e,16)}Js.BaseBlockTracker=ri;var si={},ii={},oi={};class ai extends TypeError{constructor(e,t){let r;const{message:n,explanation:s,...i}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(s??a),null!=s&&(this.cause=a),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function ci(e){return"object"==typeof e&&null!=e}function li(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function ui(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function hi(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:s,branch:i}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${ui(n)}\``}=e;return{value:n,type:o,refinement:a,key:s[s.length-1],path:s,branch:i,...e,message:c}}function*di(e,t,r,n){var s;ci(s=e)&&"function"==typeof s[Symbol.iterator]||(e=[e]);for(const i of e){const e=hi(i,t,r,n);e&&(yield e)}}function*pi(e,t,r={}){const{path:n=[],branch:s=[e],coerce:i=!1,mask:o=!1}=r,a={path:n,branch:s};if(i&&(e=t.coercer(e,a),o&&"type"!==t.type&&ci(t.schema)&&ci(e)&&!Array.isArray(e)))for(const l in e)void 0===t.schema[l]&&delete e[l];let c="valid";for(const l of t.validator(e,a))l.explanation=r.message,c="not_valid",yield[l,void 0];for(let[l,u,h]of t.entries(e,a)){const t=pi(u,h,{path:void 0===l?n:[...n,l],branch:void 0===l?s:[...s,u],coerce:i,mask:o,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):i&&(u=r[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):ci(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const l of t.refiner(e,a))l.explanation=r.message,c="not_refined",yield[l,void 0];"valid"===c&&(yield[void 0,e])}class fi{constructor(e){const{type:t,schema:r,validator:n,refiner:s,coercer:i=(e=>e),entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=i,this.validator=n?(e,t)=>di(n(e,t),t,this,e):()=>[],this.refiner=s?(e,t)=>di(s(e,t),t,this,e):()=>[]}assert(e,t){return mi(e,this,t)}create(e,t){return gi(e,this,t)}is(e){return yi(e,this)}mask(e,t){return vi(e,this,t)}validate(e,t={}){return wi(e,this,t)}}function mi(e,t,r){const n=wi(e,t,{message:r});if(n[0])throw n[0]}function gi(e,t,r){const n=wi(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function vi(e,t,r){const n=wi(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function yi(e,t){return!wi(e,t)[0]}function wi(e,t,r={}){const n=pi(e,t,r),s=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(s[0]){return[new ai(s[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,s[1]]}function _i(e,t){return new fi({type:e,schema:null,validator:t})}function bi(){return _i("never",(()=>!1))}function Ei(e){const t=e?Object.keys(e):[],r=bi();return new fi({type:"object",schema:e||null,*entries(n){if(e&&ci(n)){const s=new Set(Object.keys(n));for(const r of t)s.delete(r),yield[r,n[r],e[r]];for(const e of s)yield[e,n[e],r]}},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`,coercer:e=>ci(e)?{...e}:e})}function ki(e){return new fi({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Mi(){return _i("string",(e=>"string"==typeof e||`Expected a string, but received: ${ui(e)}`))}function Si(e){const t=Object.keys(e);return new fi({type:"type",schema:e,*entries(r){if(ci(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`,coercer:e=>ci(e)?{...e}:e})}function Ci(){return _i("unknown",(()=>!0))}function Ii(e,t,r){return new fi({...e,coercer:(n,s)=>yi(n,t)?e.coercer(r(n,s),s):e.coercer(n,s)})}function Ri(e){return e instanceof Map||e instanceof Set?e.size:e.length}function xi(e,t,r){return new fi({...e,*refiner(n,s){yield*e.refiner(n,s);const i=di(r(n,s),s,e,n);for(const e of i)yield{...e,refinement:t}}})}const Ai=Object.freeze(Object.defineProperty({__proto__:null,Struct:fi,StructError:ai,any:function(){return _i("any",(()=>!0))},array:function(e){return new fi({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ui(e)}`})},assert:mi,assign:function(...e){const t="type"===e[0].type,r=e.map((e=>e.schema)),n=Object.assign({},...r);return t?Si(n):Ei(n)},bigint:function(){return _i("bigint",(e=>"bigint"==typeof e))},boolean:function(){return _i("boolean",(e=>"boolean"==typeof e))},coerce:Ii,create:gi,date:function(){return _i("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ui(e)}`))},defaulted:function(e,t,r={}){return Ii(e,Ci(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&li(e)&&li(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},define:_i,deprecated:function(e,t){return new fi({...e,refiner:(t,r)=>void 0===t||e.refiner(t,r),validator:(r,n)=>void 0===r||(t(r,n),e.validator(r,n))})},dynamic:function(e){return new fi({type:"dynamic",schema:null,*entries(t,r){const n=e(t,r);yield*n.entries(t,r)},validator:(t,r)=>e(t,r).validator(t,r),coercer:(t,r)=>e(t,r).coercer(t,r),refiner:(t,r)=>e(t,r).refiner(t,r)})},empty:function(e){return xi(e,"empty",(t=>{const r=Ri(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},enums:function(e){const t={},r=e.map((e=>ui(e))).join();for(const n of e)t[n]=n;return new fi({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${r}\`, but received: ${ui(t)}`})},func:function(){return _i("func",(e=>"function"==typeof e||`Expected a function, but received: ${ui(e)}`))},instance:function(e){return _i("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ui(t)}`))},integer:function(){return _i("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ui(e)}`))},intersection:function(e){return new fi({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})},is:yi,lazy:function(e){let t;return new fi({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})},literal:function(e){const t=ui(e),r=typeof e;return new fi({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${ui(r)}`})},map:function(e,t){return new fi({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,s]of r.entries())yield[n,n,e],yield[n,s,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${ui(e)}`})},mask:vi,max:function(e,t,r={}){const{exclusive:n}=r;return xi(e,"max",(r=>n?rn?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},never:bi,nonempty:function(e){return xi(e,"nonempty",(t=>Ri(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},nullable:function(e){return new fi({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})},number:function(){return _i("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ui(e)}`))},object:Ei,omit:function(e,t){const{schema:r}=e,n={...r};for(const s of t)delete n[s];return"type"===e.type?Si(n):Ei(n)},optional:ki,partial:function(e){const t=e instanceof fi,r=t?{...e.schema}:{...e};for(const n in r)r[n]=ki(r[n]);return t&&"type"===e.type?Si(r):Ei(r)},pattern:function(e,t){return xi(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},pick:function(e,t){const{schema:r}=e,n={};for(const s of t)n[s]=r[s];return"type"===e.type?Si(n):Ei(n)},record:function(e,t){return new fi({type:"record",schema:null,*entries(r){if(ci(r))for(const n in r){const s=r[n];yield[n,n,e],yield[n,s,t]}},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`})},refine:xi,regexp:function(){return _i("regexp",(e=>e instanceof RegExp))},set:function(e){return new fi({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${ui(e)}`})},size:function(e,t,r=t){const n=`Expected a ${e.type}`,s=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return xi(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${s} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:i}=e;return t<=i&&i<=r||`${n} with a size ${s} but received one with a size of \`${i}\``}{const{length:i}=e;return t<=i&&i<=r||`${n} with a length ${s} but received one with a length of \`${i}\``}}))},string:Mi,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),_i(e,t)},trimmed:function(e){return Ii(e,Mi(),(e=>e.trim()))},tuple:function(e){const t=bi();return new fi({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let s=0;sArray.isArray(e)||`Expected an array, but received: ${ui(e)}`})},type:Si,union:function(e){const t=e.map((e=>e.type)).join(" | ");return new fi({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const s=[];for(const t of e){const[...e]=pi(r,t,n),[i]=e;if(!i[0])return[];for(const[t]of e)t&&s.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ui(r)}`,...s]}})},unknown:Ci,validate:wi},Symbol.toStringTag,{value:"Module"})),Ni=t(Ai);Object.defineProperty(oi,"__esModule",{value:!0}),oi.assertExhaustive=oi.assertStruct=oi.assert=oi.AssertionError=void 0;const Oi=Ni;function Pi(e,t){return r=e,Boolean("string"==typeof(null===(s=null===(n=null==r?void 0:r.prototype)||void 0===n?void 0:n.constructor)||void 0===s?void 0:s.name))?new e({message:t}):e({message:t});var r,n,s}class Li extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}oi.AssertionError=Li,oi.assert=function(e,t="Assertion failed.",r=Li){if(!e){if(t instanceof Error)throw t;throw Pi(r,t)}},oi.assertStruct=function(e,t,r="Assertion failed",n=Li){try{(0,Oi.assert)(e,t)}catch(s){throw Pi(n,`${r}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(s)}.`)}},oi.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")};var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.base64=void 0;const ji=Ni,Bi=oi;Ti.base64=(e,t={})=>{var r,n;const s=null!==(r=t.paddingRequired)&&void 0!==r&&r,i=null!==(n=t.characterSet)&&void 0!==n?n:"base64";let o,a;return"base64"===i?o=String.raw`[A-Za-z0-9+\/]`:((0,Bi.assert)("base64url"===i),o=String.raw`[-_A-Za-z0-9]`),a=s?new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,ji.pattern)(e,a)};var Di={},Fi={};!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=Ni,r=oi;function n(r){return(0,t.is)(r,e.HexStruct)}function s(r){return(0,t.is)(r,e.StrictHexStruct)}e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu),e.isHexString=n,e.isStrictHexString=s,e.assertIsHexString=function(e){(0,r.assert)(n(e),"Value must be a hexadecimal string.")},e.assertIsStrictHexString=function(e){(0,r.assert)(s(e),'Value must be a hexadecimal string, starting with "0x".')},e.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}(Fi),Object.defineProperty(Di,"__esModule",{value:!0}),Di.createDataView=Di.concatBytes=Di.valueToBytes=Di.stringToBytes=Di.numberToBytes=Di.signedBigIntToBytes=Di.bigIntToBytes=Di.hexToBytes=Di.bytesToString=Di.bytesToNumber=Di.bytesToSignedBigInt=Di.bytesToBigInt=Di.bytesToHex=Di.assertIsBytes=Di.isBytes=void 0;const $i=oi,Ui=Fi,Hi=48,Vi=58,qi=87;const Wi=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function zi(e){return e instanceof Uint8Array}function Ji(e){(0,$i.assert)(zi(e),"Value must be a Uint8Array.")}function Gi(e){if(Ji(e),0===e.length)return"0x";const t=Wi(),r=new Array(e.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");return Qi(e.toString(16))}function Ki(e){(0,$i.assert)("number"==typeof e,"Value must be a number."),(0,$i.assert)(e>=0,"Value must be a non-negative number."),(0,$i.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return Qi(e.toString(16))}function Xi(e){return(0,$i.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function eo(e){if("bigint"==typeof e)return Yi(e);if("number"==typeof e)return Ki(e);if("string"==typeof e)return e.startsWith("0x")?Qi(e):Xi(e);if(zi(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}Di.isBytes=zi,Di.assertIsBytes=Ji,Di.bytesToHex=Gi,Di.bytesToBigInt=Zi,Di.bytesToSignedBigInt=function(e){Ji(e);let t=BigInt(0);for(const r of e)t=(t<0,"Byte length must be greater than 0."),(0,$i.assert)(function(e,t){(0,$i.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let s=0;s>=BigInt(8);return n.reverse()},Di.numberToBytes=Ki,Di.stringToBytes=Xi,Di.valueToBytes=eo,Di.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let s=0;se.call(t,r,n,this)))}get(e){return wo(this,mo,"f").get(e)}has(e){return wo(this,mo,"f").has(e)}keys(){return wo(this,mo,"f").keys()}values(){return wo(this,mo,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}vo.FrozenMap=_o;class bo{constructor(e){go.set(this,void 0),yo(this,go,new Set(e),"f"),Object.freeze(this)}get size(){return wo(this,go,"f").size}[(go=new WeakMap,Symbol.iterator)](){return wo(this,go,"f")[Symbol.iterator]()}entries(){return wo(this,go,"f").entries()}forEach(e,t){return wo(this,go,"f").forEach(((r,n,s)=>e.call(t,r,n,this)))}has(e){return wo(this,go,"f").has(e)}keys(){return wo(this,go,"f").keys()}values(){return wo(this,go,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}vo.FrozenSet=bo,Object.freeze(_o),Object.freeze(_o.prototype),Object.freeze(bo),Object.freeze(bo.prototype);var Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var ko={};!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=Ni,r=oi;e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),(0,t.define)("finite number",(e=>(0,t.is)(e,(0,t.number)())&&Number.isFinite(e))),(0,t.string)(),(0,t.array)((0,t.lazy)((()=>e.UnsafeJsonStruct))),(0,t.record)((0,t.string)(),(0,t.lazy)((()=>e.UnsafeJsonStruct)))]),e.JsonStruct=(0,t.define)("Json",((t,r)=>{function n(e,t){const n=[...t.validator(e,r)];return!(n.length>0)||n}try{const r=n(t,e.UnsafeJsonStruct);return!0!==r?r:n(JSON.parse(JSON.stringify(t)),e.UnsafeJsonStruct)}catch(s){return s instanceof RangeError&&"Circular reference detected"}})),e.isValidJson=function(r){return(0,t.is)(r,e.JsonStruct)},e.getJsonSize=function(t){(0,r.assertStruct)(t,e.JsonStruct,"Invalid JSON value");const n=JSON.stringify(t);return(new TextEncoder).encode(n).byteLength},e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]),e.isJsonRpcNotification=function(r){return(0,t.is)(r,e.JsonRpcNotificationStruct)},e.assertIsJsonRpcNotification=function(t,n){(0,r.assertStruct)(t,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",n)},e.isJsonRpcRequest=function(r){return(0,t.is)(r,e.JsonRpcRequestStruct)},e.assertIsJsonRpcRequest=function(t,n){(0,r.assertStruct)(t,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",n)},e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]),e.isPendingJsonRpcResponse=function(r){return(0,t.is)(r,e.PendingJsonRpcResponseStruct)},e.assertIsPendingJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",n)},e.isJsonRpcResponse=function(r){return(0,t.is)(r,e.JsonRpcResponseStruct)},e.assertIsJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",n)},e.isJsonRpcSuccess=function(r){return(0,t.is)(r,e.JsonRpcSuccessStruct)},e.assertIsJsonRpcSuccess=function(t,n){(0,r.assertStruct)(t,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",n)},e.isJsonRpcFailure=function(r){return(0,t.is)(r,e.JsonRpcFailureStruct)},e.assertIsJsonRpcFailure=function(t,n){(0,r.assertStruct)(t,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",n)},e.isJsonRpcError=function(r){return(0,t.is)(r,e.JsonRpcErrorStruct)},e.assertIsJsonRpcError=function(t,n){(0,r.assertStruct)(t,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",n)},e.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)}}(ko);var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});var So,Co,Io={},Ro={exports:{}};function xo(){if(Co)return So;Co=1;var e=1e3,t=6e4,r=60*t,n=24*r,s=7*n,i=365.25*n;function o(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}return So=function(a,c){c=c||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===l&&isFinite(a))return c.long?function(s){var i=Math.abs(s);if(i>=n)return o(s,i,n,"day");if(i>=r)return o(s,i,r,"hour");if(i>=t)return o(s,i,t,"minute");if(i>=e)return o(s,i,e,"second");return s+" ms"}(a):function(s){var i=Math.abs(s);if(i>=n)return Math.round(s/n)+"d";if(i>=r)return Math.round(s/r)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Ao=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(s=n))})),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(n){}!e&&"undefined"!=typeof process&&"env"in process&&(e=r.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ao(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(Ro,Ro.exports);var No=Ro.exports,Oo=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Io,"__esModule",{value:!0}),Io.createModuleLogger=Io.createProjectLogger=void 0;const Po=(0,Oo(No).default)("metamask");Io.createProjectLogger=function(e){return Po.extend(e)},Io.createModuleLogger=function(e,t){return e.extend(t)};var Lo={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0,e.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},e.isNullOrUndefined=function(e){return null==e},e.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};var t;function r(e){return e.charCodeAt(0)<=127}e.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),(t=e.JsonSize||(e.JsonSize={}))[t.Null=4]="Null",t[t.Comma=1]="Comma",t[t.Wrapper=1]="Wrapper",t[t.True=4]="True",t[t.False=5]="False",t[t.Quote=1]="Quote",t[t.Colon=1]="Colon",t[t.Date=24]="Date",e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,e.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(t){return!1}},e.isASCII=r,e.calculateStringSize=function(t){var n;return t.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(n=t.match(e.ESCAPE_CHARACTERS_REGEXP))&&void 0!==n?n:[]).length},e.calculateNumberSize=function(e){return e.toString().length}}(Lo);var To={};Object.defineProperty(To,"__esModule",{value:!0}),To.hexToBigInt=To.hexToNumber=To.bigIntToHex=To.numberToHex=void 0;const jo=oi,Bo=Fi;To.numberToHex=e=>((0,jo.assert)("number"==typeof e,"Value must be a number."),(0,jo.assert)(e>=0,"Value must be a non-negative number."),(0,jo.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Bo.add0x)(e.toString(16)));To.bigIntToHex=e=>((0,jo.assert)("bigint"==typeof e,"Value must be a bigint."),(0,jo.assert)(e>=0,"Value must be a non-negative bigint."),(0,Bo.add0x)(e.toString(16)));To.hexToNumber=e=>{(0,Bo.assertIsHexString)(e);const t=parseInt(e,16);return(0,jo.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};To.hexToBigInt=e=>((0,Bo.assertIsHexString)(e),BigInt((0,Bo.add0x)(e)));var Do={};Object.defineProperty(Do,"__esModule",{value:!0});var Fo={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,(t=e.Duration||(e.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};e.inMilliseconds=function(e,t){return r(e,"count"),e*t},e.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}(Fo);var $o={};Object.defineProperty($o,"__esModule",{value:!0});var Uo={},Ho={exports:{}};var Vo={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},qo={};var Wo="object"==typeof process&&qo&&qo.NODE_DEBUG&&/\bsemver\b/i.test(qo.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Vo,i=Wo,o=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",s],[h,n]],p=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=u++;i(e,s,t),l[e]=s,c[s]=t,o[s]=new RegExp(t,r?"g":void 0),a[s]=new RegExp(n,r?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),p("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${c[l.NUMERICIDENTIFIER]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NUMERICIDENTIFIERLOOSE]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${h}+`),p("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),p("FULL",`^${c[l.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),p("LOOSE",`^${c[l.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),p("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",c[l.COERCE],!0),p("COERCERTLFULL",c[l.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ho,Ho.exports);var zo=Ho.exports;const Jo=Object.freeze({loose:!0}),Go=Object.freeze({});var Zo=e=>e?"object"!=typeof e?Jo:e:Go;const Qo=/^[0-9]+$/,Yo=(e,t)=>{const r=Qo.test(e),n=Qo.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eYo(t,e)};const Xo=Wo,{MAX_LENGTH:ea,MAX_SAFE_INTEGER:ta}=Vo,{safeRe:ra,t:na}=zo,sa=Zo,{compareIdentifiers:ia}=Ko;var oa=class e{constructor(t,r){if(r=sa(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>ea)throw new TypeError(`version is longer than ${ea} characters`);Xo("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ra[na.LOOSE]:ra[na.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>ta||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ta||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ta||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===ia(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const aa=oa;var ca=(e,t,r=!1)=>{if(e instanceof aa)return e;try{return new aa(e,t)}catch(n){if(!r)return null;throw n}};const la=ca;var ua=(e,t)=>{const r=la(e,t);return r?r.version:null};const ha=ca;var da=(e,t)=>{const r=ha(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const pa=oa;var fa=(e,t,r,n,s)=>{"string"==typeof r&&(s=n,n=r,r=void 0);try{return new pa(e instanceof pa?e.version:e,r).inc(t,n,s).version}catch(i){return null}};const ma=ca;var ga=(e,t)=>{const r=ma(e,null,!0),n=ma(t,null,!0),s=r.compare(n);if(0===s)return null;const i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return a.patch||a.minor?o.patch?"patch":o.minor?"minor":"major":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};const va=oa;var ya=(e,t)=>new va(e,t).major;const wa=oa;var _a=(e,t)=>new wa(e,t).minor;const ba=oa;var Ea=(e,t)=>new ba(e,t).patch;const ka=ca;var Ma=(e,t)=>{const r=ka(e,t);return r&&r.prerelease.length?r.prerelease:null};const Sa=oa;var Ca=(e,t,r)=>new Sa(e,r).compare(new Sa(t,r));const Ia=Ca;var Ra=(e,t,r)=>Ia(t,e,r);const xa=Ca;var Aa=(e,t)=>xa(e,t,!0);const Na=oa;var Oa=(e,t,r)=>{const n=new Na(e,r),s=new Na(t,r);return n.compare(s)||n.compareBuild(s)};const Pa=Oa;var La=(e,t)=>e.sort(((e,r)=>Pa(e,r,t)));const Ta=Oa;var ja=(e,t)=>e.sort(((e,r)=>Ta(r,e,t)));const Ba=Ca;var Da=(e,t,r)=>Ba(e,t,r)>0;const Fa=Ca;var $a=(e,t,r)=>Fa(e,t,r)<0;const Ua=Ca;var Ha=(e,t,r)=>0===Ua(e,t,r);const Va=Ca;var qa=(e,t,r)=>0!==Va(e,t,r);const Wa=Ca;var za=(e,t,r)=>Wa(e,t,r)>=0;const Ja=Ca;var Ga=(e,t,r)=>Ja(e,t,r)<=0;const Za=Ha,Qa=qa,Ya=Da,Ka=za,Xa=$a,ec=Ga;var tc=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Za(e,r,n);case"!=":return Qa(e,r,n);case">":return Ya(e,r,n);case">=":return Ka(e,r,n);case"<":return Xa(e,r,n);case"<=":return ec(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const rc=oa,nc=ca,{safeRe:sc,t:ic}=zo;var oc=(e,t)=>{if(e instanceof rc)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?sc[ic.COERCERTLFULL]:sc[ic.COERCERTL];let s;for(;(s=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),n.lastIndex=s.index+s[1].length+s[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?sc[ic.COERCEFULL]:sc[ic.COERCE]);if(null===r)return null;const n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return nc(`${n}.${s}.${i}${o}${a}`,t)};var ac,cc,lc,uc,hc=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};function dc(){if(cc)return ac;cc=1;class e{constructor(t,s){if(s=r(s),t instanceof e)return t.loose===!!s.loose&&t.includePrerelease===!!s.includePrerelease?t:new e(t.raw,s);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=s,this.loose=!!s.loose,this.includePrerelease=!!s.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const t of this.set)if(1===t.length&&f(t[0])){this.set=[t];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const r=((this.options.includePrerelease&&h)|(this.options.loose&&d))+":"+e,i=t.get(r);if(i)return i;const f=this.options.loose,m=f?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];e=e.replace(m,C(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[a.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[a.TILDETRIM],l),s("tilde trim",e),e=e.replace(o[a.CARETTRIM],u),s("caret trim",e);let v=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>S(e,this.options)));f&&(v=v.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(o[a.COMPARATORLOOSE]))))),s("range list",v);const y=new Map,w=v.map((e=>new n(e,this.options)));for(const t of w){if(p(t))return[t];y.set(t.value,t)}y.size>1&&y.has("")&&y.delete("");const _=[...y.values()];return t.set(r,_),_}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>m(e,r)&&t.set.some((t=>m(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new i(e,this.options)}catch(t){return!1}for(let r=0;r"<0.0.0-0"===e.value,f=e=>""===e.value,m=(e,t)=>{let r=!0;const n=e.slice();let s=n.pop();for(;r&&n.length;)r=n.every((e=>s.intersects(e,t))),s=n.pop();return r},g=(e,t)=>(s("comp",e,t),e=_(e,t),s("caret",e),e=y(e,t),s("tildes",e),e=E(e,t),s("xrange",e),e=M(e,t),s("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,y=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?o[a.TILDELOOSE]:o[a.TILDE];return e.replace(r,((t,r,n,i,o)=>{let a;return s("tilde",e,t,r,n,i,o),v(r)?a="":v(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:v(i)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(s("replaceTilde pr",o),a=`>=${r}.${n}.${i}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,s("tilde return",a),a}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{s("caret",e,t);const r=t.loose?o[a.CARETLOOSE]:o[a.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,o,a)=>{let c;return s("caret",e,t,r,i,o,a),v(r)?c="":v(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:v(o)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:a?(s("replaceCaret pr",a),c="0"===r?"0"===i?`>=${r}.${i}.${o}-${a} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o}-${a} <${+r+1}.0.0-0`):(s("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${o}${n} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o} <${+r+1}.0.0-0`),s("caret return",c),c}))},E=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>k(e,t))).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return e.replace(r,((r,n,i,o,a,c)=>{s("xRange",e,r,n,i,o,a,c);const l=v(i),u=l||v(o),h=u||v(a),d=h;return"="===n&&d&&(n=""),c=t.includePrerelease?"-0":"",l?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(o=0),a=0,">"===n?(n=">=",u?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",u?i=+i+1:o=+o+1),"<"===n&&(c="-0"),r=`${n+i}.${o}.${a}${c}`):u?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(r=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),s("xRange return",r),r}))},M=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[a.STAR],"")),S=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?a.GTE0PRE:a.GTE0],"")),C=e=>(t,r,n,s,i,o,a,c,l,u,h,d)=>`${r=v(n)?"":v(s)?`>=${n}.0.0${e?"-0":""}`:v(i)?`>=${n}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=v(l)?"":v(u)?`<${+l+1}.0.0-0`:v(h)?`<${l}.${+u+1}.0-0`:d?`<=${l}.${u}.${h}-${d}`:e?`<${l}.${u}.${+h+1}-0`:`<=${c}`}`.trim(),I=(e,t,r)=>{for(let n=0;n0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return ac}function pc(){if(uc)return lc;uc=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,s){if(s=r(s),n instanceof t){if(n.loose===!!s.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),o("comparator",n,s),this.options=s,this.loose=!!s.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(t){const r=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new a(i[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(r){return!1}return i(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(i(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(i(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}lc=t;const r=Zo,{safeRe:n,t:s}=zo,i=tc,o=Wo,a=oa,c=dc();return lc}const fc=dc();var mc=(e,t,r)=>{try{t=new fc(t,r)}catch(n){return!1}return t.test(e)};const gc=dc();var vc=(e,t)=>new gc(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const yc=oa,wc=dc();var _c=(e,t,r)=>{let n=null,s=null,i=null;try{i=new wc(t,r)}catch(o){return null}return e.forEach((e=>{i.test(e)&&(n&&-1!==s.compare(e)||(n=e,s=new yc(n,r)))})),n};const bc=oa,Ec=dc();var kc=(e,t,r)=>{let n=null,s=null,i=null;try{i=new Ec(t,r)}catch(o){return null}return e.forEach((e=>{i.test(e)&&(n&&1!==s.compare(e)||(n=e,s=new bc(n,r)))})),n};const Mc=oa,Sc=dc(),Cc=Da;var Ic=(e,t)=>{e=new Sc(e,t);let r=new Mc("0.0.0");if(e.test(r))return r;if(r=new Mc("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n{const t=new Mc(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!Cc(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!s||r&&!Cc(r,s)||(r=s)}return r&&e.test(r)?r:null};const Rc=dc();var xc=(e,t)=>{try{return new Rc(e,t).range||"*"}catch(r){return null}};const Ac=oa,Nc=pc(),{ANY:Oc}=Nc,Pc=dc(),Lc=mc,Tc=Da,jc=$a,Bc=Ga,Dc=za;var Fc=(e,t,r,n)=>{let s,i,o,a,c;switch(e=new Ac(e,n),t=new Pc(t,n),r){case">":s=Tc,i=Bc,o=jc,a=">",c=">=";break;case"<":s=jc,i=Dc,o=Tc,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Lc(e,t,n))return!1;for(let l=0;l{e.semver===Oc&&(e=new Nc(">=0.0.0")),u=u||e,h=h||e,s(e.semver,u.semver,n)?u=e:o(e.semver,h.semver,n)&&(h=e)})),u.operator===a||u.operator===c)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;if(h.operator===c&&o(e,h.semver))return!1}return!0};const $c=Fc;var Uc=(e,t,r)=>$c(e,t,">",r);const Hc=Fc;var Vc=(e,t,r)=>Hc(e,t,"<",r);const qc=dc();var Wc=(e,t,r)=>(e=new qc(e,r),t=new qc(t,r),e.intersects(t,r));const zc=mc,Jc=Ca;const Gc=dc(),Zc=pc(),{ANY:Qc}=Zc,Yc=mc,Kc=Ca,Xc=[new Zc(">=0.0.0-0")],el=[new Zc(">=0.0.0")],tl=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===Qc){if(1===t.length&&t[0].semver===Qc)return!0;e=r.includePrerelease?Xc:el}if(1===t.length&&t[0].semver===Qc){if(r.includePrerelease)return!0;t=el}const n=new Set;let s,i,o,a,c,l,u;for(const p of e)">"===p.operator||">="===p.operator?s=rl(s,p,r):"<"===p.operator||"<="===p.operator?i=nl(i,p,r):n.add(p.semver);if(n.size>1)return null;if(s&&i){if(o=Kc(s.semver,i.semver,r),o>0)return null;if(0===o&&(">="!==s.operator||"<="!==i.operator))return null}for(const p of n){if(s&&!Yc(p,String(s),r))return null;if(i&&!Yc(p,String(i),r))return null;for(const e of t)if(!Yc(p,String(e),r))return!1;return!0}let h=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver,d=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver;h&&1===h.prerelease.length&&"<"===i.operator&&0===h.prerelease[0]&&(h=!1);for(const p of t){if(u=u||">"===p.operator||">="===p.operator,l=l||"<"===p.operator||"<="===p.operator,s)if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),">"===p.operator||">="===p.operator){if(a=rl(s,p,r),a===p&&a!==s)return!1}else if(">="===s.operator&&!Yc(s.semver,String(p),r))return!1;if(i)if(h&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===h.major&&p.semver.minor===h.minor&&p.semver.patch===h.patch&&(h=!1),"<"===p.operator||"<="===p.operator){if(c=nl(i,p,r),c===p&&c!==i)return!1}else if("<="===i.operator&&!Yc(i.semver,String(p),r))return!1;if(!p.operator&&(i||s)&&0!==o)return!1}return!(s&&l&&!i&&0!==o)&&(!(i&&u&&!s&&0!==o)&&(!d&&!h))},rl=(e,t,r)=>{if(!e)return t;const n=Kc(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},nl=(e,t,r)=>{if(!e)return t;const n=Kc(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var sl=(e,t,r={})=>{if(e===t)return!0;e=new Gc(e,r),t=new Gc(t,r);let n=!1;e:for(const s of e.set){for(const e of t.set){const t=tl(s,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const il=zo,ol=Vo,al=oa,cl=Ko;var ll={parse:ca,valid:ua,clean:da,inc:fa,diff:ga,major:ya,minor:_a,patch:Ea,prerelease:Ma,compare:Ca,rcompare:Ra,compareLoose:Aa,compareBuild:Oa,sort:La,rsort:ja,gt:Da,lt:$a,eq:Ha,neq:qa,gte:za,lte:Ga,cmp:tc,coerce:oc,Comparator:pc(),Range:dc(),satisfies:mc,toComparators:vc,maxSatisfying:_c,minSatisfying:kc,minVersion:Ic,validRange:xc,outside:Fc,gtr:Uc,ltr:Vc,intersects:Wc,simplifyRange:(e,t,r)=>{const n=[];let s=null,i=null;const o=e.sort(((e,t)=>Jc(e,t,r)));for(const u of o){zc(u,t,r)?(i=u,s||(s=u)):(i&&n.push([s,i]),i=null,s=null)}s&&n.push([s,null]);const a=[];for(const[u,h]of n)u===h?a.push(u):h||u!==o[0]?h?u===o[0]?a.push(`<=${h}`):a.push(`${u} - ${h}`):a.push(`>=${u}`):a.push("*");const c=a.join(" || "),l="string"==typeof t.raw?t.raw:String(t);return c.lengthnull!==(0,t.valid)(e)||`Expected SemVer version, got "${e}"`)),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",(e=>null!==(0,t.validRange)(e)||`Expected SemVer range, got "${e}"`)),e.isValidSemVerVersion=function(t){return(0,r.is)(t,e.VersionStruct)},e.isValidSemVerRange=function(t){return(0,r.is)(t,e.VersionRangeStruct)},e.assertIsSemVerVersion=function(t){(0,n.assertStruct)(t,e.VersionStruct)},e.assertIsSemVerRange=function(t){(0,n.assertStruct)(t,e.VersionRangeStruct)},e.gtVersion=function(e,r){return(0,t.gt)(e,r)},e.gtRange=function(e,r){return(0,t.gtr)(e,r)},e.satisfiesVersionRange=function(e,r){return(0,t.satisfies)(e,r,{includePrerelease:!0})}}(Uo),function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(oi,t),n(Ti,t),n(Di,t),n(to,t),n(so,t),n(vo,t),n(Eo,t),n(Fi,t),n(ko,t),n(Mo,t),n(Io,t),n(Lo,t),n(To,t),n(Do,t),n(Fo,t),n($o,t),n(Uo,t)}(ii),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ii;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")}(si);var ul=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qs,"__esModule",{value:!0}),qs.PollingBlockTracker=void 0;const hl=ul(Ws),dl=ul(((e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=e=>{const r=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(r):!t.exclude.some(r)};let n;n="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):zs(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const s in e){const i=e[s];n[s]="function"==typeof i&&r(s)?zs(i,t):i}return n})),pl=Js,fl=(0,si.createModuleLogger)(si.projectLogger,"polling-block-tracker"),ml=(0,hl.default)();class gl extends pl.BaseBlockTracker{constructor(e={}){var t;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:null!==(t=e.blockResetDuration)&&void 0!==t?t:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||2e4,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=void 0===e.keepEventLoopActive||e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const e=vl(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await e}catch(t){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${null!==(e=t.stack)&&void 0!==e?e:t}`);try{this.emit("error",n)}catch(r){console.error(n)}const s=vl(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await s}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:ml(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),fl("Making request",e);const t=await(0,dl.default)((t=>this._provider.sendAsync(e,t)))();if(fl("Got response",t),t.error)throw new Error(`PollingBlockTracker - encountered error fetching block:\n${t.error.message}`);return t.result}}function vl(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}qs.PollingBlockTracker=gl;var yl={},wl=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yl,"__esModule",{value:!0}),yl.SubscribeBlockTracker=void 0;const _l=wl(Ws),bl=Js,El=(0,_l.default)();class kl extends bl.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(void 0===this._subscriptionId||null===this._subscriptionId)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(null!==this._subscriptionId&&void 0!==this._subscriptionId)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...t){return new Promise(((r,n)=>{this._provider.sendAsync({id:El(),method:e,params:t,jsonrpc:"2.0"},((e,t)=>{e?n(e):r(t.result)}))}))}_handleSubData(e,t){var r;"eth_subscription"===t.method&&(null===(r=t.params)||void 0===r?void 0:r.subscription)===this._subscriptionId&&this._newPotentialLatest(t.params.result.number)}}yl.SubscribeBlockTracker=kl,function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(qs,t),n(yl,t)}(Vs);var Ml={},Sl={},Cl={};Object.defineProperty(Cl,"__esModule",{value:!0}),Cl.getUniqueId=void 0;const Il=4294967295;let Rl=Math.floor(Math.random()*Il);Cl.getUniqueId=function(){return Rl=(Rl+1)%Il,Rl},Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.createIdRemapMiddleware=void 0;const xl=Cl;Sl.createIdRemapMiddleware=function(){return(e,t,r,n)=>{const s=e.id,i=xl.getUniqueId();e.id=i,t.id=i,r((r=>{e.id=s,t.id=s,r()}))}};var Al={};Object.defineProperty(Al,"__esModule",{value:!0}),Al.createAsyncMiddleware=void 0,Al.createAsyncMiddleware=function(e){return async(t,r,n,s)=>{let i;const o=new Promise((e=>{i=e}));let a=null,c=!1;const l=async()=>{c=!0,n((e=>{a=e,i()})),await o};try{await e(t,r,l),c?(await o,a(null)):s(null)}catch(u){a?a(u):s(u)}}};var Nl={};Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.createScaffoldMiddleware=void 0,Nl.createScaffoldMiddleware=function(e){return(t,r,n,s)=>{const i=e[t.method];return void 0===i?n():"function"==typeof i?i(t,r,n,s):(r.result=i,s())}};var Ol={},Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});const Ll=s;function Tl(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout((()=>{throw n}))}}let jl=class extends Ll.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const s=n[e];if(void 0===s)return!1;if("function"==typeof s)Tl(s,this,t);else{const e=s.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;no.depthLimit)return void zl($l,e,t,s);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void zl($l,e,t,s);if(n.push(e),Array.isArray(e))for(a=0;at?1:0}function Zl(e,t,r,n){void 0===n&&(n=ql());var s,i=Ql(e,"",0,[],void 0,0,n)||e;try{s=0===Vl.length?JSON.stringify(i,t,r):JSON.stringify(i,Yl(t),r)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Hl.length;){var o=Hl.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function Ql(e,t,r,n,s,i,o){var a;if(i+=1,"object"==typeof e&&null!==e){for(a=0;ao.depthLimit)return void zl($l,e,t,s);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void zl($l,e,t,s);if(n.push(e),Array.isArray(e))for(a=0;a0)for(var n=0;n=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};var tu={},ru={};Object.defineProperty(ru,"__esModule",{value:!0}),ru.errorValues=ru.errorCodes=void 0,ru.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}},ru.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=ru,r=Dl,n=t.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",i={code:n,message:o(n)};function o(r,n=s){if(Number.isInteger(r)){const n=r.toString();if(u(t.errorValues,n))return t.errorValues[n].message;if(c(r))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function a(e){if(!Number.isInteger(e))return!1;const r=e.toString();return!!t.errorValues[r]||!!c(e)}function c(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=a,e.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:n=!1}={}){var s,c;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof r.EthereumRpcError)return e.serialize();const h={};if(e&&"object"==typeof e&&!Array.isArray(e)&&u(e,"code")&&a(e.code)){const t=e;h.code=t.code,t.message&&"string"==typeof t.message?(h.message=t.message,u(t,"data")&&(h.data=t.data)):(h.message=o(h.code),h.data={originalError:l(e)})}else{h.code=t.code;const r=null===(s=e)||void 0===s?void 0:s.message;h.message=r&&"string"==typeof r?r:t.message,h.data={originalError:l(e)}}const d=null===(c=e)||void 0===c?void 0:c.stack;return n&&e&&d&&"string"==typeof d&&(h.stack=d),h}}(tu);var nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.ethErrors=void 0;const su=Dl,iu=tu,ou=ru;function au(e,t){const[r,n]=lu(t);return new su.EthereumRpcError(e,r||iu.getMessageFromCode(e),n)}function cu(e,t){const[r,n]=lu(t);return new su.EthereumProviderError(e,r||iu.getMessageFromCode(e),n)}function lu(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}nu.ethErrors={rpc:{parse:e=>au(ou.errorCodes.rpc.parse,e),invalidRequest:e=>au(ou.errorCodes.rpc.invalidRequest,e),invalidParams:e=>au(ou.errorCodes.rpc.invalidParams,e),methodNotFound:e=>au(ou.errorCodes.rpc.methodNotFound,e),internal:e=>au(ou.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return au(t,e)},invalidInput:e=>au(ou.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>au(ou.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>au(ou.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>au(ou.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>au(ou.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>au(ou.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cu(ou.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cu(ou.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cu(ou.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cu(ou.errorCodes.provider.disconnected,e),chainDisconnected:e=>cu(ou.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new su.EthereumProviderError(t,r,n)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dl;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=tu;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=nu;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const s=ru;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})}(Bl);var uu=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ol,"__esModule",{value:!0}),Ol.JsonRpcEngine=void 0;const hu=uu(Pl),du=Bl;class pu extends hu.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[s,i,o]=await pu._runAllMiddleware(e,t,this._middleware);return i?(await pu._runReturnHandlers(o),n(s)):r((async e=>{try{await pu._runReturnHandlers(o)}catch(t){return e(t)}return e()}))}catch(s){return n(s)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(r){if(t)return t(r);throw r}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,r)=>{t(r)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const r=new du.EthereumRpcError(du.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(r,{id:void 0,jsonrpc:"2.0",error:r})}if("string"!=typeof e.method){const r=new du.EthereumRpcError(du.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=Object.assign({},e),n={id:r.id,jsonrpc:r.jsonrpc};let s=null;try{await this._processRequest(r,n)}catch(i){s=i}return s&&(delete n.result,n.error||(n.error=du.serializeError(s))),t(s,n)}async _processRequest(e,t){const[r,n,s]=await pu._runAllMiddleware(e,t,this._middleware);if(pu._checkForCompletion(e,t,n),await pu._runReturnHandlers(s),r)throw r}static async _runAllMiddleware(e,t,r){const n=[];let s=null,i=!1;for(const o of r)if([s,i]=await pu._runMiddleware(e,t,o,n),i)break;return[s,i,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((s=>{const i=e=>{const r=e||t.error;r&&(t.error=du.serializeError(r)),s([r,!0])},o=r=>{t.error?i(t.error):(r&&("function"!=typeof r&&i(new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof r}" for request:\n${fu(e)}`,{request:e})),n.push(r)),s([null,!1]))};try{r(e,t,o,i)}catch(a){i(a)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${fu(e)}`,{request:e});if(!r)throw new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${fu(e)}`,{request:e})}}function fu(e){return JSON.stringify(e,null,2)}Ol.JsonRpcEngine=pu;var mu={};Object.defineProperty(mu,"__esModule",{value:!0}),mu.mergeMiddleware=void 0;const gu=Ol;mu.mergeMiddleware=function(e){const t=new gu.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(Sl,t),n(Al,t),n(Nl,t),n(Cl,t),n(Ol,t),n(mu,t)}(Ml);var vu={},yu={},wu=function(e,t){return(wu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function _u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}wu(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var bu=function(){return bu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;a--)(s=e[a])&&(o=(i<3?s(o):i>3?s(t,r,o):s(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function Mu(e,t){return function(r,n){t(r,n,e)}}function Su(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function Cu(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{c(n.next(e))}catch(t){i(t)}}function a(e){try{c(n.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))}function Iu(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Nu(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(s)throw s.error}}return o}function Ou(){for(var e=[],t=0;t1||a(e,t)}))})}function a(e,t){try{(r=s[e](t)).value instanceof Tu?Promise.resolve(r.value.v).then(c,l):u(i[0][2],r)}catch(n){u(i[0][3],n)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Bu(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,s){t[n]=e[n]?function(t){return(r=!r)?{value:Tu(e[n](t)),done:!1}:s?s(t):t}:s}}function Du(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Au(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,s){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,s,(t=e[r](t)).done,t.value)}))}}}function Fu(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var $u=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Uu(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&Ru(t,e,r);return $u(t,e),t}function Hu(e){return e&&e.__esModule?e:{default:e}}function Vu(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function qu(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}function Wu(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function zu(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var Ju="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function Gu(e){function t(t){e.error=e.hasError?new Ju(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var s=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(s).then(r,(function(e){return t(e),r()}))}catch(i){t(i)}}if(e.hasError)throw e.error}()}const Zu={__extends:_u,__assign:bu,__rest:Eu,__decorate:ku,__param:Mu,__metadata:Su,__awaiter:Cu,__generator:Iu,__createBinding:Ru,__exportStar:xu,__values:Au,__read:Nu,__spread:Ou,__spreadArrays:Pu,__spreadArray:Lu,__await:Tu,__asyncGenerator:ju,__asyncDelegator:Bu,__asyncValues:Du,__makeTemplateObject:Fu,__importStar:Uu,__importDefault:Hu,__classPrivateFieldGet:Vu,__classPrivateFieldSet:qu,__classPrivateFieldIn:Wu,__addDisposableResource:zu,__disposeResources:Gu},Qu=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:zu,get __assign(){return bu},__asyncDelegator:Bu,__asyncGenerator:ju,__asyncValues:Du,__await:Tu,__awaiter:Cu,__classPrivateFieldGet:Vu,__classPrivateFieldIn:Wu,__classPrivateFieldSet:qu,__createBinding:Ru,__decorate:ku,__disposeResources:Gu,__esDecorate:function(e,t,r,n,s,i){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(e||null))};var g=(0,r[p])("accessor"===c?{get:h.get,set:h.set}:h[l],f);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(h.get=a),(a=o(g.set))&&(h.set=a),(a=o(g.init))&&s.unshift(a)}else(a=o(g))&&("field"===c?s.unshift(a):h[l]=a)}u&&Object.defineProperty(u,n.name,h),d=!0},__exportStar:xu,__extends:_u,__generator:Iu,__importDefault:Hu,__importStar:Uu,__makeTemplateObject:Fu,__metadata:Su,__param:Mu,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:Nu,__rest:Eu,__runInitializers:function(e,t,r){for(var n=arguments.length>2,s=0;s1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}();Ku.default=eh,Object.defineProperty(yu,"__esModule",{value:!0});var th=Yu,rh=Ku,nh=function(){function e(){this._semaphore=new rh.default(1)}return e.prototype.acquire=function(){return th.__awaiter(this,void 0,void 0,(function(){var e;return th.__generator(this,(function(t){switch(t.label){case 0:return[4,this._semaphore.acquire()];case 1:return e=t.sent(),[2,e[1]]}}))}))},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();yu.default=nh;var sh={};Object.defineProperty(sh,"__esModule",{value:!0}),sh.withTimeout=void 0;var ih=Yu;sh.withTimeout=function(e,t,r){var n=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(s,i){return ih.__awaiter(n,void 0,void 0,(function(){var n,o;return ih.__generator(this,(function(a){switch(a.label){case 0:return n=!1,setTimeout((function(){n=!0,i(r)}),t),[4,e.acquire()];case 1:return o=a.sent(),n?(Array.isArray(o)?o[1]:o)():s(o),[2]}}))}))}))},runExclusive:function(e){return ih.__awaiter(this,void 0,void 0,(function(){var t,r;return ih.__generator(this,(function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}}))}))},release:function(){e.release()},isLocked:function(){return e.isLocked()}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=yu;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var r=Ku;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=sh;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})}(vu);var oh=function(){for(var e={},t=0;tfunction(...s){return new(0,t.promiseModule)(((i,o)=>{t.multiArgs?s.push(((...e)=>{t.errorFirst?e[0]?o(e):(e.shift(),i(e)):i(e)})):t.errorFirst?s.push(((e,t)=>{e?o(e):i(t)})):s.push(i);const a=this===r?n:this;Reflect.apply(e,a,s)}))},mh=new WeakMap;const gh=Gs.default;var vh=class extends gh{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach((e=>this.emit("update",e)))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}};const yh=vh;var wh={minBlockRef:function(...e){return _h(e)[0]},maxBlockRef:function(...e){const t=_h(e);return t[t.length-1]},sortBlockRefs:_h,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:bh,incrementHexInt:function(e){if(null==e)return e;return Eh(bh(e)+1)},intToHex:Eh,unsafeRandomBytes:function(e){let t="0x";for(let r=0;r"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:bh(e)-bh(t)))}function bh(e){return null==e?e:Number.parseInt(e,16)}function Eh(e){if(null==e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function kh(){return Math.floor(16*Math.random()).toString(16)}const Mh=uh,Sh=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const n=new WeakMap,s=new Proxy(e,{apply(e,r,i){const o=n.get(e);if(o)return Reflect.apply(o,r,i);const a=t.excludeMain?e:fh(e,t,s,e);return n.set(e,a),Reflect.apply(a,r,i)},get(e,r){const i=e[r];if(!((e,r)=>{let n=mh.get(e);if(n||(n={},mh.set(e,n)),r in n)return n[r];const s=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),i=Reflect.getOwnPropertyDescriptor(e,r),o=void 0===i||i.writable||i.configurable,a=(t.include?t.include.some(s):!t.exclude.some(s))&&o;return n[r]=a,a})(e,r)||i===Function.prototype[r])return i;const o=n.get(i);if(o)return o;if("function"==typeof i){const r=fh(i,t,s,e);return n.set(i,r),r}return i}});return s},Ch=class extends yh{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}},{bnToHex:Ih,hexToInt:Rh,incrementHexInt:xh,minBlockRef:Ah,blockRefIsNumber:Nh}=wh;var Oh=class extends Ch{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new Mh(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=Ah(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),s=await this._fetchLogs(n);this.addInitialResults(s)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?xh(e):t;const s=Object.assign({},this.params,{fromBlock:n,toBlock:r}),i=(await this._fetchLogs(s)).filter((e=>this.matchLog(e)));this.addResults(i)}async _fetchLogs(e){return await Sh((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(Rh(this.params.fromBlock)>=Rh(e.blockNumber))return!1;if(Nh(this.params.toBlock)&&Rh(this.params.toBlock)<=Rh(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let s=Array.isArray(t)?t:[t];if(s.includes(null))return!0;s=s.map((e=>e.toLowerCase()));return s.includes(n)}))}},Ph=async function({provider:e,fromBlock:t,toBlock:r}){t||(t=r);const n=Lh(t),s=Lh(r),i=Array(s-n+1).fill().map(((e,t)=>n+t)).map(Th);let o=await Promise.all(i.map((t=>async function(e,t,r){for(let s=0;s<3;s++)try{return await jh(e,{id:1,jsonrpc:"2.0",method:t,params:r})}catch(n){console.error(`provider.sendAsync failed: ${n.stack||n.message||n}`)}return null}(e,"eth_getBlockByNumber",[t,!1]))));return o=o.filter((e=>null!==e)),o};function Lh(e){return null==e?e:Number.parseInt(e,16)}function Th(e){if(null==e)return e;return"0x"+e.toString(16)}function jh(e,t){return new Promise(((r,n)=>{e.sendAsync(t,((e,t)=>{e?n(e):t.error?n(t.error):t.result?r(t.result):n(new Error("Result was empty"))}))}))}const Bh=vh,Dh=Ph,{incrementHexInt:Fh}=wh;var $h=class extends Bh{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=Fh(e),s=(await Dh({provider:this.provider,fromBlock:n,toBlock:r})).map((e=>e.hash));this.addResults(s)}};const Uh=vh,Hh=Ph,{incrementHexInt:Vh}=wh;var qh=class extends Uh{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=Vh(e),n=await Hh({provider:this.provider,fromBlock:r,toBlock:t}),s=[];for(const i of n)s.push(...i.transactions);this.addResults(s)}};const Wh=vu.Mutex,{createAsyncMiddleware:zh,createScaffoldMiddleware:Jh}=Ml,Gh=Oh,Zh=$h,Qh=qh,{intToHex:Yh,hexToInt:Kh}=wh;var Xh=function({blockTracker:e,provider:t}){let r=0,n={};const s=new Wh,i=function({mutex:e}){return t=>async(r,n,s,i)=>{(await e.acquire())(),t(r,n,s,i)}}({mutex:s}),o=Jh({eth_newFilter:i(ed(c)),eth_newBlockFilter:i(ed(l)),eth_newPendingTransactionFilter:i(ed(u)),eth_uninstallFilter:i(td(p)),eth_getFilterChanges:i(td(h)),eth_getFilterLogs:i(td(d))}),a=async({oldBlock:e,newBlock:t})=>{if(0===n.length)return;const r=await s.acquire();try{await Promise.all(rd(n).map((async r=>{try{await r.update({oldBlock:e,newBlock:t})}catch(n){console.error(n)}})))}catch(i){console.error(i)}r()};return o.newLogFilter=c,o.newBlockFilter=l,o.newPendingTransactionFilter=u,o.uninstallFilter=p,o.getFilterChanges=h,o.getFilterLogs=d,o.destroy=()=>{!async function(){const e=rd(n).length;n={},m({prevFilterCount:e,newFilterCount:0})}()},o;async function c(e){const r=new Gh({provider:t,params:e});return await f(r),r}async function l(){const e=new Zh({provider:t});return await f(e),e}async function u(){const e=new Qh({provider:t});return await f(e),e}async function h(e){const t=Kh(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);return r.getChangesAndClear()}async function d(e){const t=Kh(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);let s=[];return"log"===r.type&&(s=r.getAllResults()),s}async function p(e){const t=Kh(e),r=n[t],s=Boolean(r);return s&&await async function(e){const t=rd(n).length;delete n[e];const r=rd(n).length;m({prevFilterCount:t,newFilterCount:r})}(t),s}async function f(t){const s=rd(n).length,i=await e.getLatestBlock();await t.initialize({currentBlock:i}),r++,n[r]=t,t.id=r,t.idHex=Yh(r);return m({prevFilterCount:s,newFilterCount:rd(n).length}),r}function m({prevFilterCount:t,newFilterCount:r}){0===t&&r>0?e.on("sync",a):t>0&&0===r&&e.removeListener("sync",a)}};function ed(e){return td((async(...t)=>{const r=await e(...t);return Yh(r.id)}))}function td(e){return zh((async(t,r)=>{const n=await e.apply(null,t.params);r.result=n}))}function rd(e,t){const r=[];for(let n in e)r.push(e[n]);return r}const nd=Gs.default,{createAsyncMiddleware:sd,createScaffoldMiddleware:id}=Ml,od=Xh,{unsafeRandomBytes:ad,incrementHexInt:cd}=wh,ld=Ph;var ud=function({blockTracker:e,provider:t}){const r={},n=od({blockTracker:e,provider:t});let s=!1;const i=new nd,o=id({eth_subscribe:sd((async function(i,o){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const c=i.params[0],l=ad(16);let u;switch(c){case"newHeads":u=h({subId:l});break;case"logs":const e=i.params[1];u=d({subId:l,filter:await n.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${c}"`)}return r[l]=u,void(o.result=l);function h({subId:r}){const n={type:c,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const s=n,i=cd(e);(await ld({provider:t,fromBlock:i,toBlock:s})).map(hd).filter((e=>null!==e)).forEach((e=>{a(r,e)}))}};return e.on("sync",n.update),n}function d({subId:e,filter:t}){t.on("update",(t=>a(e,t)));return{type:c,destroy:async()=>await n.uninstallFilter(t.idHex)}}})),eth_unsubscribe:sd((async function(e,t){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],i=r[n];if(!i)return void(t.result=!1);delete r[n],await i.destroy(),t.result=!0}))});return o.destroy=function(){i.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];s=!0},{events:i,middleware:o};function a(e,t){i.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}};function hd(e){return null==e?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.SubscriptionManager=void 0;const dd=Vs,pd=ud,fd=()=>{};Hs.SubscriptionManager=class{constructor(e){const t=new dd.PollingBlockTracker({provider:e,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:r,middleware:n}=pd({blockTracker:t,provider:e});this.events=r,this.subscriptionMiddleware=n}async handleRequest(e){const t={};return await this.subscriptionMiddleware(e,t,fd,fd),t}destroy(){this.subscriptionMiddleware.destroy()}};var md=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ee,"__esModule",{value:!0}),ee.CoinbaseWalletProvider=void 0;const gd=md(f),vd=re,yd=m,wd=d,_d=ne,bd=oe,Ed=ce,kd=I,Md=md(Ns),Sd=ie,Cd=Os,Id=Hs,Rd="DefaultChainId",xd="DefaultJsonRpcUrl";class Ad extends vd.EventEmitter{constructor(e){var t,r;super(),this._filterPolyfill=new Cd.FilterPolyfill(this),this._subscriptionManager=new Id.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=e.chainId,this._jsonRpcUrlFromOpts=e.jsonRpcUrl,this._overrideIsMetaMask=e.overrideIsMetaMask,this._relayProvider=e.relayProvider,this._storage=e.storage,this._relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=null===(t=e.overrideIsCoinbaseWallet)||void 0===t||t,this.isCoinbaseBrowser=null!==(r=e.overrideIsCoinbaseBrowser)&&void 0!==r&&r,this.qrUrl=e.qrUrl;const n=this.getChainId(),s=(0,wd.prepend0x)(n.toString(16));this.emit("connect",{chainIdStr:s});const i=this._storage.getItem(bd.LOCAL_STORAGE_ADDRESSES_KEY);if(i){const e=i.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,wd.ensureAddressString)(e))),this.emit("accountsChanged",e))}this._subscriptionManager.events.on("notification",(e=>{this.emit("message",{type:e.method,data:e.params})})),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",(e=>{var t;if(e.origin===location.origin&&e.source===window&&"walletLinkMessage"===e.data.type&&"dappChainSwitched"===e.data.data.action){const r=e.data.data.chainId,n=null!==(t=e.data.data.jsonRpcUrl)&&void 0!==t?t:this.jsonRpcUrl;this.updateProviderInfo(n,Number(r))}}))}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,wd.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(xd))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(xd,e)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(e,t){this.isCoinbaseBrowser||(this._chainIdFromOpts=t,this._jsonRpcUrlFromOpts=e),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(e,t){this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(Rd,t.toString(10));!((0,wd.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,n,s,i){const o=await this.initializeRelay(),a=await o.watchAsset(e,t,r,n,s,null==i?void 0:i.toString()).promise;return!(0,kd.isErrorResponse)(a)&&!!a.result}async addEthereumChain(e,t,r,n,s,i){var o,a;if((0,wd.ensureIntNumber)(e)===this.getChainId())return!1;const c=await this.initializeRelay(),l=c.inlineAddEthereumChain(e.toString());this._isAuthorized()||l||await c.requestEthereumAccounts().promise;const u=await c.addEthereumChain(e.toString(),t,s,r,n,i).promise;return!(0,kd.isErrorResponse)(u)&&(!0===(null===(o=u.result)||void 0===o?void 0:o.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(a=u.result)||void 0===a?void 0:a.isApproved))}async switchEthereumChain(e){const t=await this.initializeRelay(),r=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0).promise;if((0,kd.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===yd.standardErrorCodes.provider.unsupportedChain?yd.standardErrors.provider.unsupportedChain():yd.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const n=r.result;n.isApproved&&n.rpcUrl.length>0&&this.updateProviderInfo(n.rpcUrl,e)}setAppInfo(e,t){this.initializeRelay().then((r=>r.setAppInfo(e,t)))}async enable(){var e;return null===(e=this.diagnostic)||void 0===e||e.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(e,t){try{const r=this._send(e,t);if(r instanceof Promise)return r.catch((t=>{throw(0,yd.serializeError)(t,e)}))}catch(r){throw(0,yd.serializeError)(r,e)}}_send(e,t){if("string"==typeof e){const r={jsonrpc:"2.0",id:0,method:e,params:Array.isArray(t)?t:void 0!==t?[t]:[]};return this._sendRequestAsync(r).then((e=>e.result))}if("function"==typeof t){const r=e,n=t;return this._sendAsync(r,n)}if(Array.isArray(e)){return e.map((e=>this._sendRequest(e)))}const r=e;return this._sendRequest(r)}async sendAsync(e,t){try{return this._sendAsync(e,t).catch((t=>{throw(0,yd.serializeError)(t,e)}))}catch(r){return Promise.reject((0,yd.serializeError)(r,e))}}async _sendAsync(e,t){if("function"!=typeof t)throw new Error("callback is required");if(Array.isArray(e)){const r=t;return void this._sendMultipleRequestsAsync(e).then((e=>r(null,e))).catch((e=>r(e,null)))}const r=t;return this._sendRequestAsync(e).then((e=>r(null,e))).catch((e=>r(e,null)))}async request(e){try{return this._request(e).catch((t=>{throw(0,yd.serializeError)(t,e.method)}))}catch(t){return Promise.reject((0,yd.serializeError)(t,e.method))}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw yd.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw yd.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw yd.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const n=void 0===r?[]:r,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:n,jsonrpc:"2.0",id:s})).result}async scanQRCode(e){const t=await this.initializeRelay(),r=await t.scanQRCode((0,wd.ensureRegExpString)(e)).promise;if((0,kd.isErrorResponse)(r))throw(0,yd.serializeError)(r.errorMessage,"scanQRCode");if("string"!=typeof r.result)throw(0,yd.serializeError)("result was not a string","scanQRCode");return r.result}async genericRequest(e,t){const r=await this.initializeRelay(),n=await r.genericRequest(e,t).promise;if((0,kd.isErrorResponse)(n))throw(0,yd.serializeError)(n.errorMessage,"generic");if("string"!=typeof n.result)throw(0,yd.serializeError)("result was not a string","generic");return n.result}async connectAndSignIn(e){var t;let r;null===(t=this.diagnostic)||void 0===t||t.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0});try{const t=await this.initializeRelay();if(!(t instanceof _d.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(r=await t.connectAndSignIn(e).promise,(0,kd.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied account authorization");throw s}if(!r.result)throw new Error("accounts received is empty");const{accounts:n}=r.result;return this._setAddresses(n),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),r.result}async selectProvider(e){const t=await this.initializeRelay(),r=await t.selectProvider(e).promise;if((0,kd.isErrorResponse)(r))throw(0,yd.serializeError)(r.errorMessage,"selectProvider");if("string"!=typeof r.result)throw(0,yd.serializeError)("result was not a string","selectProvider");return r.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(e){const t={jsonrpc:"2.0",id:e.id},{method:r}=e;if(t.result=this._handleSynchronousMethods(e),void 0===t.result)throw new Error(`Coinbase Wallet does not support calling ${r} synchronously without a callback. Please provide a callback parameter to call ${r} asynchronously.`);return t}_setAddresses(e,t){if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,wd.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,this.emit("accountsChanged",this._addresses),this._storage.setItem(bd.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,r)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n});const s=this._handleAsynchronousFilterMethods(e);if(void 0!==s)return void s.then((r=>t(Object.assign(Object.assign({},r),{id:e.id})))).catch((e=>r(e)));const i=this._handleSubscriptionMethods(e);if(void 0!==i)return void i.then((r=>t({jsonrpc:"2.0",id:e.id,result:r.result}))).catch((e=>r(e)))}catch(n){return r(n)}this._handleAsynchronousMethods(e).then((r=>r&&t(Object.assign(Object.assign({},r),{id:e.id})))).catch((e=>r(e)))}))}_sendMultipleRequestsAsync(e){return Promise.all(e.map((e=>this._sendRequestAsync(e))))}_handleSynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(r);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(e,this.jsonRpcUrl).catch((t=>{var r;throw t.code!==yd.standardErrorCodes.rpc.methodNotFound&&t.code!==yd.standardErrorCodes.rpc.methodNotSupported||null===(r=this.diagnostic)||void 0===r||r.log(Sd.EVENTS.METHOD_NOT_IMPLEMENTED,{method:e.method,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),t}))}_handleAsynchronousFilterMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_newFilter":return this._eth_newFilter(r);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(r);case"eth_getFilterLogs":return this._eth_getFilterLogs(r)}}_handleSubscriptionMethods(e){switch(e.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(e)}}_isKnownAddress(e){try{const t=(0,wd.ensureAddressString)(e);return this._addresses.map((e=>(0,wd.ensureAddressString)(e))).includes(t)}catch(t){}return!1}_ensureKnownAddress(e){var t;if(!this._isKnownAddress(e))throw null===(t=this.diagnostic)||void 0===t||t.log(Sd.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,wd.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,wd.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,wd.ensureBN)(e.value):new gd.default(0),data:e.data?(0,wd.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,wd.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,wd.ensureBN)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,wd.ensureBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,wd.ensureBN)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,wd.ensureBN)(e.gas):null,chainId:e.chainId?(0,wd.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw yd.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw yd.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,n){this._ensureKnownAddress(t);try{const s=await this.initializeRelay(),i=await s.signEthereumMessage(e,t,r,n).promise;if((0,kd.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied message signature");throw s}}async _ethereumAddressFromSignedMessage(e,t,r){const n=await this.initializeRelay(),s=await n.ethereumAddressFromSignedMessage(e,t,r).promise;if((0,kd.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,wd.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Rd);if(!e)return(0,wd.ensureIntNumber)(this._chainIdFromOpts);const t=parseInt(e,10);return(0,wd.ensureIntNumber)(t)}async _eth_requestAccounts(){var e;if(null===(e=this.diagnostic)||void 0===e||e.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let t;try{const e=await this.initializeRelay();if(t=await e.requestEthereumAccounts().promise,(0,kd.isErrorResponse)(t))throw new Error(t.errorMessage)}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied account authorization");throw r}if(!t.result)throw new Error("accounts received is empty");return this._setAddresses(t.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=await this.initializeRelay(),r=await e.signEthereumTransaction(t).promise;if((0,kd.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw r}}async _eth_sendRawTransaction(e){const t=(0,wd.ensureBuffer)(e[0]),r=await this.initializeRelay(),n=await r.submitEthereumTransaction(t,this.getChainId()).promise;if((0,kd.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=await this.initializeRelay(),r=await e.signAndSubmitEthereumTransaction(t).promise;if((0,kd.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,wd.ensureParsedJSONObject)(e[0]),r=(0,wd.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const n=Md.default.hashForSignTypedDataLegacy({data:t}),s=JSON.stringify(t,null,2);return this._signEthereumMessage(n,r,!1,s)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=Md.default.hashForSignTypedData_v3({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,s)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=Md.default.hashForSignTypedData_v4({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,s)}async _cbwallet_arbitrary(e){const t=e[0],r=e[1];if("string"!=typeof r)throw new Error("parameter must be a string");if("object"!=typeof t||null===t)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(t,r)}}async _wallet_addEthereumChain(e){var t,r,n,s;const i=e[0];if(0===(null===(t=i.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!i.chainName||""===i.chainName.trim())throw yd.standardErrors.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw yd.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(i.chainId,16);return await this.addEthereumChain(o,null!==(r=i.rpcUrls)&&void 0!==r?r:[],null!==(n=i.blockExplorerUrls)&&void 0!==n?n:[],i.chainName,null!==(s=i.iconUrls)&&void 0!==s?s:[],i.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw yd.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw yd.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw yd.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw yd.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:n,symbol:s,image:i,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,n,s,o,i,r)}}_eth_uninstallFilter(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.uninstallFilter(t)}async _eth_newFilter(e){const t=e[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(t)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.getFilterChanges(t)}_eth_getFilterLogs(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.getFilterLogs(t)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then((e=>(e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),e.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=e,e)))}}ee.CoinbaseWalletProvider=Ad;var Nd={};Object.defineProperty(Nd,"__esModule",{value:!0}),Nd.RelayEventManager=void 0;const Od=d;Nd.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,Od.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}},Object.defineProperty(l,"__esModule",{value:!0}),l.CoinbaseWalletSDK=void 0;const Pd=u,Ld=h,Td=d,jd=X,Bd=ee,Dd=ne,Fd=zn,$d=Nd,Ud=xe,Hd=se,Vd=R;class qd{constructor(e){var t,r,n;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const s=e.linkAPIUrl||Ld.LINK_API_URL;void 0===e.overrideIsMetaMask?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=e.overrideIsMetaMask,this._overrideIsCoinbaseWallet=null===(t=e.overrideIsCoinbaseWallet)||void 0===t||t,this._overrideIsCoinbaseBrowser=null!==(r=e.overrideIsCoinbaseBrowser)&&void 0!==r&&r,this._diagnosticLogger=e.diagnosticLogger,this._reloadOnDisconnect=null===(n=e.reloadOnDisconnect)||void 0===n||n;const i=new URL(s),o=`${i.protocol}//${i.host}`;if(this._storage=new jd.ScopedLocalStorage(`-walletlink:${o}`),this._storage.setItem("version",qd.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new $d.RelayEventManager;const a=(0,Td.isMobileWeb)(),c=e.uiConstructor||(e=>a?new Fd.MobileRelayUI(e):new Ud.WalletLinkRelayUI(e)),l={linkAPIUrl:s,version:Vd.LIB_VERSION,darkMode:!!e.darkMode,headlessMode:!!e.headlessMode,uiConstructor:c,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:e.enableMobileWalletLink};this._relay=a?new Dd.MobileRelay(l):new Hd.WalletLinkRelay(l),this.setAppInfo(e.appName,e.appLogoUrl),e.headlessMode||this._relay.attachUI()}makeWeb3Provider(e="",t=1){const r=this.walletExtension;if(r)return this.isCipherProvider(r)||r.setProviderInfo(e,t),!1===this._reloadOnDisconnect&&"function"==typeof r.disableReloadOnDisconnect&&r.disableReloadOnDisconnect(),r;const n=this.coinbaseBrowser;if(n)return n;const s=this._relay;if(!s||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return e||s.setConnectDisabled(!0),new Bd.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(s),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:e,chainId:t,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(e,t){var r;this._appName=e||"DApp",this._appLogoUrl=t||(0,Td.getFavicon)();const n=this.walletExtension;n?this.isCipherProvider(n)||n.setAppInfo(this._appName,this._appLogoUrl):null===(r=this._relay)||void 0===r||r.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var e;const t=null==this?void 0:this.walletExtension;t?t.close():null===(e=this._relay)||void 0===e||e.resetAndReload()}getQrUrl(){var e,t;return null!==(t=null===(e=this._relay)||void 0===e?void 0:e.getQRCodeUrl())&&void 0!==t?t:null}getCoinbaseWalletLogo(e,t=240){return(0,Pd.walletLogo)(e,t)}get walletExtension(){var e;return null!==(e=window.coinbaseWalletExtension)&&void 0!==e?e:window.walletLinkExtension}get coinbaseBrowser(){var e,t;try{const r=null!==(e=window.ethereum)&&void 0!==e?e:null===(t=window.top)||void 0===t?void 0:t.ethereum;if(!r)return;return"isCoinbaseBrowser"in r&&r.isCoinbaseBrowser?r:void 0}catch(r){return}}isCipherProvider(e){return"boolean"==typeof e.isCipher&&e.isCipher}}l.CoinbaseWalletSDK=qd,qd.VERSION=Vd.LIB_VERSION,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletProvider=e.CoinbaseWalletSDK=void 0;const t=l,r=ee;var n=l;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var s=ee;Object.defineProperty(e,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return s.CoinbaseWalletProvider}}),e.default=t.CoinbaseWalletSDK,"undefined"!=typeof window&&(window.CoinbaseWalletSDK=t.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=t.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)}(c);const Wd=r(c),zd=Object.freeze(Object.defineProperty({__proto__:null,default:Wd},Symbol.toStringTag,{value:"Module"}));export{zd as i}; +import{k as e,h as t,f as r}from"./index-Dm7MnfGv.js";import{r as n,e as s}from"./___vite-browser-external_commonjs-proxy-B7j9NnZI.js";import{s as i,r as o,j as a}from"./clsx.m-DBHroLNK.js";var c={},l={},u={};Object.defineProperty(u,"__esModule",{value:!0}),u.walletLogo=void 0;u.walletLogo=(e,t)=>{let r;switch(e){case"standard":default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`}};var h={};Object.defineProperty(h,"__esModule",{value:!0}),h.LINK_API_URL=void 0,h.LINK_API_URL="https://www.walletlink.org";var d={},p={exports:{}};!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function s(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:n.Buffer}catch(I){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function l(e,t,n,s){for(var i=0,o=0,a=Math.min(e.length,n),c=t;c=49?l-49+10:l>=17?l-17+10:l,r(l>=0&&o0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var s=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(s++,this.negative=1),s=0;s-=3)o=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[i]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===n)for(s=0,i=0;s>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)s=c(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=s>>>26):i+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=s>>>26):i+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,s=1;s<=67108863;s*=t)n++;n--,s=s/t|0;for(var i=e.length-r,o=i%n,a=Math.min(i,i-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(I){i.prototype.inspect=h}else i.prototype.inspect=h;function h(){return(this.red?""}var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],p=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var s=0|e.words[0],i=0|t.words[0],o=s*i,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var l=1;l>>26,h=67108863&c,d=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=d;p++){var f=l-p|0;u+=(o=(s=0|e.words[f])*(i=0|t.words[p])+h)/67108864|0,h=67108863&o}r.words[l]=0|h,c=0|u}return 0!==c?r.words[l]=0|c:r.length--,r._strip()}i.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){n="";for(var s=0,i=0,o=0;o>>24-s&16777215,(s+=2)>=26&&(s-=26,o--),n=0!==i||o!==this.length-1?d[6-c.length]+c+n:c+n}for(0!==i&&(n=i.toString(16)+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var l=p[e],u=f[e];n="";var h=this.clone();for(h.negative=0;!h.isZero();){var m=h.modrn(u).toString(e);n=(h=h.idivn(u)).isZero()?m+n:d[l-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,n){this._strip();var s=this.byteLength(),i=n||Math.max(1,s);r(s<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,s),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,s=0,i=0;s>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var s=0;s0&&(this.words[s]=~this.words[s]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,s=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<e.length?(r=this,n=e):(r=e,n=this);for(var s=0,i=0;i>>26;for(;0!==s&&i>>26;if(this.length=r.length,0!==s)this.words[this.length]=s,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,s=this.cmp(e);if(0===s)return this.negative=0,this.length=1,this.words[0]=0,this;s>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,p=0|o[1],f=8191&p,m=p>>>13,g=0|o[2],v=8191&g,y=g>>>13,w=0|o[3],_=8191&w,b=w>>>13,E=0|o[4],k=8191&E,M=E>>>13,S=0|o[5],C=8191&S,I=S>>>13,R=0|o[6],x=8191&R,A=R>>>13,N=0|o[7],O=8191&N,P=N>>>13,L=0|o[8],T=8191&L,j=L>>>13,B=0|o[9],D=8191&B,F=B>>>13,$=0|a[0],U=8191&$,H=$>>>13,V=0|a[1],q=8191&V,W=V>>>13,z=0|a[2],J=8191&z,G=z>>>13,Z=0|a[3],Q=8191&Z,Y=Z>>>13,K=0|a[4],X=8191&K,ee=K>>>13,te=0|a[5],re=8191&te,ne=te>>>13,se=0|a[6],ie=8191&se,oe=se>>>13,ae=0|a[7],ce=8191&ae,le=ae>>>13,ue=0|a[8],he=8191&ue,de=ue>>>13,pe=0|a[9],fe=8191&pe,me=pe>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(l+(n=Math.imul(h,U))|0)+((8191&(s=(s=Math.imul(h,H))+Math.imul(d,U)|0))<<13)|0;l=((i=Math.imul(d,H))+(s>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(f,U),s=(s=Math.imul(f,H))+Math.imul(m,U)|0,i=Math.imul(m,H);var ve=(l+(n=n+Math.imul(h,q)|0)|0)+((8191&(s=(s=s+Math.imul(h,W)|0)+Math.imul(d,q)|0))<<13)|0;l=((i=i+Math.imul(d,W)|0)+(s>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(v,U),s=(s=Math.imul(v,H))+Math.imul(y,U)|0,i=Math.imul(y,H),n=n+Math.imul(f,q)|0,s=(s=s+Math.imul(f,W)|0)+Math.imul(m,q)|0,i=i+Math.imul(m,W)|0;var ye=(l+(n=n+Math.imul(h,J)|0)|0)+((8191&(s=(s=s+Math.imul(h,G)|0)+Math.imul(d,J)|0))<<13)|0;l=((i=i+Math.imul(d,G)|0)+(s>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(_,U),s=(s=Math.imul(_,H))+Math.imul(b,U)|0,i=Math.imul(b,H),n=n+Math.imul(v,q)|0,s=(s=s+Math.imul(v,W)|0)+Math.imul(y,q)|0,i=i+Math.imul(y,W)|0,n=n+Math.imul(f,J)|0,s=(s=s+Math.imul(f,G)|0)+Math.imul(m,J)|0,i=i+Math.imul(m,G)|0;var we=(l+(n=n+Math.imul(h,Q)|0)|0)+((8191&(s=(s=s+Math.imul(h,Y)|0)+Math.imul(d,Q)|0))<<13)|0;l=((i=i+Math.imul(d,Y)|0)+(s>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(k,U),s=(s=Math.imul(k,H))+Math.imul(M,U)|0,i=Math.imul(M,H),n=n+Math.imul(_,q)|0,s=(s=s+Math.imul(_,W)|0)+Math.imul(b,q)|0,i=i+Math.imul(b,W)|0,n=n+Math.imul(v,J)|0,s=(s=s+Math.imul(v,G)|0)+Math.imul(y,J)|0,i=i+Math.imul(y,G)|0,n=n+Math.imul(f,Q)|0,s=(s=s+Math.imul(f,Y)|0)+Math.imul(m,Q)|0,i=i+Math.imul(m,Y)|0;var _e=(l+(n=n+Math.imul(h,X)|0)|0)+((8191&(s=(s=s+Math.imul(h,ee)|0)+Math.imul(d,X)|0))<<13)|0;l=((i=i+Math.imul(d,ee)|0)+(s>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,U),s=(s=Math.imul(C,H))+Math.imul(I,U)|0,i=Math.imul(I,H),n=n+Math.imul(k,q)|0,s=(s=s+Math.imul(k,W)|0)+Math.imul(M,q)|0,i=i+Math.imul(M,W)|0,n=n+Math.imul(_,J)|0,s=(s=s+Math.imul(_,G)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,G)|0,n=n+Math.imul(v,Q)|0,s=(s=s+Math.imul(v,Y)|0)+Math.imul(y,Q)|0,i=i+Math.imul(y,Y)|0,n=n+Math.imul(f,X)|0,s=(s=s+Math.imul(f,ee)|0)+Math.imul(m,X)|0,i=i+Math.imul(m,ee)|0;var be=(l+(n=n+Math.imul(h,re)|0)|0)+((8191&(s=(s=s+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;l=((i=i+Math.imul(d,ne)|0)+(s>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(x,U),s=(s=Math.imul(x,H))+Math.imul(A,U)|0,i=Math.imul(A,H),n=n+Math.imul(C,q)|0,s=(s=s+Math.imul(C,W)|0)+Math.imul(I,q)|0,i=i+Math.imul(I,W)|0,n=n+Math.imul(k,J)|0,s=(s=s+Math.imul(k,G)|0)+Math.imul(M,J)|0,i=i+Math.imul(M,G)|0,n=n+Math.imul(_,Q)|0,s=(s=s+Math.imul(_,Y)|0)+Math.imul(b,Q)|0,i=i+Math.imul(b,Y)|0,n=n+Math.imul(v,X)|0,s=(s=s+Math.imul(v,ee)|0)+Math.imul(y,X)|0,i=i+Math.imul(y,ee)|0,n=n+Math.imul(f,re)|0,s=(s=s+Math.imul(f,ne)|0)+Math.imul(m,re)|0,i=i+Math.imul(m,ne)|0;var Ee=(l+(n=n+Math.imul(h,ie)|0)|0)+((8191&(s=(s=s+Math.imul(h,oe)|0)+Math.imul(d,ie)|0))<<13)|0;l=((i=i+Math.imul(d,oe)|0)+(s>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(O,U),s=(s=Math.imul(O,H))+Math.imul(P,U)|0,i=Math.imul(P,H),n=n+Math.imul(x,q)|0,s=(s=s+Math.imul(x,W)|0)+Math.imul(A,q)|0,i=i+Math.imul(A,W)|0,n=n+Math.imul(C,J)|0,s=(s=s+Math.imul(C,G)|0)+Math.imul(I,J)|0,i=i+Math.imul(I,G)|0,n=n+Math.imul(k,Q)|0,s=(s=s+Math.imul(k,Y)|0)+Math.imul(M,Q)|0,i=i+Math.imul(M,Y)|0,n=n+Math.imul(_,X)|0,s=(s=s+Math.imul(_,ee)|0)+Math.imul(b,X)|0,i=i+Math.imul(b,ee)|0,n=n+Math.imul(v,re)|0,s=(s=s+Math.imul(v,ne)|0)+Math.imul(y,re)|0,i=i+Math.imul(y,ne)|0,n=n+Math.imul(f,ie)|0,s=(s=s+Math.imul(f,oe)|0)+Math.imul(m,ie)|0,i=i+Math.imul(m,oe)|0;var ke=(l+(n=n+Math.imul(h,ce)|0)|0)+((8191&(s=(s=s+Math.imul(h,le)|0)+Math.imul(d,ce)|0))<<13)|0;l=((i=i+Math.imul(d,le)|0)+(s>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(T,U),s=(s=Math.imul(T,H))+Math.imul(j,U)|0,i=Math.imul(j,H),n=n+Math.imul(O,q)|0,s=(s=s+Math.imul(O,W)|0)+Math.imul(P,q)|0,i=i+Math.imul(P,W)|0,n=n+Math.imul(x,J)|0,s=(s=s+Math.imul(x,G)|0)+Math.imul(A,J)|0,i=i+Math.imul(A,G)|0,n=n+Math.imul(C,Q)|0,s=(s=s+Math.imul(C,Y)|0)+Math.imul(I,Q)|0,i=i+Math.imul(I,Y)|0,n=n+Math.imul(k,X)|0,s=(s=s+Math.imul(k,ee)|0)+Math.imul(M,X)|0,i=i+Math.imul(M,ee)|0,n=n+Math.imul(_,re)|0,s=(s=s+Math.imul(_,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0,n=n+Math.imul(v,ie)|0,s=(s=s+Math.imul(v,oe)|0)+Math.imul(y,ie)|0,i=i+Math.imul(y,oe)|0,n=n+Math.imul(f,ce)|0,s=(s=s+Math.imul(f,le)|0)+Math.imul(m,ce)|0,i=i+Math.imul(m,le)|0;var Me=(l+(n=n+Math.imul(h,he)|0)|0)+((8191&(s=(s=s+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;l=((i=i+Math.imul(d,de)|0)+(s>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(D,U),s=(s=Math.imul(D,H))+Math.imul(F,U)|0,i=Math.imul(F,H),n=n+Math.imul(T,q)|0,s=(s=s+Math.imul(T,W)|0)+Math.imul(j,q)|0,i=i+Math.imul(j,W)|0,n=n+Math.imul(O,J)|0,s=(s=s+Math.imul(O,G)|0)+Math.imul(P,J)|0,i=i+Math.imul(P,G)|0,n=n+Math.imul(x,Q)|0,s=(s=s+Math.imul(x,Y)|0)+Math.imul(A,Q)|0,i=i+Math.imul(A,Y)|0,n=n+Math.imul(C,X)|0,s=(s=s+Math.imul(C,ee)|0)+Math.imul(I,X)|0,i=i+Math.imul(I,ee)|0,n=n+Math.imul(k,re)|0,s=(s=s+Math.imul(k,ne)|0)+Math.imul(M,re)|0,i=i+Math.imul(M,ne)|0,n=n+Math.imul(_,ie)|0,s=(s=s+Math.imul(_,oe)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,oe)|0,n=n+Math.imul(v,ce)|0,s=(s=s+Math.imul(v,le)|0)+Math.imul(y,ce)|0,i=i+Math.imul(y,le)|0,n=n+Math.imul(f,he)|0,s=(s=s+Math.imul(f,de)|0)+Math.imul(m,he)|0,i=i+Math.imul(m,de)|0;var Se=(l+(n=n+Math.imul(h,fe)|0)|0)+((8191&(s=(s=s+Math.imul(h,me)|0)+Math.imul(d,fe)|0))<<13)|0;l=((i=i+Math.imul(d,me)|0)+(s>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(D,q),s=(s=Math.imul(D,W))+Math.imul(F,q)|0,i=Math.imul(F,W),n=n+Math.imul(T,J)|0,s=(s=s+Math.imul(T,G)|0)+Math.imul(j,J)|0,i=i+Math.imul(j,G)|0,n=n+Math.imul(O,Q)|0,s=(s=s+Math.imul(O,Y)|0)+Math.imul(P,Q)|0,i=i+Math.imul(P,Y)|0,n=n+Math.imul(x,X)|0,s=(s=s+Math.imul(x,ee)|0)+Math.imul(A,X)|0,i=i+Math.imul(A,ee)|0,n=n+Math.imul(C,re)|0,s=(s=s+Math.imul(C,ne)|0)+Math.imul(I,re)|0,i=i+Math.imul(I,ne)|0,n=n+Math.imul(k,ie)|0,s=(s=s+Math.imul(k,oe)|0)+Math.imul(M,ie)|0,i=i+Math.imul(M,oe)|0,n=n+Math.imul(_,ce)|0,s=(s=s+Math.imul(_,le)|0)+Math.imul(b,ce)|0,i=i+Math.imul(b,le)|0,n=n+Math.imul(v,he)|0,s=(s=s+Math.imul(v,de)|0)+Math.imul(y,he)|0,i=i+Math.imul(y,de)|0;var Ce=(l+(n=n+Math.imul(f,fe)|0)|0)+((8191&(s=(s=s+Math.imul(f,me)|0)+Math.imul(m,fe)|0))<<13)|0;l=((i=i+Math.imul(m,me)|0)+(s>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(D,J),s=(s=Math.imul(D,G))+Math.imul(F,J)|0,i=Math.imul(F,G),n=n+Math.imul(T,Q)|0,s=(s=s+Math.imul(T,Y)|0)+Math.imul(j,Q)|0,i=i+Math.imul(j,Y)|0,n=n+Math.imul(O,X)|0,s=(s=s+Math.imul(O,ee)|0)+Math.imul(P,X)|0,i=i+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,s=(s=s+Math.imul(x,ne)|0)+Math.imul(A,re)|0,i=i+Math.imul(A,ne)|0,n=n+Math.imul(C,ie)|0,s=(s=s+Math.imul(C,oe)|0)+Math.imul(I,ie)|0,i=i+Math.imul(I,oe)|0,n=n+Math.imul(k,ce)|0,s=(s=s+Math.imul(k,le)|0)+Math.imul(M,ce)|0,i=i+Math.imul(M,le)|0,n=n+Math.imul(_,he)|0,s=(s=s+Math.imul(_,de)|0)+Math.imul(b,he)|0,i=i+Math.imul(b,de)|0;var Ie=(l+(n=n+Math.imul(v,fe)|0)|0)+((8191&(s=(s=s+Math.imul(v,me)|0)+Math.imul(y,fe)|0))<<13)|0;l=((i=i+Math.imul(y,me)|0)+(s>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(D,Q),s=(s=Math.imul(D,Y))+Math.imul(F,Q)|0,i=Math.imul(F,Y),n=n+Math.imul(T,X)|0,s=(s=s+Math.imul(T,ee)|0)+Math.imul(j,X)|0,i=i+Math.imul(j,ee)|0,n=n+Math.imul(O,re)|0,s=(s=s+Math.imul(O,ne)|0)+Math.imul(P,re)|0,i=i+Math.imul(P,ne)|0,n=n+Math.imul(x,ie)|0,s=(s=s+Math.imul(x,oe)|0)+Math.imul(A,ie)|0,i=i+Math.imul(A,oe)|0,n=n+Math.imul(C,ce)|0,s=(s=s+Math.imul(C,le)|0)+Math.imul(I,ce)|0,i=i+Math.imul(I,le)|0,n=n+Math.imul(k,he)|0,s=(s=s+Math.imul(k,de)|0)+Math.imul(M,he)|0,i=i+Math.imul(M,de)|0;var Re=(l+(n=n+Math.imul(_,fe)|0)|0)+((8191&(s=(s=s+Math.imul(_,me)|0)+Math.imul(b,fe)|0))<<13)|0;l=((i=i+Math.imul(b,me)|0)+(s>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(D,X),s=(s=Math.imul(D,ee))+Math.imul(F,X)|0,i=Math.imul(F,ee),n=n+Math.imul(T,re)|0,s=(s=s+Math.imul(T,ne)|0)+Math.imul(j,re)|0,i=i+Math.imul(j,ne)|0,n=n+Math.imul(O,ie)|0,s=(s=s+Math.imul(O,oe)|0)+Math.imul(P,ie)|0,i=i+Math.imul(P,oe)|0,n=n+Math.imul(x,ce)|0,s=(s=s+Math.imul(x,le)|0)+Math.imul(A,ce)|0,i=i+Math.imul(A,le)|0,n=n+Math.imul(C,he)|0,s=(s=s+Math.imul(C,de)|0)+Math.imul(I,he)|0,i=i+Math.imul(I,de)|0;var xe=(l+(n=n+Math.imul(k,fe)|0)|0)+((8191&(s=(s=s+Math.imul(k,me)|0)+Math.imul(M,fe)|0))<<13)|0;l=((i=i+Math.imul(M,me)|0)+(s>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(D,re),s=(s=Math.imul(D,ne))+Math.imul(F,re)|0,i=Math.imul(F,ne),n=n+Math.imul(T,ie)|0,s=(s=s+Math.imul(T,oe)|0)+Math.imul(j,ie)|0,i=i+Math.imul(j,oe)|0,n=n+Math.imul(O,ce)|0,s=(s=s+Math.imul(O,le)|0)+Math.imul(P,ce)|0,i=i+Math.imul(P,le)|0,n=n+Math.imul(x,he)|0,s=(s=s+Math.imul(x,de)|0)+Math.imul(A,he)|0,i=i+Math.imul(A,de)|0;var Ae=(l+(n=n+Math.imul(C,fe)|0)|0)+((8191&(s=(s=s+Math.imul(C,me)|0)+Math.imul(I,fe)|0))<<13)|0;l=((i=i+Math.imul(I,me)|0)+(s>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(D,ie),s=(s=Math.imul(D,oe))+Math.imul(F,ie)|0,i=Math.imul(F,oe),n=n+Math.imul(T,ce)|0,s=(s=s+Math.imul(T,le)|0)+Math.imul(j,ce)|0,i=i+Math.imul(j,le)|0,n=n+Math.imul(O,he)|0,s=(s=s+Math.imul(O,de)|0)+Math.imul(P,he)|0,i=i+Math.imul(P,de)|0;var Ne=(l+(n=n+Math.imul(x,fe)|0)|0)+((8191&(s=(s=s+Math.imul(x,me)|0)+Math.imul(A,fe)|0))<<13)|0;l=((i=i+Math.imul(A,me)|0)+(s>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(D,ce),s=(s=Math.imul(D,le))+Math.imul(F,ce)|0,i=Math.imul(F,le),n=n+Math.imul(T,he)|0,s=(s=s+Math.imul(T,de)|0)+Math.imul(j,he)|0,i=i+Math.imul(j,de)|0;var Oe=(l+(n=n+Math.imul(O,fe)|0)|0)+((8191&(s=(s=s+Math.imul(O,me)|0)+Math.imul(P,fe)|0))<<13)|0;l=((i=i+Math.imul(P,me)|0)+(s>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(D,he),s=(s=Math.imul(D,de))+Math.imul(F,he)|0,i=Math.imul(F,de);var Pe=(l+(n=n+Math.imul(T,fe)|0)|0)+((8191&(s=(s=s+Math.imul(T,me)|0)+Math.imul(j,fe)|0))<<13)|0;l=((i=i+Math.imul(j,me)|0)+(s>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Le=(l+(n=Math.imul(D,fe))|0)+((8191&(s=(s=Math.imul(D,me))+Math.imul(F,fe)|0))<<13)|0;return l=((i=Math.imul(F,me))+(s>>>13)|0)+(Le>>>26)|0,Le&=67108863,c[0]=ge,c[1]=ve,c[2]=ye,c[3]=we,c[4]=_e,c[5]=be,c[6]=Ee,c[7]=ke,c[8]=Me,c[9]=Se,c[10]=Ce,c[11]=Ie,c[12]=Re,c[13]=xe,c[14]=Ae,c[15]=Ne,c[16]=Oe,c[17]=Pe,c[18]=Le,0!==l&&(c[19]=l,r.length++),r};function v(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,s=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=a,n=o,o=s}return 0!==n?r.words[i]=n:r.length--,r._strip()}function y(e,t,r){return v(e,t,r)}Math.imul||(g=m),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?m(this,e,t):r<1024?v(this,e,t):y(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),y(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),r("number"==typeof e),r(e<67108864);for(var n=0,s=0;s>=26,n+=i/67108864|0,n+=o>>>26,this.words[s]=67108863&o}return 0!==n&&(this.words[s]=n,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>s&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,n=e%26,s=(e-n)/26,i=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(t=0;t>>26-n}o&&(this.words[t]=o,this.length++)}if(0!==s){for(t=this.length-1;t>=0;t--)this.words[t+s]=this.words[t];for(t=0;t=0),s=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),a=67108863^67108863>>>i<o)for(this.length-=o,l=0;l=0&&(0!==u||l>=s);l--){var h=0|this.words[l];this.words[l]=u<<26-i|h>>>i,u=h&a}return c&&0!==u&&(c.words[c.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,s=1<=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var s=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[s+n]=67108863&i}for(;s>26,this.words[s+n]=67108863&i;if(0===a)return this._strip();for(r(-1===a),a=0,s=0;s>26,this.words[s]=67108863&i;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),s=e,o=0|s.words[s.length-1];0!=(r=26-this._countBits(o))&&(s=s.ushln(r),n.iushln(r),o=0|s.words[s.length-1]);var a,c=n.length-s.length;if("mod"!==t){(a=new i(null)).length=c+1,a.words=new Array(a.length);for(var l=0;l=0;h--){var d=67108864*(0|n.words[s.length+h])+(0|n.words[s.length+h-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(s,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(s,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=d)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(s=a.div.neg()),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.iadd(e)),{div:s,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(s=a.div.neg()),{div:s,mod:a.mod}):this.negative&e.negative?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),n&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var s,o,a},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),s=e.andln(1),i=r.cmp(n);return i<0||1===s&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=(1<<26)%e,s=0,i=this.length-1;i>=0;i--)s=(n*s+(0|this.words[i]))%e;return t?-s:s},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),r(e<=67108863);for(var n=0,s=this.length-1;s>=0;s--){var i=(0|this.words[s])+67108864*n;this.words[s]=i/e|0,n=i%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s=new i(1),o=new i(0),a=new i(0),c=new i(1),l=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++l;for(var u=n.clone(),h=t.clone();!t.isZero();){for(var d=0,p=1;!(t.words[0]&p)&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(s.isOdd()||o.isOdd())&&(s.iadd(u),o.isub(h)),s.iushrn(1),o.iushrn(1);for(var f=0,m=1;!(n.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),s.isub(a),o.isub(c)):(n.isub(t),a.isub(s),c.isub(o))}return{a:a,b:c,gcd:n.iushln(l)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var s,o=new i(1),a=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;!(t.words[0]&u)&&l<26;++l,u<<=1);if(l>0)for(t.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,d=1;!(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(a)):(n.isub(t),a.isub(o))}return(s=0===t.cmpn(1)?o:a).cmpn(0)<0&&s.iadd(e),s},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var s=t.cmp(r);if(s<0){var i=t;t=r,r=i}else if(0===s||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,s=1<>>26,a&=67108863,this.words[o]=a}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this._strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var s=0|this.words[0];t=s===e?0:se.length)return 1;if(this.length=0;r--){var n=0|this.words[r],s=0|e.words[r];if(n!==s){ns&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new S(e)},i.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function _(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){_.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){_.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){_.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){_.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}_.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},_.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},_.prototype.split=function(e,t){e.iushrn(this.n,0,t)},_.prototype.imulK=function(e){return e.imul(this.k)},s(b,_),b.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),s=0;s>>22,i=o}i>>>=22,e.words[s-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=s,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new E;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return w[e]=t,t},S.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new i(1)).iushrn(2);return this.pow(e,n)}for(var s=this.m.subn(1),o=0;!s.isZero()&&0===s.andln(1);)o++,s.iushrn(1);r(!s.isZero());var a=new i(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,s),d=this.pow(e,s.addn(1).iushrn(1)),p=this.pow(e,s),f=o;0!==p.cmp(a);){for(var m=p,g=0;0!==m.cmp(a);g++)m=m.redSqr();r(g=0;n--){for(var l=t.words[n],u=c-1;u>=0;u--){var h=l>>u&1;s!==r[0]&&(s=this.sqr(s)),0!==h||0!==o?(o<<=1,o|=h,(4==++a||0===n&&0===u)&&(s=this.mul(s,r[o]),a=0,o=0)):a=0}c=26}return s},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new C(e)},s(C,S),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),i=s;return s.cmp(this.m)>=0?i=s.isub(this.m):s.cmpn(0)<0&&(i=s.iadd(this.m)),i._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),s=r.isub(n).iushrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(p,e);var f=p.exports,m={},g={};Object.defineProperty(g,"__esModule",{value:!0}),g.errorValues=g.standardErrorCodes=void 0,g.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}},g.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 v={},y={};!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=g,r="Unspecified error message.";function n(n,s=r){if(n&&Number.isInteger(n)){const r=n.toString();if(a(t.errorValues,r))return t.errorValues[r].message;if(i(n))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return s}function s(e){if(!Number.isInteger(e))return!1;const r=e.toString();return!!t.errorValues[r]||!!i(e)}function i(e){return e>=-32099&&e<=-32e3}function o(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function a(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=n,e.isValidCode=s,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:i=!1}={}){const l={};if(e&&"object"==typeof e&&!Array.isArray(e)&&a(e,"code")&&s(e.code)){const t=e;l.code=t.code,t.message&&"string"==typeof t.message?(l.message=t.message,a(t,"data")&&(l.data=t.data)):(l.message=n(l.code),l.data={originalError:o(e)})}else l.code=t.standardErrorCodes.rpc.internal,l.message=c(e,"message")?e.message:r,l.data={originalError:o(e)};return i&&(l.stack=c(e,"stack")?e.stack:void 0),l}}(y),Object.defineProperty(v,"__esModule",{value:!0}),v.standardErrors=void 0;const w=g,_=y;function b(e,t){const[r,n]=k(t);return new M(e,r||(0,_.getMessageFromCode)(e),n)}function E(e,t){const[r,n]=k(t);return new S(e,r||(0,_.getMessageFromCode)(e),n)}function k(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}v.standardErrors={rpc:{parse:e=>b(w.standardErrorCodes.rpc.parse,e),invalidRequest:e=>b(w.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>b(w.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>b(w.standardErrorCodes.rpc.methodNotFound,e),internal:e=>b(w.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return b(t,e)},invalidInput:e=>b(w.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>b(w.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>b(w.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>b(w.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>b(w.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>b(w.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>E(w.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>E(w.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>E(w.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>E(w.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>E(w.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>E(w.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new S(t,r,n)}}};let M=class extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}},S=class extends M{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};var C={},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.isErrorResponse=void 0,I.isErrorResponse=function(e){return void 0!==e.errorMessage};var R={};Object.defineProperty(R,"__esModule",{value:!0}),R.LIB_VERSION=void 0,R.LIB_VERSION="3.9.3",Object.defineProperty(C,"__esModule",{value:!0}),C.serializeError=void 0;const x=I,A=R,N=g,O=y;C.serializeError=function(e,t){const r=(0,O.serialize)(function(e){if("string"==typeof e)return{message:e,code:N.standardErrorCodes.rpc.internal};if((0,x.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",A.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=function(e,t){const r=null==e?void 0:e.method;if(r)return r;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(r.data,t);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=g;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=v;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=C;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=y;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})}(m);var P,L,T={};function j(){return e=>e}Object.defineProperty(T,"__esModule",{value:!0}),T.ProviderType=T.RegExpString=T.IntNumber=T.BigIntString=T.AddressString=T.HexString=T.OpaqueType=void 0,T.OpaqueType=j,T.HexString=e=>e,T.AddressString=e=>e,T.BigIntString=e=>e,T.IntNumber=function(e){return Math.floor(e)},T.RegExpString=e=>e,(L=P||(T.ProviderType=P={})).CoinbaseWallet="CoinbaseWallet",L.MetaMask="MetaMask",L.Unselected="";var B=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(d,"__esModule",{value:!0}),d.isMobileWeb=d.getLocation=d.isInIFrame=d.createQrUrl=d.getFavicon=d.range=d.isBigNumber=d.ensureParsedJSONObject=d.ensureBN=d.ensureRegExpString=d.ensureIntNumber=d.ensureBuffer=d.ensureAddressString=d.ensureEvenLengthHexString=d.ensureHexString=d.isHexString=d.prepend0x=d.strip0x=d.has0xPrefix=d.hexStringFromIntNumber=d.intNumberFromHexString=d.bigIntStringFromBN=d.hexStringFromBuffer=d.hexStringToUint8Array=d.uint8ArrayToHex=d.randomBytesHex=void 0;const D=B(f),F=m,$=T,U=/^[0-9]*$/,H=/^[a-f0-9]*$/;function V(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function q(e){return e.startsWith("0x")||e.startsWith("0X")}function W(e){return q(e)?e.slice(2):e}function z(e){return q(e)?`0x${e.slice(2)}`:`0x${e}`}function J(e){if("string"!=typeof e)return!1;const t=W(e).toLowerCase();return H.test(t)}function G(e,t=!1){if("string"==typeof e){const r=W(e).toLowerCase();if(H.test(r))return(0,$.HexString)(t?`0x${r}`:r)}throw F.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function Z(e,t=!1){let r=G(e,!1);return r.length%2==1&&(r=(0,$.HexString)(`0${r}`)),t?(0,$.HexString)(`0x${r}`):r}function Q(e){if("number"==typeof e&&Number.isInteger(e))return(0,$.IntNumber)(e);if("string"==typeof e){if(U.test(e))return(0,$.IntNumber)(Number(e));if(J(e))return(0,$.IntNumber)(new D.default(Z(e,!1),16).toNumber())}throw F.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function Y(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}function K(){try{return null!==window.frameElement}catch(e){return!1}}d.randomBytesHex=function(e){return V(crypto.getRandomValues(new Uint8Array(e)))},d.uint8ArrayToHex=V,d.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},d.hexStringFromBuffer=function(e,t=!1){const r=e.toString("hex");return(0,$.HexString)(t?`0x${r}`:r)},d.bigIntStringFromBN=function(e){return(0,$.BigIntString)(e.toString(10))},d.intNumberFromHexString=function(e){return(0,$.IntNumber)(new D.default(Z(e,!1),16).toNumber())},d.hexStringFromIntNumber=function(e){return(0,$.HexString)(`0x${new D.default(e).toString(16)}`)},d.has0xPrefix=q,d.strip0x=W,d.prepend0x=z,d.isHexString=J,d.ensureHexString=G,d.ensureEvenLengthHexString=Z,d.ensureAddressString=function(e){if("string"==typeof e){const t=W(e).toLowerCase();if(J(t)&&40===t.length)return(0,$.AddressString)(z(t))}throw F.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},d.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(J(e)){const t=Z(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw F.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},d.ensureIntNumber=Q,d.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,$.RegExpString)(e.toString());throw F.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},d.ensureBN=function(e){if(null!==e&&(D.default.isBN(e)||Y(e)))return new D.default(e.toString(10),10);if("number"==typeof e)return new D.default(Q(e));if("string"==typeof e){if(U.test(e))return new D.default(e,10);if(J(e))return new D.default(Z(e,!1),16)}throw F.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},d.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw F.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},d.isBigNumber=Y,d.range=function(e,t){return Array.from({length:t-e},((t,r)=>e+r))},d.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`},d.createQrUrl=function(e,t,r,n,s,i){const o=n?"parent-id":"id";return`${r}/#/link?${new URLSearchParams({[o]:e,secret:t,server:r,v:s,chainId:i.toString()}).toString()}`},d.isInIFrame=K,d.getLocation=function(){try{return K()&&window.top?window.top.location:window.location}catch(e){return window.location}},d.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)};var X={};Object.defineProperty(X,"__esModule",{value:!0}),X.ScopedLocalStorage=void 0;X.ScopedLocalStorage=class{constructor(e){this.scope=e}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(e)))}scopedKey(e){return`${this.scope}:${e}`}};var ee={},te={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function s(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,s=[];if(0===this._eventsCount)return s;for(n in e=this._events)t.call(e,n)&&s.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,i=n.length,o=new Array(i);se.json())).then((t=>{if(!t)throw ae.standardErrors.rpc.parse({});const r=t,{error:n}=r;if(n)throw(0,ae.serializeError)(n,e.method);return r}))}};var ce={};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Session=void 0;const le=i,ue=d,he="session:id",de="session:secret",pe="session:linked";class fe{constructor(e,t,r,n){this._storage=e,this._id=t||(0,ue.randomBytesHex)(16),this._secret=r||(0,ue.randomBytesHex)(32),this._key=(new le.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!n}static load(e){const t=e.getItem(he),r=e.getItem(pe),n=e.getItem(de);return t&&n?new fe(e,t,n,"1"===r):null}static hash(e){return(new le.sha256).update(e).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(he,this._id),this._storage.setItem(de,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(pe,this._linked?"1":"0")}}ce.Session=fe;var me={},ge={};Object.defineProperty(ge,"__esModule",{value:!0}),ge.Cipher=void 0;const ve=d;ge.Cipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.importKey("raw",(0,ve.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,i=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},n,s.encode(e)),o=i.slice(i.byteLength-16),a=i.slice(0,i.byteLength-16),c=new Uint8Array(o),l=new Uint8Array(a),u=new Uint8Array([...r,...c,...l]);return(0,ve.uint8ArrayToHex)(u)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((r,n)=>{!async function(){const s=await crypto.subtle.importKey("raw",(0,ve.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=(0,ve.hexStringToUint8Array)(e),o=i.slice(0,12),a=i.slice(12,28),c=i.slice(28),l=new Uint8Array([...c,...a]),u={name:"AES-GCM",iv:new Uint8Array(o)};try{const e=await window.crypto.subtle.decrypt(u,s,l),t=new TextDecoder;r(t.decode(e))}catch(h){n(h)}}()}))}};var ye={};Object.defineProperty(ye,"__esModule",{value:!0}),ye.WalletLinkHTTP=void 0;ye.WalletLinkHTTP=class{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const n=`${t}:${r}`;this.auth=`Basic ${btoa(n)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:n}=await t.json();if(n)throw new Error(`Check unseen events failed: ${n}`);const s=null!==(e=null==r?void 0:r.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${t.status}`)}};var we,_e,be={};Object.defineProperty(be,"__esModule",{value:!0}),be.WalletLinkWebSocket=be.ConnectionState=void 0,(_e=we||(be.ConnectionState=we={}))[_e.DISCONNECTED=0]="DISCONNECTED",_e[_e.CONNECTING=1]="CONNECTING",_e[_e.CONNECTED=2]="CONNECTED";be.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var r;let n;try{this.webSocket=n=new this.WebSocketClass(this.url)}catch(s){return void t(s)}null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.CONNECTING),n.onclose=e=>{var r;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.DISCONNECTED)},n.onopen=t=>{var r;if(e(),null===(r=this.connectionStateListener)||void 0===r||r.call(this,we.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},n.onmessage=e=>{var t,r;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(r=this.incomingDataListener)||void 0===r||r.call(this,t)}catch(n){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,we.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(r){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(me,"__esModule",{value:!0}),me.WalletLinkConnection=void 0;const Ee=T,ke=ge,Me=ie,Se=oe,Ce=ce,Ie=ye,Re=be;me.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:r,diagnostic:n,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Ee.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach(((t,r)=>{const n=e[r];void 0!==n&&t(n)}))},this.handleDestroyed=e=>{var t,r;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload(),null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Ce.Session.hash(this.session.id)}))},this.handleAccountUpdated=async e=>{var t,r;try{const r=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(r)}catch(n){null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.metadataUpdated(e,n)}catch(s){null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:e})}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(Se.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(Se.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var r,n;try{const n=await this.cipher.decrypt(e),s=await this.cipher.decrypt(t);null===(r=this.listener)||void 0===r||r.chainUpdated(n,s)}catch(s){null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new ke.Cipher(e.secret),this.diagnostic=n,this.listener=r;const i=new Re.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener((async t=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.CONNECTED_STATE_CHANGE,{state:t,sessionIdHash:Ce.Session.hash(e.id)});let n=!1;switch(t){case Re.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||i.connect().catch((()=>{e()}))};e()}break;case Re.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),n=!0}catch(s){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case Re.ConnectionState.CONNECTING:}this.connected!==n&&(this.connected=n)})),i.setIncomingDataListener((t=>{var r,n,s;switch(t.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const n="IsLinkedOK"===t.type?t.linked:void 0;null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.LINKED,{sessionIdHash:Ce.Session.hash(e.id),linked:n,type:t.type,onlineGuests:t.onlineGuests}),this.linked=n||t.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":null===(n=this.diagnostic)||void 0===n||n.log(Me.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Ce.Session.hash(e.id),metadata_keys:t&&t.metadata?Object.keys(t.metadata):void 0}),this.handleSessionMetadataUpdated(t.metadata);break;case"Event":this.handleIncomingEvent(t)}void 0!==t.id&&(null===(s=this.requestResolutions.get(t.id))||void 0===s||s(t))})),this.ws=i,this.http=new Ie.WalletLinkHTTP(t,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");null===(e=this.diagnostic)||void 0===e||e.log(Me.EVENTS.STARTED_CONNECTING,{sessionIdHash:Ce.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),null===(e=this.diagnostic)||void 0===e||e.log(Me.EVENTS.DISCONNECTED,{sessionIdHash:Ce.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t,r;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this)),null===(r=this.listener)||void 0===r||r.connectedUpdated(e)}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(r=this.listener)||void 0===r||r.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t,r;if("Event"===e.type&&"Web3Response"===e.event)try{const r=await this.cipher.decrypt(e.data),n=JSON.parse(r);if("WEB3_RESPONSE"!==n.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(n)}catch(n){null===(r=this.diagnostic)||void 0===r||r.log(Me.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(r);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,r=!1){const n=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:n,callWebhook:r};return this.setOnceLinked((async()=>{const e=await this.makeRequest(s);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const r=e.id;let n;return this.sendData(e),Promise.race([new Promise(((e,s)=>{n=window.setTimeout((()=>{s(new Error(`request ${r} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(r,(t=>{clearTimeout(n),e(t),this.requestResolutions.delete(r)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,Ee.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var xe={},Ae={},Ne={};Object.defineProperty(Ne,"__esModule",{value:!0}),Ne.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 Oe=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.injectCssReset=void 0;const Pe=Oe(Ne);Ae.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Pe.default)),document.documentElement.appendChild(e)};var Le,Te,je,Be,De,Fe,$e,Ue,He,Ve,qe,We,ze={},Je={},Ge=[],Ze=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;function Ye(e,t){for(var r in t)e[r]=t[r];return e}function Ke(e){var t=e.parentNode;t&&t.removeChild(e)}function Xe(e,t,r){var n,s,i,o={};for(i in t)"key"==i?n=t[i]:"ref"==i?s=t[i]:o[i]=t[i];if(arguments.length>2&&(o.children=arguments.length>3?Le.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===o[i]&&(o[i]=e.defaultProps[i]);return et(e,o,n,s,null)}function et(e,t,r,n,s){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++je:s,__i:-1,__u:0};return null==s&&null!=Te.vnode&&Te.vnode(i),i}function tt(e){return e.children}function rt(e,t){this.props=e,this.context=t}function nt(e,t){if(null==t)return e.__?nt(e.__,e.__i+1):null;for(var r;tt&&De.sort(Ue));ot.__r=0}function at(e,t,r,n,s,i,o,a,c,l,u){var h,d,p,f,m,g=n&&n.__k||Ge,v=t.length;for(r.__d=c,function(e,t,r){var n,s,i,o,a,c=t.length,l=r.length,u=l,h=0;for(e.__k=[],n=0;n0?et(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,a=lt(s,r,o,u),s.__i=a,i=null,-1!==a&&(u--,(i=r[a])&&(i.__u|=131072)),null==i||null===i.__v?(-1==a&&h--,"function"!=typeof s.type&&(s.__u|=65536)):a!==o&&(a===o+1?h++:a>o?u>c-o?h+=a-o:h--:a(null==c||131072&c.__u?0:1))for(;o>=0||a=0){if((c=t[o])&&!(131072&c.__u)&&s==c.key&&i===c.type)return o;o--}if(a2&&(a.children=arguments.length>3?Le.call(arguments,2):r),et(e.type,a,n||e.key,s||e.ref,null)},createContext:function(e,t){var r={__c:t="__cC"+We++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var r,n;return this.getChildContext||(r=[],(n={})[t]=this,this.getChildContext=function(){return n},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&r.some((function(e){e.__e=!0,it(e)}))},this.sub=function(e){r.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){r.splice(r.indexOf(e),1),t&&t.call(e)}}),e.children}};return r.Provider.__=r.Consumer.contextType=r},createElement:Xe,createRef:function(){return{current:null}},h:Xe,hydrate:function e(t,r){yt(t,r,e)},get isValidElement(){return Be},get options(){return Te},render:yt,toChildArray:function e(t,r){return r=r||[],null==t||"boolean"==typeof t||(Qe(t)?t.some((function(t){e(t,r)})):r.push(t)),r}},Symbol.toStringTag,{value:"Module"})),_t=t(wt);var bt,Et,kt,Mt,St={},Ct=0,It=[],Rt=[],xt=Te,At=xt.__b,Nt=xt.__r,Ot=xt.diffed,Pt=xt.__c,Lt=xt.unmount,Tt=xt.__;function jt(e,t){xt.__h&&xt.__h(Et,e,Ct||t),Ct=0;var r=Et.__H||(Et.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:Rt}),r.__[e]}function Bt(e){return Ct=1,Dt(Jt,e)}function Dt(e,t,r){var n=jt(bt++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):Jt(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=Et,!Et.u)){var s=function(e,t,r){if(!n.__c.__H)return!0;var s=n.__c.__H.__.filter((function(e){return!!e.__c}));if(s.every((function(e){return!e.__N})))return!i||i.call(this,e,t,r);var o=!1;return s.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),!(!o&&n.__c.props===e)&&(!i||i.call(this,e,t,r))};Et.u=!0;var i=Et.shouldComponentUpdate,o=Et.componentWillUpdate;Et.componentWillUpdate=function(e,t,r){if(this.__e){var n=i;i=void 0,s(e,t,r),i=n}o&&o.call(this,e,t,r)},Et.shouldComponentUpdate=s}return n.__N||n.__}function Ft(e,t){var r=jt(bt++,4);!xt.__s&&zt(r.__H,t)&&(r.__=e,r.i=t,Et.__h.push(r))}function $t(e,t){var r=jt(bt++,7);return zt(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function Ut(){for(var e;e=It.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(qt),e.__H.__h.forEach(Wt),e.__H.__h=[]}catch(t){e.__H.__h=[],xt.__e(t,e.__v)}}xt.__b=function(e){Et=null,At&&At(e)},xt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Tt&&Tt(e,t)},xt.__r=function(e){Nt&&Nt(e),bt=0;var t=(Et=e.__c).__H;t&&(kt===Et?(t.__h=[],Et.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Rt,e.__N=e.i=void 0}))):(t.__h.forEach(qt),t.__h.forEach(Wt),t.__h=[],bt=0)),kt=Et},xt.diffed=function(e){Ot&&Ot(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==It.push(t)&&Mt===xt.requestAnimationFrame||((Mt=xt.requestAnimationFrame)||Vt)(Ut)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Rt&&(e.__=e.__V),e.i=void 0,e.__V=Rt}))),kt=Et=null},xt.__c=function(e,t){t.some((function(e){try{e.__h.forEach(qt),e.__h=e.__h.filter((function(e){return!e.__||Wt(e)}))}catch(r){t.some((function(e){e.__h&&(e.__h=[])})),t=[],xt.__e(r,e.__v)}})),Pt&&Pt(e,t)},xt.unmount=function(e){Lt&&Lt(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach((function(e){try{qt(e)}catch(r){t=r}})),r.__H=void 0,t&&xt.__e(t,r.__v))};var Ht="function"==typeof requestAnimationFrame;function Vt(e){var t,r=function(){clearTimeout(n),Ht&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Ht&&(t=requestAnimationFrame(r))}function qt(e){var t=Et,r=e.__c;"function"==typeof r&&(e.__c=void 0,r()),Et=t}function Wt(e){var t=Et;e.__c=e.__(),Et=t}function zt(e,t){return!e||e.length!==t.length||t.some((function(t,r){return t!==e[r]}))}function Jt(e,t){return"function"==typeof t?t(e):t}const Gt=Object.freeze(Object.defineProperty({__proto__:null,useCallback:function(e,t){return Ct=8,$t((function(){return e}),t)},useContext:function(e){var t=Et.context[e.__c],r=jt(bt++,9);return r.c=e,t?(null==r.__&&(r.__=!0,t.sub(Et)),t.props.value):e.__},useDebugValue:function(e,t){xt.useDebugValue&&xt.useDebugValue(t?t(e):e)},useEffect:function(e,t){var r=jt(bt++,3);!xt.__s&&zt(r.__H,t)&&(r.__=e,r.i=t,Et.__H.__h.push(r))},useErrorBoundary:function(e){var t=jt(bt++,10),r=Bt();return t.__=e,Et.componentDidCatch||(Et.componentDidCatch=function(e,n){t.__&&t.__(e,n),r[1](e)}),[r[0],function(){r[1](void 0)}]},useId:function(){var e=jt(bt++,11);if(!e.__){for(var t=Et.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__},useImperativeHandle:function(e,t,r){Ct=6,Ft((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==r?r:r.concat(e))},useLayoutEffect:Ft,useMemo:$t,useReducer:Dt,useRef:function(e){return Ct=5,$t((function(){return{current:e}}),[])},useState:Bt},Symbol.toStringTag,{value:"Module"})),Zt=t(Gt);var Qt={},Yt={};Object.defineProperty(Yt,"__esModule",{value:!0}),Yt.CloseIcon=void 0;const Kt=_t;Yt.CloseIcon=function(e){return(0,Kt.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,Kt.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"}))};var Xt={};Object.defineProperty(Xt,"__esModule",{value:!0}),Xt.CoinbaseWalletRound=void 0;const er=_t;Xt.CoinbaseWalletRound=function(e){return(0,er.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),(0,er.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,er.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,er.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"}))};var tr={};Object.defineProperty(tr,"__esModule",{value:!0}),tr.QRCodeIcon=void 0;const rr=_t;tr.QRCodeIcon=function(e){return(0,rr.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},e),(0,rr.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,rr.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,rr.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,rr.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))};var nr={};function sr(e){this.mode=or.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t65536?(n[0]=240|(1835008&s)>>>18,n[1]=128|(258048&s)>>>12,n[2]=128|(4032&s)>>>6,n[3]=128|63&s):s>2048?(n[0]=224|(61440&s)>>>12,n[1]=128|(4032&s)>>>6,n[2]=128|63&s):s>128?(n[0]=192|(1984&s)>>>6,n[1]=128|63&s):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function ir(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}sr.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=ir.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||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=wr.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var s=0;s>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&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=wr.getBCHTypeInfo(r),s=0;s<15;s++){var i=!e&&1==(n>>s&1);s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(s=0;s<15;s++){i=!e&&1==(n>>s&1);s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(6==o&&o--;;){for(var a=0;a<2;a++)if(null==this.modules[n][o-a]){var c=!1;i>>s&1)),wr.getMask(t,n,o-a)&&(c=!c),this.modules[n][o-a]=c,-1==--s&&(i++,s=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},ir.PAD0=236,ir.PAD1=17,ir.createData=function(e,t,r){for(var n=kr.getRSBlocks(e,t),s=new Mr,i=0;i8*a)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+8*a+")");for(s.getLengthInBits()+4<=8*a&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=8*a||(s.put(ir.PAD0,8),s.getLengthInBits()>=8*a));)s.put(ir.PAD1,8);return ir.createBytes(s,n)},ir.createBytes=function(e,t){for(var r=0,n=0,s=0,i=new Array(t.length),o=new Array(t.length),a=0;a=0?d.get(p):0}}var f=0;for(u=0;u=0;)t^=wr.G15<=0;)t^=wr.G18<>>=1;return t},getPatternPosition:function(e){return wr.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case hr:return(t+r)%2==0;case dr:return t%2==0;case pr:return r%3==0;case fr:return(t+r)%3==0;case mr:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case gr:return t*r%2+t*r%3==0;case vr:return(t*r%2+t*r%3)%2==0;case yr:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Er([1],0),r=0;r5&&(r+=3+i-5)}for(n=0;n=256;)e-=255;return _r.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},br=0;br<8;br++)_r.EXP_TABLE[br]=1<>>7-e%8&1)},put:function(e,t){for(var r=0;r>>t-r-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 Sr=[[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 Cr(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)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!");var r=this.options.content,n=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,s=0,i=0,o=Sr.length;i<=o;i++){var a=Sr[i];if(!a)throw new Error("Content too long: expected "+s+" but got "+r);switch(t){case"L":s=a[0];break;case"M":s=a[1];break;case"Q":s=a[2];break;case"H":s=a[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=s)break;n++}if(n>Sr.length)throw new Error("Content too long");return n}(r,this.options.ecl),s=function(e){switch(e){case"L":return ar;case"M":return cr;case"Q":return lr;case"H":return ur;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new ir(n,s),this.qrcode.addData(r),this.qrcode.make()}Cr.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,s=n?" ":"",i=n?"\r\n":"",o=t.width,a=t.height,c=r.length,l=o/(c+2*t.padding),u=a/(c+2*t.padding),h=void 0!==t.join&&!!t.join,d=void 0!==t.swap&&!!t.swap,p=void 0===t.xmlDeclaration||!!t.xmlDeclaration,f=void 0!==t.predefined&&!!t.predefined,m=f?s+''+i:"",g=s+''+i,v="",y="",w=0;w'+i:s+''+i}}h&&(v=s+'');let C="";if(void 0!==this.options.image&&this.options.image.svg){const e=o*this.options.image.width/100,t=a*this.options.image.height/100;C+=``,C+=this.options.image.svg+i,C+=""}var I="";switch(e.container){case"svg":p&&(I+=''+i),I+=''+i,I+=m+g+v,I+=C,I+="";break;case"svg-viewbox":p&&(I+=''+i),I+=''+i,I+=m+g+v,I+=C,I+="";break;case"g":I+=''+i,I+=m+g+v,I+=C,I+="";break;default:I+=(m+g+v+C).replace(/^\s+/,"")}return I};var Ir=Cr,Rr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nr,"__esModule",{value:!0}),nr.QRCode=void 0;const xr=_t,Ar=Zt,Nr=Rr(Ir);nr.QRCode=e=>{const[t,r]=(0,Ar.useState)("");return(0,Ar.useEffect)((()=>{var t,n;const s=new Nr.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:null!==(t=e.width)&&void 0!==t?t:256,height:null!==(n=e.height)&&void 0!==n?n:256,padding:0,image:e.image}),i=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${i}`)}),[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,xr.h)("img",{src:t,alt:"QR Code"}):null};var Or={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.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 Lr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Or,"__esModule",{value:!0}),Or.Spinner=void 0;const Tr=_t,jr=Lr(Pr);Or.Spinner=e=>{var t;const r=null!==(t=e.size)&&void 0!==t?t:64,n=e.color||"#000";return(0,Tr.h)("div",{class:"-cbwsdk-spinner"},(0,Tr.h)("style",null,jr.default),(0,Tr.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Tr.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};var Br={};Object.defineProperty(Br,"__esModule",{value:!0}),Br.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 Dr=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.CoinbaseWalletSteps=Qt.ConnectContent=void 0;const Fr=Dr(o),$r=_t,Ur=d,Hr=R,Vr=Yt,qr=Xt,Wr=tr,zr=nr,Jr=Or,Gr=Dr(Br),Zr="Coinbase Wallet app",Qr="Connect with your self-custody wallet",Yr=en,Kr=e=>"light"===e?"#FFFFFF":"#0A0B0D";function Xr({title:e,description:t,theme:r}){return(0,$r.h)("div",{className:(0,Fr.default)("-cbwsdk-connect-item",r)},(0,$r.h)("div",null,(0,$r.h)(qr.CoinbaseWalletRound,null)),(0,$r.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,$r.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,$r.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function en({theme:e}){return(0,$r.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,$r.h)("li",{className:(0,Fr.default)("-cbwsdk-wallet-steps-item",e)},(0,$r.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,$r.h)("li",{className:(0,Fr.default)("-cbwsdk-wallet-steps-item",e)},(0,$r.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,$r.h)("span",null,"Tap ",(0,$r.h)("strong",null,"Scan")," "),(0,$r.h)("span",{className:(0,Fr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,$r.h)(Wr.QRCodeIcon,{fill:Kr(e)})))))}Qt.ConnectContent=function(e){const{theme:t}=e,r=(0,Ur.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=Yr;return(0,$r.h)("div",{"data-testid":"connect-content",className:(0,Fr.default)("-cbwsdk-connect-content",t)},(0,$r.h)("style",null,Gr.default),(0,$r.h)("div",{className:"-cbwsdk-connect-content-header"},(0,$r.h)("h2",{className:(0,Fr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,$r.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,$r.h)(Vr.CloseIcon,{fill:"light"===t?"#0A0B0D":"#FFFFFF"}))),(0,$r.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,$r.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,$r.h)(Xr,{title:Zr,description:Qr,theme:t})),(0,$r.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,$r.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,$r.h)(zr.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,$r.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Hr.LIB_VERSION}),(0,$r.h)("input",{type:"hidden",value:r})),(0,$r.h)(n,{theme:t}),!e.isConnected&&(0,$r.h)("div",{"data-testid":"connecting-spinner",className:(0,Fr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,$r.h)(Jr.Spinner,{size:36,color:"dark"===t?"#FFF":"#000"}),(0,$r.h)("p",null,"Connecting...")))))},Qt.CoinbaseWalletSteps=en;var tn={},rn={};Object.defineProperty(rn,"__esModule",{value:!0}),rn.ArrowLeftIcon=void 0;const nn=_t;rn.ArrowLeftIcon=function(e){return(0,nn.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,nn.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"}))};var sn={};Object.defineProperty(sn,"__esModule",{value:!0}),sn.LaptopIcon=void 0;const on=_t;sn.LaptopIcon=function(e){return(0,on.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,on.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,on.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"}))};var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.SafeIcon=void 0;const cn=_t;an.SafeIcon=function(e){return(0,cn.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,cn.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"}))};var ln={};Object.defineProperty(ln,"__esModule",{value:!0}),ln.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 un=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(tn,"__esModule",{value:!0}),tn.TryExtensionContent=void 0;const hn=un(o),dn=_t,pn=Zt,fn=rn,mn=sn,gn=an,vn=un(ln);tn.TryExtensionContent=function({theme:e}){const[t,r]=(0,pn.useState)(!1),n=(0,pn.useCallback)((()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")}),[]),s=(0,pn.useCallback)((()=>{t?window.location.reload():(n(),r(!0))}),[n,t]);return(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension",e)},(0,dn.h)("style",null,vn.default),(0,dn.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,dn.h)("h3",{class:(0,hn.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,dn.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,dn.h)("button",{class:(0,hn.default)("-cbwsdk-try-extension-cta",e),onClick:s},t?"Refresh":"Install"),(0,dn.h)("div",null,!t&&(0,dn.h)(fn.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:"light"===e?"#0052FF":"#588AF5"})))),(0,dn.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,dn.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,dn.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,dn.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,dn.h)("span",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,dn.h)(mn.LaptopIcon,{fill:"light"===e?"#0A0B0D":"#FFFFFF"}))),(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,dn.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,dn.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,dn.h)("span",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,dn.h)(gn.SafeIcon,{fill:"light"===e?"#0A0B0D":"#FFFFFF"}))),(0,dn.h)("div",{class:(0,hn.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))};var yn={};Object.defineProperty(yn,"__esModule",{value:!0}),yn.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 wn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(St,"__esModule",{value:!0}),St.ConnectDialog=void 0;const _n=wn(o),bn=_t,En=Zt,kn=Qt,Mn=tn,Sn=wn(yn);St.ConnectDialog=e=>{const{isOpen:t,darkMode:r}=e,[n,s]=(0,En.useState)(!t),[i,o]=(0,En.useState)(!t);(0,En.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!t)}),10)];return t?s(!1):e.push(window.setTimeout((()=>{s(!0)}),360)),()=>{e.forEach(window.clearTimeout)}}),[t]);const a=r?"dark":"light";return(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,bn.h)("style",null,Sn.default),(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-backdrop",a,i&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,bn.h)("div",{class:"-cbwsdk-connect-dialog"},(0,bn.h)("div",{class:(0,_n.default)("-cbwsdk-connect-dialog-box",i&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,bn.h)(kn.ConnectContent,{theme:a,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,bn.h)(Mn.TryExtensionContent,{theme:a}))))},Object.defineProperty(ze,"__esModule",{value:!0}),ze.LinkFlow=void 0;const Cn=_t,In=St;ze.LinkFlow=class{constructor(e){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=e.darkMode,this.version=e.version,this.sessionId=e.sessionId,this.sessionSecret=e.sessionSecret,this.linkAPIUrl=e.linkAPIUrl,this.isParentConnection=e.isParentConnection}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",e.appendChild(this.root),this.render()}setConnected(e){this.connected!==e&&(this.connected=e,this.render())}setChainId(e){this.chainId!==e&&(this.chainId=e,this.render())}detach(){var e;this.root&&((0,Cn.render)(null,this.root),null===(e=this.root.parentElement)||void 0===e||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,Cn.render)((0,Cn.h)(In.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)}};var Rn={},xn={};Object.defineProperty(xn,"__esModule",{value:!0}),xn.default=(()=>".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}")(),function(t){var r=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const n=r(o),s=_t,i=Zt,a=r(xn);t.Snackbar=class{constructor(e){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=e.darkMode}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,s.render)((0,s.h)("div",null,(0,s.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,r])=>(0,s.h)(t.SnackbarInstance,Object.assign({},r,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-container")},(0,s.h)("style",null,a.default),(0,s.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:r})=>{const[o,a]=(0,i.useState)(!0),[c,l]=(0,i.useState)(null!=e&&e);(0,i.useEffect)((()=>{const e=[window.setTimeout((()=>{a(!1)}),1),window.setTimeout((()=>{l(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance",o&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{l(!c)}},(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,s.h)("div",{class:"-gear-container"},!c&&(0,s.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),r&&r.length>0&&(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},r.map(((e,t)=>(0,s.h)("div",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,s.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,s.h)("span",{class:(0,n.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(Rn),Object.defineProperty(xe,"__esModule",{value:!0}),xe.WalletLinkRelayUI=void 0;const An=Ae,Nn=ze,On=Rn;xe.WalletLinkRelayUI=class{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new On.Snackbar({darkMode:e.darkMode}),this.linkFlow=new Nn.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.linkFlow.attach(t),this.snackbar.attach(t),this.attached=!0,(0,An.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return null!==(e=this.standalone)&&void 0!==e&&e}},Object.defineProperty(se,"__esModule",{value:!0}),se.WalletLinkRelay=void 0;const Pn=m,Ln=T,Tn=d,jn=ie,Bn=oe,Dn=ce,Fn=me,$n=I,Un=xe;class Hn extends Bn.RelayAbstract{constructor(e){var t;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{var t;this.isLinked=e;const r=this.storage.getItem(Bn.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this.session.linked=e),this.isUnlinkedErrorState=!1,r){const n=r.split(" "),s="true"===this.storage.getItem("IsStandaloneSigning");if(""!==n[0]&&!e&&this.session.linked&&!s){this.isUnlinkedErrorState=!0;const e=this.getSessionIdHash();null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:e})}}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),Hn.accountRequestCallbackIds.size>0&&(Array.from(Hn.accountRequestCallbackIds.values()).forEach((t=>{const r={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},r),{id:t}))})),Hn.accountRequestCallbackIds.clear())},this.connectedUpdated=e=>{this.ui.setConnected(e)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:r,ui:n,connection:s}=this.subscribe();this._session=r,this.connection=s,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=null===(t=e.reloadOnDisconnect)||void 0===t||t,this.ui=n}subscribe(){const e=Dn.Session.load(this.storage)||new Dn.Session(this.storage).save(),{linkAPIUrl:t,diagnostic:r}=this,n=new Fn.WalletLinkConnection({session:e,linkAPIUrl:t,diagnostic:r,listener:this}),{version:s,darkMode:i}=this.options,o=this.options.uiConstructor({linkAPIUrl:t,version:s,darkMode:i,session:e});return n.connect(),{session:e,ui:o,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{var e,t;const r=this.ui.isStandalone();null===(e=this.diagnostic)||void 0===e||e.log(jn.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const n=Dn.Session.load(this.storage);if((null==n?void 0:n.id)===this._session.id?this.storage.clear():n&&(null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Dn.Session.hash(n.id)})),this._reloadOnDisconnect)return void this.ui.reloadUI();this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:i,connection:o}=this.subscribe();this._session=s,this.connection=o,this.ui=i,r&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()})).catch((e=>{var t;null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,n){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Tn.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:n||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Tn.hexStringFromBuffer)(e,!0),signature:(0,Tn.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Tn.bigIntStringFromBN)(e.weiValue),data:(0,Tn.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,Tn.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Tn.bigIntStringFromBN)(e.weiValue),data:(0,Tn.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Tn.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,Tn.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,Tn.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,Tn.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Tn.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,Tn.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,Tn.randomBytesHex)(8),n=n=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,n),null==t||t()};return{promise:new Promise(((s,i)=>{this.ui.isStandalone()||(t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:n,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(r,(e=>{if(null==t||t(),(0,$n.isErrorResponse)(e))return i(new Error(e.errorMessage));s(e)})),this.ui.isStandalone()?this.sendRequestStandalone(r,e):this.publishWeb3RequestEvent(r,e)})),cancel:n}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof Un.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,t){var r;const n={type:"WEB3_REQUEST",id:e,request:t},s=Dn.Session.load(this.storage);null===(r=this.diagnostic)||void 0===r||r.log(jn.EVENTS.WEB3_REQUEST,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Dn.Session.hash(s.id):"",isSessionMismatched:((null==s?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",n,!0).then((e=>{var r;null===(r=this.diagnostic)||void 0===r||r.log(jn.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:n.id,method:`relay::${t.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Dn.Session.hash(s.id):"",isSessionMismatched:((null==s?void 0:s.id)!==this._session.id).toString()})})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})}))}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){var t;const{response:r}=e;if(null===(t=this.diagnostic)||void 0===t||t.log(jn.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash()}),"requestEthereumAccounts"===r.method)return Hn.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void Hn.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,r,n){var s;const i=null!==(s=null==r?void 0:r.message)&&void 0!==s?s:(0,Pn.getMessageFromCode)(n);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i,errorCode:n}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,Tn.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(t),this.handleErrorResponse(t,e.method,r)};return{promise:new Promise(((n,s)=>{if(this.relayEventManager.callbacks.set(t,(e=>{if(this.ui.hideRequestEthereumAccounts(),(0,$n.isErrorResponse)(e))return s(new Error(e.errorMessage));n(e)})),this.ui.inlineAccountsResponse()){const e=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:e}})};this.ui.requestEthereumAccounts({onCancel:r,onAccounts:e})}else{const e=Pn.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>r(e)})}Hn.accountRequestCallbackIds.add(t),this.ui.inlineAccountsResponse()||this.ui.isStandalone()||this.publishWeb3RequestEvent(t,e)})),cancel:r}}selectProvider(e){const t="selectProvider",r=(0,Tn.randomBytesHex)(8);return{cancel:e=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t,e)},promise:new Promise(((t,n)=>{this.relayEventManager.callbacks.set(r,(e=>{if((0,$n.isErrorResponse)(e))return n(new Error(e.errorMessage));t(e)}));this.ui.selectProvider&&this.ui.selectProvider({onApprove:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:e}})},onCancel:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"selectProvider",result:Ln.ProviderType.Unselected}})},providerOptions:e})}))}}watchAsset(e,t,r,n,s,i){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:n,image:s},chainId:i}};let a=null;const c=(0,Tn.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};this.ui.inlineWatchAsset()||(a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}));return{cancel:l,promise:new Promise(((l,u)=>{this.relayEventManager.callbacks.set(c,(e=>{if(null==a||a(),(0,$n.isErrorResponse)(e))return u(new Error(e.errorMessage));l(e)}));const h=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!1}})},d=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:d,onCancel:h,type:e,address:t,symbol:r,decimals:n,image:s,chainId:i}),this.ui.inlineWatchAsset()||this.ui.isStandalone()||this.publishWeb3RequestEvent(c,o)}))}}addEthereumChain(e,t,r,n,s,i){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:n,chainName:s,iconUrls:r,nativeCurrency:i}};let a=null;const c=(0,Tn.randomBytesHex)(8),l=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,o.method,e),null==a||a()};this.ui.inlineAddEthereumChain(e)||(a=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:l,onResetConnection:this.resetAndReload}));return{promise:new Promise(((t,r)=>{this.relayEventManager.callbacks.set(c,(e=>{if(null==a||a(),(0,$n.isErrorResponse)(e))return r(new Error(e.errorMessage));t(e)}));const n=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},s=e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:e}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:n,onApprove:s,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(e)||this.ui.isStandalone()||this.publishWeb3RequestEvent(c,o)})),cancel:l}}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},n=(0,Tn.randomBytesHex)(8);return{promise:new Promise(((t,s)=>{this.relayEventManager.callbacks.set(n,(e=>(0,$n.isErrorResponse)(e)&&e.errorCode?s(Pn.standardErrors.provider.custom({code:e.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,$n.isErrorResponse)(e)?s(new Error(e.errorMessage)):void t(e)));this.ui.switchEthereumChain({onCancel:t=>{var r;if(t){const s=null!==(r=(0,Pn.getErrorCode)(t))&&void 0!==r?r:Pn.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(n,"switchEthereumChain",t instanceof Error?t:Pn.standardErrors.provider.unsupportedChain(e),s)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},onApprove:e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:e}}})},chainId:r.params.chainId,address:r.params.address}),this.ui.inlineSwitchEthereumChain()||this.ui.isStandalone()||this.publishWeb3RequestEvent(n,r)})),cancel:e=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,e)}}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return Dn.Session.hash(this._session.id)}sendRequestStandalone(e,t){const r=r=>{this.handleErrorResponse(e,t.method,r)},n=t=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:t})};switch(t.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:t,onSuccess:n,onCancel:r});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:t,onSuccess:n,onCancel:r});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:t,onSuccess:n,onCancel:r});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:t,onSuccess:n});break;default:r()}}}se.WalletLinkRelay=Hn,Hn.accountRequestCallbackIds=new Set;var Vn,qn,Wn,zn={},Jn={},Gn={};Vn=Gn,qn=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),Wn=e&&e.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||qn(t,e,r)},Object.defineProperty(Vn,"__esModule",{value:!0}),Wn(Rn,Vn);var Zn={};Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.default=(()=>".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}")();var Qn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.RedirectDialog=void 0;const Yn=Qn(o),Kn=_t,Xn=Ae,es=Gn,ts=Qn(Zn);Jn.RedirectDialog=class{constructor(){this.root=null}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Xn.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Kn.render)(null,this.root),e&&(0,Kn.render)((0,Kn.h)(rs,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}};const rs=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:s})=>{const i=r?"dark":"light";return(0,Kn.h)(es.SnackbarContainer,{darkMode:r},(0,Kn.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Kn.h)("style",null,ts.default),(0,Kn.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Kn.h)("div",{class:(0,Yn.default)("-cbwsdk-redirect-dialog-box",i)},(0,Kn.h)("p",null,e),(0,Kn.h)("button",{onClick:n},t))))};Object.defineProperty(zn,"__esModule",{value:!0}),zn.MobileRelayUI=void 0;const ns=Jn;zn.MobileRelayUI=class{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new ns.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const t=new URL("https://go.cb-w.com/walletlink");t.searchParams.append("redirect_url",window.location.href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}},Object.defineProperty(ne,"__esModule",{value:!0}),ne.MobileRelay=void 0;const ss=d,is=se,os=zn;class as extends is.WalletLinkRelay{constructor(e){var t;super(e),this._enableMobileWalletLink=null!==(t=e.enableMobileWalletLink)&&void 0!==t&&t}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise((()=>{const e=(0,ss.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`})),cancel:()=>{}}}publishWeb3RequestEvent(e,t){if(super.publishWeb3RequestEvent(e,t),!(this._enableMobileWalletLink&&this.ui instanceof os.MobileRelayUI))return;let r=!1;switch(t.method){case"requestEthereumAccounts":case"connectAndSignIn":r=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:r=!0,this.ui.openCoinbaseWalletDeeplink()}r&&window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:(new Date).toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}ne.MobileRelay=as;const cs=a,ls=f;function us(e){return Buffer.allocUnsafe(e).fill(0)}function hs(e,t,r){const n=us(t);return e=ds(e),r?e.lengthr)throw new Error("Elements exceed array size: "+r);for(i in s=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)s.push(ks(e,t[i]));if("dynamic"===r){var o=ks("uint256",t.length);s.unshift(o)}return Buffer.concat(s)}if("bytes"===e)return t=new Buffer(t),s=Buffer.concat([ks("uint256",t.length),t]),t.length%32!=0&&(s=Buffer.concat([s,gs.zeros(32-t.length%32)])),s;if(e.startsWith("bytes")){if((r=ws(e))<1||r>32)throw new Error("Invalid bytes width: "+r);return gs.setLengthRight(t,32)}if(e.startsWith("uint")){if((r=ws(e))%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if((n=Es(t)).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)}if(e.startsWith("int")){if((r=ws(e))%8||r<8||r>256)throw new Error("Invalid int width: "+r);if((n=Es(t)).bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}if(e.startsWith("ufixed")){if(r=_s(e),(n=Es(t))<0)throw new Error("Supplied ufixed is negative");return ks("uint256",n.mul(new vs(2).pow(new vs(r[1]))))}if(e.startsWith("fixed"))return r=_s(e),ks("int256",Es(t).mul(new vs(2).pow(new vs(r[1]))));throw new Error("Unsupported or invalid type: "+e)}function Ms(e){return"string"===e||"bytes"===e||"dynamic"===bs(e)}function Ss(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,s=[],i=0;i32)throw new Error("Invalid bytes width: "+r);s.push(gs.setLengthRight(a,r))}else if(o.startsWith("uint")){if((r=ws(o))%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if((n=Es(a)).bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());s.push(n.toArrayLike(Buffer,"be",r/8))}else{if(!o.startsWith("int"))throw new Error("Unsupported or invalid type: "+o);if((r=ws(o))%8||r<8||r>256)throw new Error("Invalid int width: "+r);if((n=Es(a)).bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());s.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}}return Buffer.concat(s)}var Cs={rawEncode:function(e,t){var r=[],n=[],s=32*e.length;for(var i in e){var o=ys(e[i]),a=ks(o,t[i]);Ms(o)?(r.push(ks("uint256",s)),n.push(a),s+=a.length):r.push(a)}return Buffer.concat(r.concat(n))},solidityPack:Ss,soliditySHA3:function(e,t){return gs.keccak(Ss(e,t))}};const Is=ms,Rs=Cs,xs={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"]},As={encodeData(e,t,r,n=!0){const s=["bytes32"],i=[this.hashType(e,r)];if(n){const o=(e,t,s)=>{if(void 0!==r[t])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":Is.keccak(this.encodeData(t,s,r,n))];if(void 0===s)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",Is.keccak(s)];if("string"===t)return"string"==typeof s&&(s=Buffer.from(s,"utf8")),["bytes32",Is.keccak(s)];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),n=s.map((t=>o(e,r,t)));return["bytes32",Is.keccak(Rs.rawEncode(n.map((([e])=>e)),n.map((([,e])=>e))))]}return[t,s]};for(const n of r[e]){const[e,r]=o(n.name,n.type,t[n.name]);s.push(e),i.push(r)}}else for(const o of r[e]){let e=t[o.name];if(void 0!==e)if("bytes"===o.type)s.push("bytes32"),e=Is.keccak(e),i.push(e);else if("string"===o.type)s.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=Is.keccak(e),i.push(e);else if(void 0!==r[o.type])s.push("bytes32"),e=Is.keccak(this.encodeData(o.type,e,r,n)),i.push(e);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),i.push(e)}}return Rs.rawEncode(s,i)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter((t=>t!==e));n=[e].concat(n.sort());for(const s of n){if(!t[s])throw new Error("No type definition specified: "+s);r+=s+"("+t[s].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||void 0===t[e])return r;r.push(e);for(const n of t[e])for(const e of this.findTypeDependencies(n.type,t,r))!r.includes(e)&&r.push(e);return r},hashStruct(e,t,r,n=!0){return Is.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return Is.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in xs.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),"EIP712Domain"!==r.primaryType&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),Is.keccak(Buffer.concat(n))}};var Ns={TYPED_MESSAGE_SCHEMA:xs,TypedDataUtils:As,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const r=e.map((function(e){return"bytes"===e.type?Is.toBuffer(e.value):e.value})),n=e.map((function(e){return e.type})),s=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Rs.soliditySHA3(["bytes32","bytes32"],[Rs.soliditySHA3(new Array(e.length).fill("string"),s),Rs.soliditySHA3(n,r)])}(e.data)},hashForSignTypedData_v3:function(e){return As.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return As.hash(e.data)}};var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.filterFromParam=Os.FilterPolyfill=void 0;const Ps=T,Ls=d,Ts={jsonrpc:"2.0",id:0};function js(e){return{fromBlock:Ds(e.fromBlock),toBlock:Ds(e.toBlock),addresses:void 0===e.address?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}function Bs(e){const t={fromBlock:Fs(e.fromBlock),toBlock:Fs(e.toBlock),topics:e.topics};return null!==e.addresses&&(t.address=e.addresses),t}function Ds(e){if(void 0===e||"latest"===e||"pending"===e)return"latest";if("earliest"===e)return(0,Ps.IntNumber)(0);if((0,Ls.isHexString)(e))return(0,Ls.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function Fs(e){return"latest"===e?e:(0,Ls.hexStringFromIntNumber)(e)}function $s(){return Object.assign(Object.assign({},Ts),{error:{code:-32e3,message:"filter not found"}})}function Us(){return Object.assign(Object.assign({},Ts),{result:[]})}Os.FilterPolyfill=class{constructor(e){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,Ps.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const t=js(e),r=this.makeFilterId(),n=await this.setInitialCursorPosition(r,t.fromBlock);return console.info(`Installing new log filter(${r}):`,t,"initial cursor position:",n),this.logFilters.set(r,t),this.setFilterTimeout(r),(0,Ls.hexStringFromIntNumber)(r)}async newBlockFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.blockFilters.add(e),this.setFilterTimeout(e),(0,Ls.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),t=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,t),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,Ls.hexStringFromIntNumber)(e)}uninstallFilter(e){const t=(0,Ls.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${t})`),this.deleteFilter(t),!0}getFilterChanges(e){const t=(0,Ls.intNumberFromHexString)(e);return this.timeouts.has(t)&&this.setFilterTimeout(t),this.logFilters.has(t)?this.getLogFilterChanges(t):this.blockFilters.has(t)?this.getBlockFilterChanges(t):this.pendingTransactionFilters.has(t)?this.getPendingTransactionFilterChanges(t):Promise.resolve($s())}async getFilterLogs(e){const t=(0,Ls.intNumberFromHexString)(e),r=this.logFilters.get(t);return r?this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getLogs",params:[Bs(r)]})):$s()}makeFilterId(){return(0,Ps.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise(((t,r)=>{this.provider.sendAsync(e,((e,n)=>e?r(e):Array.isArray(n)||null==n?r(new Error(`unexpected response received: ${JSON.stringify(n)}`)):void t(n)))}))}deleteFilter(e){console.info(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const t=this.logFilters.get(e),r=this.cursors.get(e);if(!r||!t)return $s();const n=await this.getCurrentBlockHeight(),s="latest"===t.toBlock?n:t.toBlock;if(r>n)return Us();if(r>Number(t.toBlock))return Us();console.info(`Fetching logs from ${r} to ${s} for filter ${e}`);const i=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getLogs",params:[Bs(Object.assign(Object.assign({},t),{fromBlock:r,toBlock:s}))]}));if(Array.isArray(i.result)){const t=i.result.map((e=>(0,Ls.intNumberFromHexString)(e.blockNumber||"0x0"))),n=Math.max(...t);if(n&&n>r){const t=(0,Ps.IntNumber)(n+1);console.info(`Moving cursor position for filter (${e}) from ${r} to ${t}`),this.cursors.set(e,t)}}return i}async getBlockFilterChanges(e){const t=this.cursors.get(e);if(!t)return $s();const r=await this.getCurrentBlockHeight();if(t>r)return Us();console.info(`Fetching blocks from ${t} to ${r} for filter (${e})`);const n=(await Promise.all((0,Ls.range)(t,r+1).map((e=>this.getBlockHashByNumber((0,Ps.IntNumber)(e)))))).filter((e=>!!e)),s=(0,Ps.IntNumber)(t+n.length);return console.info(`Moving cursor position for filter (${e}) from ${t} to ${s}`),this.cursors.set(e,s),Object.assign(Object.assign({},Ts),{result:n})}async getPendingTransactionFilterChanges(e){return Promise.resolve(Us())}async setInitialCursorPosition(e,t){const r=await this.getCurrentBlockHeight(),n="number"==typeof t&&t>r?t:r;return this.cursors.set(e,n),n}setFilterTimeout(e){const t=this.timeouts.get(e);t&&window.clearTimeout(t);const r=window.setTimeout((()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)}),3e5);this.timeouts.set(e,r)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const t=await this._getCurrentBlockHeight();this.currentBlockHeight=t,this.resolvers.forEach((e=>e(t))),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise((e=>this.resolvers.push(e)))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_blockNumber",params:[]}));return(0,Ls.intNumberFromHexString)((0,Ls.ensureHexString)(e))}async getBlockHashByNumber(e){const t=await this.sendAsyncPromise(Object.assign(Object.assign({},Ts),{method:"eth_getBlockByNumber",params:[(0,Ls.hexStringFromIntNumber)(e),!1]}));return t.result&&"string"==typeof t.result.hash?(0,Ls.ensureHexString)(t.result.hash):null}},Os.filterFromParam=js;var Hs={},Vs={},qs={},Ws=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}};const zs=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let e=0;e{t.errorFirst?n.push((function(e,n){if(t.multiArgs){const t=new Array(arguments.length-1);for(let e=1;e{throw n}))}}let Ys=class extends Zs.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const s=n[e];if(void 0===s)return!1;if("function"==typeof s)Qs(s,this,t);else{const e=s.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;ne+t,ti=["sync","latest"];class ri extends Xs.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||2e4,this._usePastBlocks=e.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){if(this._currentBlock)return this._currentBlock;return await new Promise((e=>this.once("latest",e)))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){ti.includes(e)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return ti.map((e=>this.listenerCount(e))).reduce(ei)}_shouldUseNewBlock(e){const t=this._currentBlock;if(!t)return!0;const r=ni(e),n=ni(t);return this._usePastBlocks&&rn}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const t=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:t,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}function ni(e){return Number.parseInt(e,16)}Js.BaseBlockTracker=ri;var si={},ii={},oi={};class ai extends TypeError{constructor(e,t){let r;const{message:n,explanation:s,...i}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(s??a),null!=s&&(this.cause=a),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function ci(e){return"object"==typeof e&&null!=e}function li(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function ui(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function hi(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:s,branch:i}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${ui(n)}\``}=e;return{value:n,type:o,refinement:a,key:s[s.length-1],path:s,branch:i,...e,message:c}}function*di(e,t,r,n){var s;ci(s=e)&&"function"==typeof s[Symbol.iterator]||(e=[e]);for(const i of e){const e=hi(i,t,r,n);e&&(yield e)}}function*pi(e,t,r={}){const{path:n=[],branch:s=[e],coerce:i=!1,mask:o=!1}=r,a={path:n,branch:s};if(i&&(e=t.coercer(e,a),o&&"type"!==t.type&&ci(t.schema)&&ci(e)&&!Array.isArray(e)))for(const l in e)void 0===t.schema[l]&&delete e[l];let c="valid";for(const l of t.validator(e,a))l.explanation=r.message,c="not_valid",yield[l,void 0];for(let[l,u,h]of t.entries(e,a)){const t=pi(u,h,{path:void 0===l?n:[...n,l],branch:void 0===l?s:[...s,u],coerce:i,mask:o,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):i&&(u=r[1],void 0===l?e=u:e instanceof Map?e.set(l,u):e instanceof Set?e.add(u):ci(e)&&(void 0!==u||l in e)&&(e[l]=u))}if("not_valid"!==c)for(const l of t.refiner(e,a))l.explanation=r.message,c="not_refined",yield[l,void 0];"valid"===c&&(yield[void 0,e])}class fi{constructor(e){const{type:t,schema:r,validator:n,refiner:s,coercer:i=(e=>e),entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=i,this.validator=n?(e,t)=>di(n(e,t),t,this,e):()=>[],this.refiner=s?(e,t)=>di(s(e,t),t,this,e):()=>[]}assert(e,t){return mi(e,this,t)}create(e,t){return gi(e,this,t)}is(e){return yi(e,this)}mask(e,t){return vi(e,this,t)}validate(e,t={}){return wi(e,this,t)}}function mi(e,t,r){const n=wi(e,t,{message:r});if(n[0])throw n[0]}function gi(e,t,r){const n=wi(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function vi(e,t,r){const n=wi(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function yi(e,t){return!wi(e,t)[0]}function wi(e,t,r={}){const n=pi(e,t,r),s=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(s[0]){return[new ai(s[0],(function*(){for(const e of n)e[0]&&(yield e[0])})),void 0]}return[void 0,s[1]]}function _i(e,t){return new fi({type:e,schema:null,validator:t})}function bi(){return _i("never",(()=>!1))}function Ei(e){const t=e?Object.keys(e):[],r=bi();return new fi({type:"object",schema:e||null,*entries(n){if(e&&ci(n)){const s=new Set(Object.keys(n));for(const r of t)s.delete(r),yield[r,n[r],e[r]];for(const e of s)yield[e,n[e],r]}},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`,coercer:e=>ci(e)?{...e}:e})}function ki(e){return new fi({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Mi(){return _i("string",(e=>"string"==typeof e||`Expected a string, but received: ${ui(e)}`))}function Si(e){const t=Object.keys(e);return new fi({type:"type",schema:e,*entries(r){if(ci(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`,coercer:e=>ci(e)?{...e}:e})}function Ci(){return _i("unknown",(()=>!0))}function Ii(e,t,r){return new fi({...e,coercer:(n,s)=>yi(n,t)?e.coercer(r(n,s),s):e.coercer(n,s)})}function Ri(e){return e instanceof Map||e instanceof Set?e.size:e.length}function xi(e,t,r){return new fi({...e,*refiner(n,s){yield*e.refiner(n,s);const i=di(r(n,s),s,e,n);for(const e of i)yield{...e,refinement:t}}})}const Ai=Object.freeze(Object.defineProperty({__proto__:null,Struct:fi,StructError:ai,any:function(){return _i("any",(()=>!0))},array:function(e){return new fi({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ui(e)}`})},assert:mi,assign:function(...e){const t="type"===e[0].type,r=e.map((e=>e.schema)),n=Object.assign({},...r);return t?Si(n):Ei(n)},bigint:function(){return _i("bigint",(e=>"bigint"==typeof e))},boolean:function(){return _i("boolean",(e=>"boolean"==typeof e))},coerce:Ii,create:gi,date:function(){return _i("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ui(e)}`))},defaulted:function(e,t,r={}){return Ii(e,Ci(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&li(e)&&li(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},define:_i,deprecated:function(e,t){return new fi({...e,refiner:(t,r)=>void 0===t||e.refiner(t,r),validator:(r,n)=>void 0===r||(t(r,n),e.validator(r,n))})},dynamic:function(e){return new fi({type:"dynamic",schema:null,*entries(t,r){const n=e(t,r);yield*n.entries(t,r)},validator:(t,r)=>e(t,r).validator(t,r),coercer:(t,r)=>e(t,r).coercer(t,r),refiner:(t,r)=>e(t,r).refiner(t,r)})},empty:function(e){return xi(e,"empty",(t=>{const r=Ri(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},enums:function(e){const t={},r=e.map((e=>ui(e))).join();for(const n of e)t[n]=n;return new fi({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${r}\`, but received: ${ui(t)}`})},func:function(){return _i("func",(e=>"function"==typeof e||`Expected a function, but received: ${ui(e)}`))},instance:function(e){return _i("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ui(t)}`))},integer:function(){return _i("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ui(e)}`))},intersection:function(e){return new fi({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})},is:yi,lazy:function(e){let t;return new fi({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})},literal:function(e){const t=ui(e),r=typeof e;return new fi({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${ui(r)}`})},map:function(e,t){return new fi({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,s]of r.entries())yield[n,n,e],yield[n,s,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${ui(e)}`})},mask:vi,max:function(e,t,r={}){const{exclusive:n}=r;return xi(e,"max",(r=>n?rn?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},never:bi,nonempty:function(e){return xi(e,"nonempty",(t=>Ri(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},nullable:function(e){return new fi({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})},number:function(){return _i("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ui(e)}`))},object:Ei,omit:function(e,t){const{schema:r}=e,n={...r};for(const s of t)delete n[s];return"type"===e.type?Si(n):Ei(n)},optional:ki,partial:function(e){const t=e instanceof fi,r=t?{...e.schema}:{...e};for(const n in r)r[n]=ki(r[n]);return t&&"type"===e.type?Si(r):Ei(r)},pattern:function(e,t){return xi(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},pick:function(e,t){const{schema:r}=e,n={};for(const s of t)n[s]=r[s];return"type"===e.type?Si(n):Ei(n)},record:function(e,t){return new fi({type:"record",schema:null,*entries(r){if(ci(r))for(const n in r){const s=r[n];yield[n,n,e],yield[n,s,t]}},validator:e=>ci(e)||`Expected an object, but received: ${ui(e)}`})},refine:xi,regexp:function(){return _i("regexp",(e=>e instanceof RegExp))},set:function(e){return new fi({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${ui(e)}`})},size:function(e,t,r=t){const n=`Expected a ${e.type}`,s=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return xi(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${s} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:i}=e;return t<=i&&i<=r||`${n} with a size ${s} but received one with a size of \`${i}\``}{const{length:i}=e;return t<=i&&i<=r||`${n} with a length ${s} but received one with a length of \`${i}\``}}))},string:Mi,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),_i(e,t)},trimmed:function(e){return Ii(e,Mi(),(e=>e.trim()))},tuple:function(e){const t=bi();return new fi({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let s=0;sArray.isArray(e)||`Expected an array, but received: ${ui(e)}`})},type:Si,union:function(e){const t=e.map((e=>e.type)).join(" | ");return new fi({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const s=[];for(const t of e){const[...e]=pi(r,t,n),[i]=e;if(!i[0])return[];for(const[t]of e)t&&s.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ui(r)}`,...s]}})},unknown:Ci,validate:wi},Symbol.toStringTag,{value:"Module"})),Ni=t(Ai);Object.defineProperty(oi,"__esModule",{value:!0}),oi.assertExhaustive=oi.assertStruct=oi.assert=oi.AssertionError=void 0;const Oi=Ni;function Pi(e,t){return r=e,Boolean("string"==typeof(null===(s=null===(n=null==r?void 0:r.prototype)||void 0===n?void 0:n.constructor)||void 0===s?void 0:s.name))?new e({message:t}):e({message:t});var r,n,s}class Li extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}oi.AssertionError=Li,oi.assert=function(e,t="Assertion failed.",r=Li){if(!e){if(t instanceof Error)throw t;throw Pi(r,t)}},oi.assertStruct=function(e,t,r="Assertion failed",n=Li){try{(0,Oi.assert)(e,t)}catch(s){throw Pi(n,`${r}: ${function(e){const t=function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}(s)}.`)}},oi.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")};var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.base64=void 0;const ji=Ni,Bi=oi;Ti.base64=(e,t={})=>{var r,n;const s=null!==(r=t.paddingRequired)&&void 0!==r&&r,i=null!==(n=t.characterSet)&&void 0!==n?n:"base64";let o,a;return"base64"===i?o=String.raw`[A-Za-z0-9+\/]`:((0,Bi.assert)("base64url"===i),o=String.raw`[-_A-Za-z0-9]`),a=s?new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,ji.pattern)(e,a)};var Di={},Fi={};!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=Ni,r=oi;function n(r){return(0,t.is)(r,e.HexStruct)}function s(r){return(0,t.is)(r,e.StrictHexStruct)}e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu),e.isHexString=n,e.isStrictHexString=s,e.assertIsHexString=function(e){(0,r.assert)(n(e),"Value must be a hexadecimal string.")},e.assertIsStrictHexString=function(e){(0,r.assert)(s(e),'Value must be a hexadecimal string, starting with "0x".')},e.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},e.remove0x=function(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}}(Fi),Object.defineProperty(Di,"__esModule",{value:!0}),Di.createDataView=Di.concatBytes=Di.valueToBytes=Di.stringToBytes=Di.numberToBytes=Di.signedBigIntToBytes=Di.bigIntToBytes=Di.hexToBytes=Di.bytesToString=Di.bytesToNumber=Di.bytesToSignedBigInt=Di.bytesToBigInt=Di.bytesToHex=Di.assertIsBytes=Di.isBytes=void 0;const $i=oi,Ui=Fi,Hi=48,Vi=58,qi=87;const Wi=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function zi(e){return e instanceof Uint8Array}function Ji(e){(0,$i.assert)(zi(e),"Value must be a Uint8Array.")}function Gi(e){if(Ji(e),0===e.length)return"0x";const t=Wi(),r=new Array(e.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");return Qi(e.toString(16))}function Ki(e){(0,$i.assert)("number"==typeof e,"Value must be a number."),(0,$i.assert)(e>=0,"Value must be a non-negative number."),(0,$i.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return Qi(e.toString(16))}function Xi(e){return(0,$i.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function eo(e){if("bigint"==typeof e)return Yi(e);if("number"==typeof e)return Ki(e);if("string"==typeof e)return e.startsWith("0x")?Qi(e):Xi(e);if(zi(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}Di.isBytes=zi,Di.assertIsBytes=Ji,Di.bytesToHex=Gi,Di.bytesToBigInt=Zi,Di.bytesToSignedBigInt=function(e){Ji(e);let t=BigInt(0);for(const r of e)t=(t<0,"Byte length must be greater than 0."),(0,$i.assert)(function(e,t){(0,$i.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let s=0;s>=BigInt(8);return n.reverse()},Di.numberToBytes=Ki,Di.stringToBytes=Xi,Di.valueToBytes=eo,Di.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let s=0;se.call(t,r,n,this)))}get(e){return wo(this,mo,"f").get(e)}has(e){return wo(this,mo,"f").has(e)}keys(){return wo(this,mo,"f").keys()}values(){return wo(this,mo,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}vo.FrozenMap=_o;class bo{constructor(e){go.set(this,void 0),yo(this,go,new Set(e),"f"),Object.freeze(this)}get size(){return wo(this,go,"f").size}[(go=new WeakMap,Symbol.iterator)](){return wo(this,go,"f")[Symbol.iterator]()}entries(){return wo(this,go,"f").entries()}forEach(e,t){return wo(this,go,"f").forEach(((r,n,s)=>e.call(t,r,n,this)))}has(e){return wo(this,go,"f").has(e)}keys(){return wo(this,go,"f").keys()}values(){return wo(this,go,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}vo.FrozenSet=bo,Object.freeze(_o),Object.freeze(_o.prototype),Object.freeze(bo),Object.freeze(bo.prototype);var Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var ko={};!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=Ni,r=oi;e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),(0,t.define)("finite number",(e=>(0,t.is)(e,(0,t.number)())&&Number.isFinite(e))),(0,t.string)(),(0,t.array)((0,t.lazy)((()=>e.UnsafeJsonStruct))),(0,t.record)((0,t.string)(),(0,t.lazy)((()=>e.UnsafeJsonStruct)))]),e.JsonStruct=(0,t.define)("Json",((t,r)=>{function n(e,t){const n=[...t.validator(e,r)];return!(n.length>0)||n}try{const r=n(t,e.UnsafeJsonStruct);return!0!==r?r:n(JSON.parse(JSON.stringify(t)),e.UnsafeJsonStruct)}catch(s){return s instanceof RangeError&&"Circular reference detected"}})),e.isValidJson=function(r){return(0,t.is)(r,e.JsonStruct)},e.getJsonSize=function(t){(0,r.assertStruct)(t,e.JsonStruct,"Invalid JSON value");const n=JSON.stringify(t);return(new TextEncoder).encode(n).byteLength},e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]),e.isJsonRpcNotification=function(r){return(0,t.is)(r,e.JsonRpcNotificationStruct)},e.assertIsJsonRpcNotification=function(t,n){(0,r.assertStruct)(t,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",n)},e.isJsonRpcRequest=function(r){return(0,t.is)(r,e.JsonRpcRequestStruct)},e.assertIsJsonRpcRequest=function(t,n){(0,r.assertStruct)(t,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",n)},e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]),e.isPendingJsonRpcResponse=function(r){return(0,t.is)(r,e.PendingJsonRpcResponseStruct)},e.assertIsPendingJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",n)},e.isJsonRpcResponse=function(r){return(0,t.is)(r,e.JsonRpcResponseStruct)},e.assertIsJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",n)},e.isJsonRpcSuccess=function(r){return(0,t.is)(r,e.JsonRpcSuccessStruct)},e.assertIsJsonRpcSuccess=function(t,n){(0,r.assertStruct)(t,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",n)},e.isJsonRpcFailure=function(r){return(0,t.is)(r,e.JsonRpcFailureStruct)},e.assertIsJsonRpcFailure=function(t,n){(0,r.assertStruct)(t,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",n)},e.isJsonRpcError=function(r){return(0,t.is)(r,e.JsonRpcErrorStruct)},e.assertIsJsonRpcError=function(t,n){(0,r.assertStruct)(t,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",n)},e.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},e);return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)}}(ko);var Mo={};Object.defineProperty(Mo,"__esModule",{value:!0});var So,Co,Io={},Ro={exports:{}};function xo(){if(Co)return So;Co=1;var e=1e3,t=6e4,r=60*t,n=24*r,s=7*n,i=365.25*n;function o(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}return So=function(a,c){c=c||{};var l=typeof a;if("string"===l&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===l&&isFinite(a))return c.long?function(s){var i=Math.abs(s);if(i>=n)return o(s,i,n,"day");if(i>=r)return o(s,i,r,"hour");if(i>=t)return o(s,i,t,"minute");if(i>=e)return o(s,i,e,"second");return s+" ms"}(a):function(s){var i=Math.abs(s);if(i>=n)return Math.round(s/n)+"d";if(i>=r)return Math.round(s/r)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Ao=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(s=n))})),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(n){}!e&&"undefined"!=typeof process&&"env"in process&&(e=r.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ao(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}(Ro,Ro.exports);var No=Ro.exports,Oo=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Io,"__esModule",{value:!0}),Io.createModuleLogger=Io.createProjectLogger=void 0;const Po=(0,Oo(No).default)("metamask");Io.createProjectLogger=function(e){return Po.extend(e)},Io.createModuleLogger=function(e,t){return e.extend(t)};var Lo={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0,e.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},e.isNullOrUndefined=function(e){return null==e},e.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)};var t;function r(e){return e.charCodeAt(0)<=127}e.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),(t=e.JsonSize||(e.JsonSize={}))[t.Null=4]="Null",t[t.Comma=1]="Comma",t[t.Wrapper=1]="Wrapper",t[t.True=4]="True",t[t.False=5]="False",t[t.Quote=1]="Quote",t[t.Colon=1]="Colon",t[t.Date=24]="Date",e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu,e.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(t){return!1}},e.isASCII=r,e.calculateStringSize=function(t){var n;return t.split("").reduce(((e,t)=>r(t)?e+1:e+2),0)+(null!==(n=t.match(e.ESCAPE_CHARACTERS_REGEXP))&&void 0!==n?n:[]).length},e.calculateNumberSize=function(e){return e.toString().length}}(Lo);var To={};Object.defineProperty(To,"__esModule",{value:!0}),To.hexToBigInt=To.hexToNumber=To.bigIntToHex=To.numberToHex=void 0;const jo=oi,Bo=Fi;To.numberToHex=e=>((0,jo.assert)("number"==typeof e,"Value must be a number."),(0,jo.assert)(e>=0,"Value must be a non-negative number."),(0,jo.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Bo.add0x)(e.toString(16)));To.bigIntToHex=e=>((0,jo.assert)("bigint"==typeof e,"Value must be a bigint."),(0,jo.assert)(e>=0,"Value must be a non-negative bigint."),(0,Bo.add0x)(e.toString(16)));To.hexToNumber=e=>{(0,Bo.assertIsHexString)(e);const t=parseInt(e,16);return(0,jo.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};To.hexToBigInt=e=>((0,Bo.assertIsHexString)(e),BigInt((0,Bo.add0x)(e)));var Do={};Object.defineProperty(Do,"__esModule",{value:!0});var Fo={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,(t=e.Duration||(e.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};e.inMilliseconds=function(e,t){return r(e,"count"),e*t},e.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}(Fo);var $o={};Object.defineProperty($o,"__esModule",{value:!0});var Uo={},Ho={exports:{}};var Vo={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},qo={};var Wo="object"==typeof process&&qo&&qo.NODE_DEBUG&&/\bsemver\b/i.test(qo.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=Vo,i=Wo,o=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.t={};let u=0;const h="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",s],[h,n]],p=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),s=u++;i(e,s,t),l[e]=s,c[s]=t,o[s]=new RegExp(t,r?"g":void 0),a[s]=new RegExp(n,r?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),p("MAINVERSION",`(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})\\.(${c[l.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})\\.(${c[l.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${c[l.NUMERICIDENTIFIER]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${c[l.NUMERICIDENTIFIERLOOSE]}|${c[l.NONNUMERICIDENTIFIER]})`),p("PRERELEASE",`(?:-(${c[l.PRERELEASEIDENTIFIER]}(?:\\.${c[l.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${c[l.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[l.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${h}+`),p("BUILD",`(?:\\+(${c[l.BUILDIDENTIFIER]}(?:\\.${c[l.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${c[l.MAINVERSION]}${c[l.PRERELEASE]}?${c[l.BUILD]}?`),p("FULL",`^${c[l.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${c[l.MAINVERSIONLOOSE]}${c[l.PRERELEASELOOSE]}?${c[l.BUILD]}?`),p("LOOSE",`^${c[l.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${c[l.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${c[l.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:\\.(${c[l.XRANGEIDENTIFIER]})(?:${c[l.PRERELEASE]})?${c[l.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[l.XRANGEIDENTIFIERLOOSE]})(?:${c[l.PRERELEASELOOSE]})?${c[l.BUILD]}?)?)?`),p("XRANGE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${c[l.GTLT]}\\s*${c[l.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),p("COERCE",`${c[l.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",c[l.COERCEPLAIN]+`(?:${c[l.PRERELEASE]})?(?:${c[l.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",c[l.COERCE],!0),p("COERCERTLFULL",c[l.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${c[l.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${c[l.LONETILDE]}${c[l.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${c[l.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${c[l.LONECARET]}${c[l.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${c[l.LONECARET]}${c[l.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${c[l.GTLT]}\\s*(${c[l.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${c[l.GTLT]}\\s*(${c[l.LOOSEPLAIN]}|${c[l.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${c[l.XRANGEPLAIN]})\\s+-\\s+(${c[l.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${c[l.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[l.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Ho,Ho.exports);var zo=Ho.exports;const Jo=Object.freeze({loose:!0}),Go=Object.freeze({});var Zo=e=>e?"object"!=typeof e?Jo:e:Go;const Qo=/^[0-9]+$/,Yo=(e,t)=>{const r=Qo.test(e),n=Qo.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eYo(t,e)};const Xo=Wo,{MAX_LENGTH:ea,MAX_SAFE_INTEGER:ta}=Vo,{safeRe:ra,t:na}=zo,sa=Zo,{compareIdentifiers:ia}=Ko;var oa=class e{constructor(t,r){if(r=sa(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>ea)throw new TypeError(`version is longer than ${ea} characters`);Xo("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ra[na.LOOSE]:ra[na.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>ta||this.major<0)throw new TypeError("Invalid major version");if(this.minor>ta||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>ta||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===ia(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const aa=oa;var ca=(e,t,r=!1)=>{if(e instanceof aa)return e;try{return new aa(e,t)}catch(n){if(!r)return null;throw n}};const la=ca;var ua=(e,t)=>{const r=la(e,t);return r?r.version:null};const ha=ca;var da=(e,t)=>{const r=ha(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const pa=oa;var fa=(e,t,r,n,s)=>{"string"==typeof r&&(s=n,n=r,r=void 0);try{return new pa(e instanceof pa?e.version:e,r).inc(t,n,s).version}catch(i){return null}};const ma=ca;var ga=(e,t)=>{const r=ma(e,null,!0),n=ma(t,null,!0),s=r.compare(n);if(0===s)return null;const i=s>0,o=i?r:n,a=i?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return a.patch||a.minor?o.patch?"patch":o.minor?"minor":"major":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};const va=oa;var ya=(e,t)=>new va(e,t).major;const wa=oa;var _a=(e,t)=>new wa(e,t).minor;const ba=oa;var Ea=(e,t)=>new ba(e,t).patch;const ka=ca;var Ma=(e,t)=>{const r=ka(e,t);return r&&r.prerelease.length?r.prerelease:null};const Sa=oa;var Ca=(e,t,r)=>new Sa(e,r).compare(new Sa(t,r));const Ia=Ca;var Ra=(e,t,r)=>Ia(t,e,r);const xa=Ca;var Aa=(e,t)=>xa(e,t,!0);const Na=oa;var Oa=(e,t,r)=>{const n=new Na(e,r),s=new Na(t,r);return n.compare(s)||n.compareBuild(s)};const Pa=Oa;var La=(e,t)=>e.sort(((e,r)=>Pa(e,r,t)));const Ta=Oa;var ja=(e,t)=>e.sort(((e,r)=>Ta(r,e,t)));const Ba=Ca;var Da=(e,t,r)=>Ba(e,t,r)>0;const Fa=Ca;var $a=(e,t,r)=>Fa(e,t,r)<0;const Ua=Ca;var Ha=(e,t,r)=>0===Ua(e,t,r);const Va=Ca;var qa=(e,t,r)=>0!==Va(e,t,r);const Wa=Ca;var za=(e,t,r)=>Wa(e,t,r)>=0;const Ja=Ca;var Ga=(e,t,r)=>Ja(e,t,r)<=0;const Za=Ha,Qa=qa,Ya=Da,Ka=za,Xa=$a,ec=Ga;var tc=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Za(e,r,n);case"!=":return Qa(e,r,n);case">":return Ya(e,r,n);case">=":return Ka(e,r,n);case"<":return Xa(e,r,n);case"<=":return ec(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const rc=oa,nc=ca,{safeRe:sc,t:ic}=zo;var oc=(e,t)=>{if(e instanceof rc)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?sc[ic.COERCERTLFULL]:sc[ic.COERCERTL];let s;for(;(s=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&s.index+s[0].length===r.index+r[0].length||(r=s),n.lastIndex=s.index+s[1].length+s[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?sc[ic.COERCEFULL]:sc[ic.COERCE]);if(null===r)return null;const n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return nc(`${n}.${s}.${i}${o}${a}`,t)};var ac,cc,lc,uc,hc=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};function dc(){if(cc)return ac;cc=1;class e{constructor(t,s){if(s=r(s),t instanceof e)return t.loose===!!s.loose&&t.includePrerelease===!!s.includePrerelease?t:new e(t.raw,s);if(t instanceof n)return this.raw=t.value,this.set=[[t]],this.format(),this;if(this.options=s,this.loose=!!s.loose,this.includePrerelease=!!s.includePrerelease,this.raw=t.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const t of this.set)if(1===t.length&&f(t[0])){this.set=[t];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const r=((this.options.includePrerelease&&h)|(this.options.loose&&d))+":"+e,i=t.get(r);if(i)return i;const f=this.options.loose,m=f?o[a.HYPHENRANGELOOSE]:o[a.HYPHENRANGE];e=e.replace(m,C(this.options.includePrerelease)),s("hyphen replace",e),e=e.replace(o[a.COMPARATORTRIM],c),s("comparator trim",e),e=e.replace(o[a.TILDETRIM],l),s("tilde trim",e),e=e.replace(o[a.CARETTRIM],u),s("caret trim",e);let v=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>S(e,this.options)));f&&(v=v.filter((e=>(s("loose invalid filter",e,this.options),!!e.match(o[a.COMPARATORLOOSE]))))),s("range list",v);const y=new Map,w=v.map((e=>new n(e,this.options)));for(const t of w){if(p(t))return[t];y.set(t.value,t)}y.size>1&&y.has("")&&y.delete("");const _=[...y.values()];return t.set(r,_),_}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>m(e,r)&&t.set.some((t=>m(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new i(e,this.options)}catch(t){return!1}for(let r=0;r"<0.0.0-0"===e.value,f=e=>""===e.value,m=(e,t)=>{let r=!0;const n=e.slice();let s=n.pop();for(;r&&n.length;)r=n.every((e=>s.intersects(e,t))),s=n.pop();return r},g=(e,t)=>(s("comp",e,t),e=_(e,t),s("caret",e),e=y(e,t),s("tildes",e),e=E(e,t),s("xrange",e),e=M(e,t),s("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,y=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?o[a.TILDELOOSE]:o[a.TILDE];return e.replace(r,((t,r,n,i,o)=>{let a;return s("tilde",e,t,r,n,i,o),v(r)?a="":v(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:v(i)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:o?(s("replaceTilde pr",o),a=`>=${r}.${n}.${i}-${o} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,s("tilde return",a),a}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{s("caret",e,t);const r=t.loose?o[a.CARETLOOSE]:o[a.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,o,a)=>{let c;return s("caret",e,t,r,i,o,a),v(r)?c="":v(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:v(o)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:a?(s("replaceCaret pr",a),c="0"===r?"0"===i?`>=${r}.${i}.${o}-${a} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o}-${a} <${+r+1}.0.0-0`):(s("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${o}${n} <${r}.${i}.${+o+1}-0`:`>=${r}.${i}.${o}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${o} <${+r+1}.0.0-0`),s("caret return",c),c}))},E=(e,t)=>(s("replaceXRanges",e,t),e.split(/\s+/).map((e=>k(e,t))).join(" ")),k=(e,t)=>{e=e.trim();const r=t.loose?o[a.XRANGELOOSE]:o[a.XRANGE];return e.replace(r,((r,n,i,o,a,c)=>{s("xRange",e,r,n,i,o,a,c);const l=v(i),u=l||v(o),h=u||v(a),d=h;return"="===n&&d&&(n=""),c=t.includePrerelease?"-0":"",l?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(u&&(o=0),a=0,">"===n?(n=">=",u?(i=+i+1,o=0,a=0):(o=+o+1,a=0)):"<="===n&&(n="<",u?i=+i+1:o=+o+1),"<"===n&&(c="-0"),r=`${n+i}.${o}.${a}${c}`):u?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:h&&(r=`>=${i}.${o}.0${c} <${i}.${+o+1}.0-0`),s("xRange return",r),r}))},M=(e,t)=>(s("replaceStars",e,t),e.trim().replace(o[a.STAR],"")),S=(e,t)=>(s("replaceGTE0",e,t),e.trim().replace(o[t.includePrerelease?a.GTE0PRE:a.GTE0],"")),C=e=>(t,r,n,s,i,o,a,c,l,u,h,d)=>`${r=v(n)?"":v(s)?`>=${n}.0.0${e?"-0":""}`:v(i)?`>=${n}.${s}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=v(l)?"":v(u)?`<${+l+1}.0.0-0`:v(h)?`<${l}.${+u+1}.0-0`:d?`<=${l}.${u}.${h}-${d}`:e?`<${l}.${u}.${+h+1}-0`:`<=${c}`}`.trim(),I=(e,t,r)=>{for(let n=0;n0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return ac}function pc(){if(uc)return lc;uc=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,s){if(s=r(s),n instanceof t){if(n.loose===!!s.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),o("comparator",n,s),this.options=s,this.loose=!!s.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(t){const r=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],i=t.match(r);if(!i)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==i[1]?i[1]:"","="===this.operator&&(this.operator=""),i[2]?this.semver=new a(i[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(o("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(r){return!1}return i(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(i(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(i(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}lc=t;const r=Zo,{safeRe:n,t:s}=zo,i=tc,o=Wo,a=oa,c=dc();return lc}const fc=dc();var mc=(e,t,r)=>{try{t=new fc(t,r)}catch(n){return!1}return t.test(e)};const gc=dc();var vc=(e,t)=>new gc(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const yc=oa,wc=dc();var _c=(e,t,r)=>{let n=null,s=null,i=null;try{i=new wc(t,r)}catch(o){return null}return e.forEach((e=>{i.test(e)&&(n&&-1!==s.compare(e)||(n=e,s=new yc(n,r)))})),n};const bc=oa,Ec=dc();var kc=(e,t,r)=>{let n=null,s=null,i=null;try{i=new Ec(t,r)}catch(o){return null}return e.forEach((e=>{i.test(e)&&(n&&1!==s.compare(e)||(n=e,s=new bc(n,r)))})),n};const Mc=oa,Sc=dc(),Cc=Da;var Ic=(e,t)=>{e=new Sc(e,t);let r=new Mc("0.0.0");if(e.test(r))return r;if(r=new Mc("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n{const t=new Mc(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":s&&!Cc(t,s)||(s=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!s||r&&!Cc(r,s)||(r=s)}return r&&e.test(r)?r:null};const Rc=dc();var xc=(e,t)=>{try{return new Rc(e,t).range||"*"}catch(r){return null}};const Ac=oa,Nc=pc(),{ANY:Oc}=Nc,Pc=dc(),Lc=mc,Tc=Da,jc=$a,Bc=Ga,Dc=za;var Fc=(e,t,r,n)=>{let s,i,o,a,c;switch(e=new Ac(e,n),t=new Pc(t,n),r){case">":s=Tc,i=Bc,o=jc,a=">",c=">=";break;case"<":s=jc,i=Dc,o=Tc,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Lc(e,t,n))return!1;for(let l=0;l{e.semver===Oc&&(e=new Nc(">=0.0.0")),u=u||e,h=h||e,s(e.semver,u.semver,n)?u=e:o(e.semver,h.semver,n)&&(h=e)})),u.operator===a||u.operator===c)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;if(h.operator===c&&o(e,h.semver))return!1}return!0};const $c=Fc;var Uc=(e,t,r)=>$c(e,t,">",r);const Hc=Fc;var Vc=(e,t,r)=>Hc(e,t,"<",r);const qc=dc();var Wc=(e,t,r)=>(e=new qc(e,r),t=new qc(t,r),e.intersects(t,r));const zc=mc,Jc=Ca;const Gc=dc(),Zc=pc(),{ANY:Qc}=Zc,Yc=mc,Kc=Ca,Xc=[new Zc(">=0.0.0-0")],el=[new Zc(">=0.0.0")],tl=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===Qc){if(1===t.length&&t[0].semver===Qc)return!0;e=r.includePrerelease?Xc:el}if(1===t.length&&t[0].semver===Qc){if(r.includePrerelease)return!0;t=el}const n=new Set;let s,i,o,a,c,l,u;for(const p of e)">"===p.operator||">="===p.operator?s=rl(s,p,r):"<"===p.operator||"<="===p.operator?i=nl(i,p,r):n.add(p.semver);if(n.size>1)return null;if(s&&i){if(o=Kc(s.semver,i.semver,r),o>0)return null;if(0===o&&(">="!==s.operator||"<="!==i.operator))return null}for(const p of n){if(s&&!Yc(p,String(s),r))return null;if(i&&!Yc(p,String(i),r))return null;for(const e of t)if(!Yc(p,String(e),r))return!1;return!0}let h=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver,d=!(!s||r.includePrerelease||!s.semver.prerelease.length)&&s.semver;h&&1===h.prerelease.length&&"<"===i.operator&&0===h.prerelease[0]&&(h=!1);for(const p of t){if(u=u||">"===p.operator||">="===p.operator,l=l||"<"===p.operator||"<="===p.operator,s)if(d&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===d.major&&p.semver.minor===d.minor&&p.semver.patch===d.patch&&(d=!1),">"===p.operator||">="===p.operator){if(a=rl(s,p,r),a===p&&a!==s)return!1}else if(">="===s.operator&&!Yc(s.semver,String(p),r))return!1;if(i)if(h&&p.semver.prerelease&&p.semver.prerelease.length&&p.semver.major===h.major&&p.semver.minor===h.minor&&p.semver.patch===h.patch&&(h=!1),"<"===p.operator||"<="===p.operator){if(c=nl(i,p,r),c===p&&c!==i)return!1}else if("<="===i.operator&&!Yc(i.semver,String(p),r))return!1;if(!p.operator&&(i||s)&&0!==o)return!1}return!(s&&l&&!i&&0!==o)&&(!(i&&u&&!s&&0!==o)&&(!d&&!h))},rl=(e,t,r)=>{if(!e)return t;const n=Kc(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},nl=(e,t,r)=>{if(!e)return t;const n=Kc(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var sl=(e,t,r={})=>{if(e===t)return!0;e=new Gc(e,r),t=new Gc(t,r);let n=!1;e:for(const s of e.set){for(const e of t.set){const t=tl(s,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const il=zo,ol=Vo,al=oa,cl=Ko;var ll={parse:ca,valid:ua,clean:da,inc:fa,diff:ga,major:ya,minor:_a,patch:Ea,prerelease:Ma,compare:Ca,rcompare:Ra,compareLoose:Aa,compareBuild:Oa,sort:La,rsort:ja,gt:Da,lt:$a,eq:Ha,neq:qa,gte:za,lte:Ga,cmp:tc,coerce:oc,Comparator:pc(),Range:dc(),satisfies:mc,toComparators:vc,maxSatisfying:_c,minSatisfying:kc,minVersion:Ic,validRange:xc,outside:Fc,gtr:Uc,ltr:Vc,intersects:Wc,simplifyRange:(e,t,r)=>{const n=[];let s=null,i=null;const o=e.sort(((e,t)=>Jc(e,t,r)));for(const u of o){zc(u,t,r)?(i=u,s||(s=u)):(i&&n.push([s,i]),i=null,s=null)}s&&n.push([s,null]);const a=[];for(const[u,h]of n)u===h?a.push(u):h||u!==o[0]?h?u===o[0]?a.push(`<=${h}`):a.push(`${u} - ${h}`):a.push(`>=${u}`):a.push("*");const c=a.join(" || "),l="string"==typeof t.raw?t.raw:String(t);return c.lengthnull!==(0,t.valid)(e)||`Expected SemVer version, got "${e}"`)),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",(e=>null!==(0,t.validRange)(e)||`Expected SemVer range, got "${e}"`)),e.isValidSemVerVersion=function(t){return(0,r.is)(t,e.VersionStruct)},e.isValidSemVerRange=function(t){return(0,r.is)(t,e.VersionRangeStruct)},e.assertIsSemVerVersion=function(t){(0,n.assertStruct)(t,e.VersionStruct)},e.assertIsSemVerRange=function(t){(0,n.assertStruct)(t,e.VersionRangeStruct)},e.gtVersion=function(e,r){return(0,t.gt)(e,r)},e.gtRange=function(e,r){return(0,t.gtr)(e,r)},e.satisfiesVersionRange=function(e,r){return(0,t.satisfies)(e,r,{includePrerelease:!0})}}(Uo),function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var s=Object.getOwnPropertyDescriptor(t,r);s&&!("get"in s?!t.__esModule:s.writable||s.configurable)||(s={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,s)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(oi,t),n(Ti,t),n(Di,t),n(to,t),n(so,t),n(vo,t),n(Eo,t),n(Fi,t),n(ko,t),n(Mo,t),n(Io,t),n(Lo,t),n(To,t),n(Do,t),n(Fo,t),n($o,t),n(Uo,t)}(ii),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ii;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")}(si);var ul=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qs,"__esModule",{value:!0}),qs.PollingBlockTracker=void 0;const hl=ul(Ws),dl=ul(((e,t)=>{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=e=>{const r=t=>"string"==typeof t?e===t:t.test(e);return t.include?t.include.some(r):!t.exclude.some(r)};let n;n="function"==typeof e?function(){return t.excludeMain?e.apply(this,arguments):zs(e,t).apply(this,arguments)}:Object.create(Object.getPrototypeOf(e));for(const s in e){const i=e[s];n[s]="function"==typeof i&&r(s)?zs(i,t):i}return n})),pl=Js,fl=(0,si.createModuleLogger)(si.projectLogger,"polling-block-tracker"),ml=(0,hl.default)();class gl extends pl.BaseBlockTracker{constructor(e={}){var t;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:null!==(t=e.blockResetDuration)&&void 0!==t?t:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||2e4,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=void 0===e.keepEventLoopActive||e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const e=vl(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await e}catch(t){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:\n${null!==(e=t.stack)&&void 0!==e?e:t}`);try{this.emit("error",n)}catch(r){console.error(n)}const s=vl(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await s}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:ml(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),fl("Making request",e);const t=await(0,dl.default)((t=>this._provider.sendAsync(e,t)))();if(fl("Got response",t),t.error)throw new Error(`PollingBlockTracker - encountered error fetching block:\n${t.error.message}`);return t.result}}function vl(e,t){return new Promise((r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()}))}qs.PollingBlockTracker=gl;var yl={},wl=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yl,"__esModule",{value:!0}),yl.SubscribeBlockTracker=void 0;const _l=wl(Ws),bl=Js,El=(0,_l.default)();class kl extends bl.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(void 0===this._subscriptionId||null===this._subscriptionId)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(null!==this._subscriptionId&&void 0!==this._subscriptionId)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...t){return new Promise(((r,n)=>{this._provider.sendAsync({id:El(),method:e,params:t,jsonrpc:"2.0"},((e,t)=>{e?n(e):r(t.result)}))}))}_handleSubData(e,t){var r;"eth_subscription"===t.method&&(null===(r=t.params)||void 0===r?void 0:r.subscription)===this._subscriptionId&&this._newPotentialLatest(t.params.result.number)}}yl.SubscribeBlockTracker=kl,function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(qs,t),n(yl,t)}(Vs);var Ml={},Sl={},Cl={};Object.defineProperty(Cl,"__esModule",{value:!0}),Cl.getUniqueId=void 0;const Il=4294967295;let Rl=Math.floor(Math.random()*Il);Cl.getUniqueId=function(){return Rl=(Rl+1)%Il,Rl},Object.defineProperty(Sl,"__esModule",{value:!0}),Sl.createIdRemapMiddleware=void 0;const xl=Cl;Sl.createIdRemapMiddleware=function(){return(e,t,r,n)=>{const s=e.id,i=xl.getUniqueId();e.id=i,t.id=i,r((r=>{e.id=s,t.id=s,r()}))}};var Al={};Object.defineProperty(Al,"__esModule",{value:!0}),Al.createAsyncMiddleware=void 0,Al.createAsyncMiddleware=function(e){return async(t,r,n,s)=>{let i;const o=new Promise((e=>{i=e}));let a=null,c=!1;const l=async()=>{c=!0,n((e=>{a=e,i()})),await o};try{await e(t,r,l),c?(await o,a(null)):s(null)}catch(u){a?a(u):s(u)}}};var Nl={};Object.defineProperty(Nl,"__esModule",{value:!0}),Nl.createScaffoldMiddleware=void 0,Nl.createScaffoldMiddleware=function(e){return(t,r,n,s)=>{const i=e[t.method];return void 0===i?n():"function"==typeof i?i(t,r,n,s):(r.result=i,s())}};var Ol={},Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});const Ll=s;function Tl(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout((()=>{throw n}))}}let jl=class extends Ll.EventEmitter{emit(e,...t){let r="error"===e;const n=this._events;if(void 0!==n)r=r&&void 0===n.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const s=n[e];if(void 0===s)return!1;if("function"==typeof s)Tl(s,this,t);else{const e=s.length,r=function(e){const t=e.length,r=new Array(t);for(let n=0;no.depthLimit)return void zl($l,e,t,s);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void zl($l,e,t,s);if(n.push(e),Array.isArray(e))for(a=0;at?1:0}function Zl(e,t,r,n){void 0===n&&(n=ql());var s,i=Ql(e,"",0,[],void 0,0,n)||e;try{s=0===Vl.length?JSON.stringify(i,t,r):JSON.stringify(i,Yl(t),r)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Hl.length;){var o=Hl.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return s}function Ql(e,t,r,n,s,i,o){var a;if(i+=1,"object"==typeof e&&null!==e){for(a=0;ao.depthLimit)return void zl($l,e,t,s);if(void 0!==o.edgesLimit&&r+1>o.edgesLimit)return void zl($l,e,t,s);if(n.push(e),Array.isArray(e))for(a=0;a0)for(var n=0;n=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};var tu={},ru={};Object.defineProperty(ru,"__esModule",{value:!0}),ru.errorValues=ru.errorCodes=void 0,ru.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}},ru.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=ru,r=Dl,n=t.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",i={code:n,message:o(n)};function o(r,n=s){if(Number.isInteger(r)){const n=r.toString();if(u(t.errorValues,n))return t.errorValues[n].message;if(c(r))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return n}function a(e){if(!Number.isInteger(e))return!1;const r=e.toString();return!!t.errorValues[r]||!!c(e)}function c(e){return e>=-32099&&e<=-32e3}function l(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=o,e.isValidCode=a,e.serializeError=function(e,{fallbackError:t=i,shouldIncludeStack:n=!1}={}){var s,c;if(!t||!Number.isInteger(t.code)||"string"!=typeof t.message)throw new Error("Must provide fallback error with integer number code and string message.");if(e instanceof r.EthereumRpcError)return e.serialize();const h={};if(e&&"object"==typeof e&&!Array.isArray(e)&&u(e,"code")&&a(e.code)){const t=e;h.code=t.code,t.message&&"string"==typeof t.message?(h.message=t.message,u(t,"data")&&(h.data=t.data)):(h.message=o(h.code),h.data={originalError:l(e)})}else{h.code=t.code;const r=null===(s=e)||void 0===s?void 0:s.message;h.message=r&&"string"==typeof r?r:t.message,h.data={originalError:l(e)}}const d=null===(c=e)||void 0===c?void 0:c.stack;return n&&e&&d&&"string"==typeof d&&(h.stack=d),h}}(tu);var nu={};Object.defineProperty(nu,"__esModule",{value:!0}),nu.ethErrors=void 0;const su=Dl,iu=tu,ou=ru;function au(e,t){const[r,n]=lu(t);return new su.EthereumRpcError(e,r||iu.getMessageFromCode(e),n)}function cu(e,t){const[r,n]=lu(t);return new su.EthereumProviderError(e,r||iu.getMessageFromCode(e),n)}function lu(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}nu.ethErrors={rpc:{parse:e=>au(ou.errorCodes.rpc.parse,e),invalidRequest:e=>au(ou.errorCodes.rpc.invalidRequest,e),invalidParams:e=>au(ou.errorCodes.rpc.invalidParams,e),methodNotFound:e=>au(ou.errorCodes.rpc.methodNotFound,e),internal:e=>au(ou.errorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return au(t,e)},invalidInput:e=>au(ou.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>au(ou.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>au(ou.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>au(ou.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>au(ou.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>au(ou.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cu(ou.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cu(ou.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cu(ou.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cu(ou.errorCodes.provider.disconnected,e),chainDisconnected:e=>cu(ou.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new su.EthereumProviderError(t,r,n)}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dl;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=tu;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=nu;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const s=ru;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})}(Bl);var uu=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ol,"__esModule",{value:!0}),Ol.JsonRpcEngine=void 0;const hu=uu(Pl),du=Bl;class pu extends hu.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[s,i,o]=await pu._runAllMiddleware(e,t,this._middleware);return i?(await pu._runReturnHandlers(o),n(s)):r((async e=>{try{await pu._runReturnHandlers(o)}catch(t){return e(t)}return e()}))}catch(s){return n(s)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(r){if(t)return t(r);throw r}}_promiseHandle(e){return new Promise((t=>{this._handle(e,((e,r)=>{t(r)}))}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const r=new du.EthereumRpcError(du.errorCodes.rpc.invalidRequest,"Requests must be plain objects. Received: "+typeof e,{request:e});return t(r,{id:void 0,jsonrpc:"2.0",error:r})}if("string"!=typeof e.method){const r=new du.EthereumRpcError(du.errorCodes.rpc.invalidRequest,"Must specify a string method. Received: "+typeof e.method,{request:e});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=Object.assign({},e),n={id:r.id,jsonrpc:r.jsonrpc};let s=null;try{await this._processRequest(r,n)}catch(i){s=i}return s&&(delete n.result,n.error||(n.error=du.serializeError(s))),t(s,n)}async _processRequest(e,t){const[r,n,s]=await pu._runAllMiddleware(e,t,this._middleware);if(pu._checkForCompletion(e,t,n),await pu._runReturnHandlers(s),r)throw r}static async _runAllMiddleware(e,t,r){const n=[];let s=null,i=!1;for(const o of r)if([s,i]=await pu._runMiddleware(e,t,o,n),i)break;return[s,i,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((s=>{const i=e=>{const r=e||t.error;r&&(t.error=du.serializeError(r)),s([r,!0])},o=r=>{t.error?i(t.error):(r&&("function"!=typeof r&&i(new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof r}" for request:\n${fu(e)}`,{request:e})),n.push(r)),s([null,!1]))};try{r(e,t,o,i)}catch(a){i(a)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request:\n${fu(e)}`,{request:e});if(!r)throw new du.EthereumRpcError(du.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request:\n${fu(e)}`,{request:e})}}function fu(e){return JSON.stringify(e,null,2)}Ol.JsonRpcEngine=pu;var mu={};Object.defineProperty(mu,"__esModule",{value:!0}),mu.mergeMiddleware=void 0;const gu=Ol;mu.mergeMiddleware=function(e){const t=new gu.JsonRpcEngine;return e.forEach((e=>t.push(e))),t.asMiddleware()},function(t){var r=e&&e.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),n=e&&e.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),n(Sl,t),n(Al,t),n(Nl,t),n(Cl,t),n(Ol,t),n(mu,t)}(Ml);var vu={},yu={},wu=function(e,t){return(wu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function _u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}wu(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var bu=function(){return bu=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;a--)(s=e[a])&&(o=(i<3?s(o):i>3?s(t,r,o):s(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function Mu(e,t){return function(r,n){t(r,n,e)}}function Su(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function Cu(e,t,r,n){return new(r||(r=Promise))((function(s,i){function o(e){try{c(n.next(e))}catch(t){i(t)}}function a(e){try{c(n.throw(e))}catch(t){i(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))}function Iu(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(o=0)),o;)try{if(r=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Nu(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(s)throw s.error}}return o}function Ou(){for(var e=[],t=0;t1||a(e,t)}))})}function a(e,t){try{(r=s[e](t)).value instanceof Tu?Promise.resolve(r.value.v).then(c,l):u(i[0][2],r)}catch(n){u(i[0][3],n)}var r}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Bu(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,s){t[n]=e[n]?function(t){return(r=!r)?{value:Tu(e[n](t)),done:!1}:s?s(t):t}:s}}function Du(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=Au(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,s){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,s,(t=e[r](t)).done,t.value)}))}}}function Fu(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var $u=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Uu(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&Ru(t,e,r);return $u(t,e),t}function Hu(e){return e&&e.__esModule?e:{default:e}}function Vu(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function qu(e,t,r,n,s){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!s)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(e,r):s?s.value=r:t.set(e,r),r}function Wu(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function zu(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var Ju="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function Gu(e){function t(t){e.error=e.hasError?new Ju(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var s=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(s).then(r,(function(e){return t(e),r()}))}catch(i){t(i)}}if(e.hasError)throw e.error}()}const Zu={__extends:_u,__assign:bu,__rest:Eu,__decorate:ku,__param:Mu,__metadata:Su,__awaiter:Cu,__generator:Iu,__createBinding:Ru,__exportStar:xu,__values:Au,__read:Nu,__spread:Ou,__spreadArrays:Pu,__spreadArray:Lu,__await:Tu,__asyncGenerator:ju,__asyncDelegator:Bu,__asyncValues:Du,__makeTemplateObject:Fu,__importStar:Uu,__importDefault:Hu,__classPrivateFieldGet:Vu,__classPrivateFieldSet:qu,__classPrivateFieldIn:Wu,__addDisposableResource:zu,__disposeResources:Gu},Qu=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:zu,get __assign(){return bu},__asyncDelegator:Bu,__asyncGenerator:ju,__asyncValues:Du,__await:Tu,__awaiter:Cu,__classPrivateFieldGet:Vu,__classPrivateFieldIn:Wu,__classPrivateFieldSet:qu,__createBinding:Ru,__decorate:ku,__disposeResources:Gu,__esDecorate:function(e,t,r,n,s,i){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=n.kind,l="getter"===c?"get":"setter"===c?"set":"value",u=!t&&e?n.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),d=!1,p=r.length-1;p>=0;p--){var f={};for(var m in n)f[m]="access"===m?{}:n[m];for(var m in n.access)f.access[m]=n.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(e||null))};var g=(0,r[p])("accessor"===c?{get:h.get,set:h.set}:h[l],f);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(h.get=a),(a=o(g.set))&&(h.set=a),(a=o(g.init))&&s.unshift(a)}else(a=o(g))&&("field"===c?s.unshift(a):h[l]=a)}u&&Object.defineProperty(u,n.name,h),d=!0},__exportStar:xu,__extends:_u,__generator:Iu,__importDefault:Hu,__importStar:Uu,__makeTemplateObject:Fu,__metadata:Su,__param:Mu,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:Nu,__rest:Eu,__runInitializers:function(e,t,r){for(var n=arguments.length>2,s=0;s1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},e.prototype._dispatch=function(){var e=this,t=this._queue.shift();if(t){var r=!1;this._currentReleaser=function(){r||(r=!0,e._value++,e._dispatch())},t([this._value--,this._currentReleaser])}},e}();Ku.default=eh,Object.defineProperty(yu,"__esModule",{value:!0});var th=Yu,rh=Ku,nh=function(){function e(){this._semaphore=new rh.default(1)}return e.prototype.acquire=function(){return th.__awaiter(this,void 0,void 0,(function(){var e;return th.__generator(this,(function(t){switch(t.label){case 0:return[4,this._semaphore.acquire()];case 1:return e=t.sent(),[2,e[1]]}}))}))},e.prototype.runExclusive=function(e){return this._semaphore.runExclusive((function(){return e()}))},e.prototype.isLocked=function(){return this._semaphore.isLocked()},e.prototype.release=function(){this._semaphore.release()},e}();yu.default=nh;var sh={};Object.defineProperty(sh,"__esModule",{value:!0}),sh.withTimeout=void 0;var ih=Yu;sh.withTimeout=function(e,t,r){var n=this;return void 0===r&&(r=new Error("timeout")),{acquire:function(){return new Promise((function(s,i){return ih.__awaiter(n,void 0,void 0,(function(){var n,o;return ih.__generator(this,(function(a){switch(a.label){case 0:return n=!1,setTimeout((function(){n=!0,i(r)}),t),[4,e.acquire()];case 1:return o=a.sent(),n?(Array.isArray(o)?o[1]:o)():s(o),[2]}}))}))}))},runExclusive:function(e){return ih.__awaiter(this,void 0,void 0,(function(){var t,r;return ih.__generator(this,(function(n){switch(n.label){case 0:t=function(){},n.label=1;case 1:return n.trys.push([1,,7,8]),[4,this.acquire()];case 2:return r=n.sent(),Array.isArray(r)?(t=r[1],[4,e(r[0])]):[3,4];case 3:return[2,n.sent()];case 4:return t=r,[4,e()];case 5:return[2,n.sent()];case 6:return[3,8];case 7:return t(),[7];case 8:return[2]}}))}))},release:function(){e.release()},isLocked:function(){return e.isLocked()}}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.withTimeout=e.Semaphore=e.Mutex=void 0;var t=yu;Object.defineProperty(e,"Mutex",{enumerable:!0,get:function(){return t.default}});var r=Ku;Object.defineProperty(e,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=sh;Object.defineProperty(e,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})}(vu);var oh=function(){for(var e={},t=0;tfunction(...s){return new(0,t.promiseModule)(((i,o)=>{t.multiArgs?s.push(((...e)=>{t.errorFirst?e[0]?o(e):(e.shift(),i(e)):i(e)})):t.errorFirst?s.push(((e,t)=>{e?o(e):i(t)})):s.push(i);const a=this===r?n:this;Reflect.apply(e,a,s)}))},mh=new WeakMap;const gh=Gs.default;var vh=class extends gh{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach((e=>this.emit("update",e)))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}};const yh=vh;var wh={minBlockRef:function(...e){return _h(e)[0]},maxBlockRef:function(...e){const t=_h(e);return t[t.length-1]},sortBlockRefs:_h,bnToHex:function(e){return"0x"+e.toString(16)},blockRefIsNumber:function(e){return e&&!["earliest","latest","pending"].includes(e)},hexToInt:bh,incrementHexInt:function(e){if(null==e)return e;return Eh(bh(e)+1)},intToHex:Eh,unsafeRandomBytes:function(e){let t="0x";for(let r=0;r"latest"===e||"earliest"===t?1:"latest"===t||"earliest"===e?-1:bh(e)-bh(t)))}function bh(e){return null==e?e:Number.parseInt(e,16)}function Eh(e){if(null==e)return e;let t=e.toString(16);return t.length%2&&(t="0"+t),"0x"+t}function kh(){return Math.floor(16*Math.random()).toString(16)}const Mh=uh,Sh=(e,t)=>{t={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...t};const r=typeof e;if(null===e||"object"!==r&&"function"!==r)throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${null===e?"null":r}\``);const n=new WeakMap,s=new Proxy(e,{apply(e,r,i){const o=n.get(e);if(o)return Reflect.apply(o,r,i);const a=t.excludeMain?e:fh(e,t,s,e);return n.set(e,a),Reflect.apply(a,r,i)},get(e,r){const i=e[r];if(!((e,r)=>{let n=mh.get(e);if(n||(n={},mh.set(e,n)),r in n)return n[r];const s=e=>"string"==typeof e||"symbol"==typeof r?r===e:e.test(r),i=Reflect.getOwnPropertyDescriptor(e,r),o=void 0===i||i.writable||i.configurable,a=(t.include?t.include.some(s):!t.exclude.some(s))&&o;return n[r]=a,a})(e,r)||i===Function.prototype[r])return i;const o=n.get(i);if(o)return o;if("function"==typeof i){const r=fh(i,t,s,e);return n.set(i,r),r}return i}});return s},Ch=class extends yh{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}},{bnToHex:Ih,hexToInt:Rh,incrementHexInt:xh,minBlockRef:Ah,blockRefIsNumber:Nh}=wh;var Oh=class extends Ch{constructor({provider:e,params:t}){super(),this.type="log",this.ethQuery=new Mh(e),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},t),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map((e=>e.toLowerCase())))}async initialize({currentBlock:e}){let t=this.params.fromBlock;["latest","pending"].includes(t)&&(t=e),"earliest"===t&&(t="0x0"),this.params.fromBlock=t;const r=Ah(this.params.toBlock,e),n=Object.assign({},this.params,{toBlock:r}),s=await this._fetchLogs(n);this.addInitialResults(s)}async update({oldBlock:e,newBlock:t}){const r=t;let n;n=e?xh(e):t;const s=Object.assign({},this.params,{fromBlock:n,toBlock:r}),i=(await this._fetchLogs(s)).filter((e=>this.matchLog(e)));this.addResults(i)}async _fetchLogs(e){return await Sh((t=>this.ethQuery.getLogs(e,t)))()}matchLog(e){if(Rh(this.params.fromBlock)>=Rh(e.blockNumber))return!1;if(Nh(this.params.toBlock)&&Rh(this.params.toBlock)<=Rh(e.blockNumber))return!1;const t=e.address&&e.address.toLowerCase();if(this.params.address&&t&&!this.params.address.includes(t))return!1;return this.params.topics.every(((t,r)=>{let n=e.topics[r];if(!n)return!1;n=n.toLowerCase();let s=Array.isArray(t)?t:[t];if(s.includes(null))return!0;s=s.map((e=>e.toLowerCase()));return s.includes(n)}))}},Ph=async function({provider:e,fromBlock:t,toBlock:r}){t||(t=r);const n=Lh(t),s=Lh(r),i=Array(s-n+1).fill().map(((e,t)=>n+t)).map(Th);let o=await Promise.all(i.map((t=>async function(e,t,r){for(let s=0;s<3;s++)try{return await jh(e,{id:1,jsonrpc:"2.0",method:t,params:r})}catch(n){console.error(`provider.sendAsync failed: ${n.stack||n.message||n}`)}return null}(e,"eth_getBlockByNumber",[t,!1]))));return o=o.filter((e=>null!==e)),o};function Lh(e){return null==e?e:Number.parseInt(e,16)}function Th(e){if(null==e)return e;return"0x"+e.toString(16)}function jh(e,t){return new Promise(((r,n)=>{e.sendAsync(t,((e,t)=>{e?n(e):t.error?n(t.error):t.result?r(t.result):n(new Error("Result was empty"))}))}))}const Bh=vh,Dh=Ph,{incrementHexInt:Fh}=wh;var $h=class extends Bh{constructor({provider:e,params:t}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:t}){const r=t,n=Fh(e),s=(await Dh({provider:this.provider,fromBlock:n,toBlock:r})).map((e=>e.hash));this.addResults(s)}};const Uh=vh,Hh=Ph,{incrementHexInt:Vh}=wh;var qh=class extends Uh{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const t=e,r=Vh(e),n=await Hh({provider:this.provider,fromBlock:r,toBlock:t}),s=[];for(const i of n)s.push(...i.transactions);this.addResults(s)}};const Wh=vu.Mutex,{createAsyncMiddleware:zh,createScaffoldMiddleware:Jh}=Ml,Gh=Oh,Zh=$h,Qh=qh,{intToHex:Yh,hexToInt:Kh}=wh;var Xh=function({blockTracker:e,provider:t}){let r=0,n={};const s=new Wh,i=function({mutex:e}){return t=>async(r,n,s,i)=>{(await e.acquire())(),t(r,n,s,i)}}({mutex:s}),o=Jh({eth_newFilter:i(ed(c)),eth_newBlockFilter:i(ed(l)),eth_newPendingTransactionFilter:i(ed(u)),eth_uninstallFilter:i(td(p)),eth_getFilterChanges:i(td(h)),eth_getFilterLogs:i(td(d))}),a=async({oldBlock:e,newBlock:t})=>{if(0===n.length)return;const r=await s.acquire();try{await Promise.all(rd(n).map((async r=>{try{await r.update({oldBlock:e,newBlock:t})}catch(n){console.error(n)}})))}catch(i){console.error(i)}r()};return o.newLogFilter=c,o.newBlockFilter=l,o.newPendingTransactionFilter=u,o.uninstallFilter=p,o.getFilterChanges=h,o.getFilterLogs=d,o.destroy=()=>{!async function(){const e=rd(n).length;n={},m({prevFilterCount:e,newFilterCount:0})}()},o;async function c(e){const r=new Gh({provider:t,params:e});return await f(r),r}async function l(){const e=new Zh({provider:t});return await f(e),e}async function u(){const e=new Qh({provider:t});return await f(e),e}async function h(e){const t=Kh(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);return r.getChangesAndClear()}async function d(e){const t=Kh(e),r=n[t];if(!r)throw new Error(`No filter for index "${t}"`);let s=[];return"log"===r.type&&(s=r.getAllResults()),s}async function p(e){const t=Kh(e),r=n[t],s=Boolean(r);return s&&await async function(e){const t=rd(n).length;delete n[e];const r=rd(n).length;m({prevFilterCount:t,newFilterCount:r})}(t),s}async function f(t){const s=rd(n).length,i=await e.getLatestBlock();await t.initialize({currentBlock:i}),r++,n[r]=t,t.id=r,t.idHex=Yh(r);return m({prevFilterCount:s,newFilterCount:rd(n).length}),r}function m({prevFilterCount:t,newFilterCount:r}){0===t&&r>0?e.on("sync",a):t>0&&0===r&&e.removeListener("sync",a)}};function ed(e){return td((async(...t)=>{const r=await e(...t);return Yh(r.id)}))}function td(e){return zh((async(t,r)=>{const n=await e.apply(null,t.params);r.result=n}))}function rd(e,t){const r=[];for(let n in e)r.push(e[n]);return r}const nd=Gs.default,{createAsyncMiddleware:sd,createScaffoldMiddleware:id}=Ml,od=Xh,{unsafeRandomBytes:ad,incrementHexInt:cd}=wh,ld=Ph;var ud=function({blockTracker:e,provider:t}){const r={},n=od({blockTracker:e,provider:t});let s=!1;const i=new nd,o=id({eth_subscribe:sd((async function(i,o){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const c=i.params[0],l=ad(16);let u;switch(c){case"newHeads":u=h({subId:l});break;case"logs":const e=i.params[1];u=d({subId:l,filter:await n.newLogFilter(e)});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${c}"`)}return r[l]=u,void(o.result=l);function h({subId:r}){const n={type:c,destroy:async()=>{e.removeListener("sync",n.update)},update:async({oldBlock:e,newBlock:n})=>{const s=n,i=cd(e);(await ld({provider:t,fromBlock:i,toBlock:s})).map(hd).filter((e=>null!==e)).forEach((e=>{a(r,e)}))}};return e.on("sync",n.update),n}function d({subId:e,filter:t}){t.on("update",(t=>a(e,t)));return{type:c,destroy:async()=>await n.uninstallFilter(t.idHex)}}})),eth_unsubscribe:sd((async function(e,t){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const n=e.params[0],i=r[n];if(!i)return void(t.result=!1);delete r[n],await i.destroy(),t.result=!0}))});return o.destroy=function(){i.removeAllListeners();for(const e in r)r[e].destroy(),delete r[e];s=!0},{events:i,middleware:o};function a(e,t){i.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:e,result:t}})}};function hd(e){return null==e?null:{hash:e.hash,parentHash:e.parentHash,sha3Uncles:e.sha3Uncles,miner:e.miner,stateRoot:e.stateRoot,transactionsRoot:e.transactionsRoot,receiptsRoot:e.receiptsRoot,logsBloom:e.logsBloom,difficulty:e.difficulty,number:e.number,gasLimit:e.gasLimit,gasUsed:e.gasUsed,nonce:e.nonce,mixHash:e.mixHash,timestamp:e.timestamp,extraData:e.extraData}}Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.SubscriptionManager=void 0;const dd=Vs,pd=ud,fd=()=>{};Hs.SubscriptionManager=class{constructor(e){const t=new dd.PollingBlockTracker({provider:e,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:r,middleware:n}=pd({blockTracker:t,provider:e});this.events=r,this.subscriptionMiddleware=n}async handleRequest(e){const t={};return await this.subscriptionMiddleware(e,t,fd,fd),t}destroy(){this.subscriptionMiddleware.destroy()}};var md=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ee,"__esModule",{value:!0}),ee.CoinbaseWalletProvider=void 0;const gd=md(f),vd=re,yd=m,wd=d,_d=ne,bd=oe,Ed=ce,kd=I,Md=md(Ns),Sd=ie,Cd=Os,Id=Hs,Rd="DefaultChainId",xd="DefaultJsonRpcUrl";class Ad extends vd.EventEmitter{constructor(e){var t,r;super(),this._filterPolyfill=new Cd.FilterPolyfill(this),this._subscriptionManager=new Id.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=e.chainId,this._jsonRpcUrlFromOpts=e.jsonRpcUrl,this._overrideIsMetaMask=e.overrideIsMetaMask,this._relayProvider=e.relayProvider,this._storage=e.storage,this._relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=null===(t=e.overrideIsCoinbaseWallet)||void 0===t||t,this.isCoinbaseBrowser=null!==(r=e.overrideIsCoinbaseBrowser)&&void 0!==r&&r,this.qrUrl=e.qrUrl;const n=this.getChainId(),s=(0,wd.prepend0x)(n.toString(16));this.emit("connect",{chainIdStr:s});const i=this._storage.getItem(bd.LOCAL_STORAGE_ADDRESSES_KEY);if(i){const e=i.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,wd.ensureAddressString)(e))),this.emit("accountsChanged",e))}this._subscriptionManager.events.on("notification",(e=>{this.emit("message",{type:e.method,data:e.params})})),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",(e=>{var t;if(e.origin===location.origin&&e.source===window&&"walletLinkMessage"===e.data.type&&"dappChainSwitched"===e.data.data.action){const r=e.data.data.chainId,n=null!==(t=e.data.data.jsonRpcUrl)&&void 0!==t?t:this.jsonRpcUrl;this.updateProviderInfo(n,Number(r))}}))}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,wd.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(xd))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(xd,e)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(e,t){this.isCoinbaseBrowser||(this._chainIdFromOpts=t,this._jsonRpcUrlFromOpts=e),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(e,t){this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(Rd,t.toString(10));!((0,wd.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,n,s,i){const o=await this.initializeRelay(),a=await o.watchAsset(e,t,r,n,s,null==i?void 0:i.toString()).promise;return!(0,kd.isErrorResponse)(a)&&!!a.result}async addEthereumChain(e,t,r,n,s,i){var o,a;if((0,wd.ensureIntNumber)(e)===this.getChainId())return!1;const c=await this.initializeRelay(),l=c.inlineAddEthereumChain(e.toString());this._isAuthorized()||l||await c.requestEthereumAccounts().promise;const u=await c.addEthereumChain(e.toString(),t,s,r,n,i).promise;return!(0,kd.isErrorResponse)(u)&&(!0===(null===(o=u.result)||void 0===o?void 0:o.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(a=u.result)||void 0===a?void 0:a.isApproved))}async switchEthereumChain(e){const t=await this.initializeRelay(),r=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0).promise;if((0,kd.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===yd.standardErrorCodes.provider.unsupportedChain?yd.standardErrors.provider.unsupportedChain():yd.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const n=r.result;n.isApproved&&n.rpcUrl.length>0&&this.updateProviderInfo(n.rpcUrl,e)}setAppInfo(e,t){this.initializeRelay().then((r=>r.setAppInfo(e,t)))}async enable(){var e;return null===(e=this.diagnostic)||void 0===e||e.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(e,t){try{const r=this._send(e,t);if(r instanceof Promise)return r.catch((t=>{throw(0,yd.serializeError)(t,e)}))}catch(r){throw(0,yd.serializeError)(r,e)}}_send(e,t){if("string"==typeof e){const r={jsonrpc:"2.0",id:0,method:e,params:Array.isArray(t)?t:void 0!==t?[t]:[]};return this._sendRequestAsync(r).then((e=>e.result))}if("function"==typeof t){const r=e,n=t;return this._sendAsync(r,n)}if(Array.isArray(e)){return e.map((e=>this._sendRequest(e)))}const r=e;return this._sendRequest(r)}async sendAsync(e,t){try{return this._sendAsync(e,t).catch((t=>{throw(0,yd.serializeError)(t,e)}))}catch(r){return Promise.reject((0,yd.serializeError)(r,e))}}async _sendAsync(e,t){if("function"!=typeof t)throw new Error("callback is required");if(Array.isArray(e)){const r=t;return void this._sendMultipleRequestsAsync(e).then((e=>r(null,e))).catch((e=>r(e,null)))}const r=t;return this._sendRequestAsync(e).then((e=>r(null,e))).catch((e=>r(e,null)))}async request(e){try{return this._request(e).catch((t=>{throw(0,yd.serializeError)(t,e.method)}))}catch(t){return Promise.reject((0,yd.serializeError)(t,e.method))}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw yd.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if("string"!=typeof t||0===t.length)throw yd.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==r&&!Array.isArray(r)&&("object"!=typeof r||null===r))throw yd.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const n=void 0===r?[]:r,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:n,jsonrpc:"2.0",id:s})).result}async scanQRCode(e){const t=await this.initializeRelay(),r=await t.scanQRCode((0,wd.ensureRegExpString)(e)).promise;if((0,kd.isErrorResponse)(r))throw(0,yd.serializeError)(r.errorMessage,"scanQRCode");if("string"!=typeof r.result)throw(0,yd.serializeError)("result was not a string","scanQRCode");return r.result}async genericRequest(e,t){const r=await this.initializeRelay(),n=await r.genericRequest(e,t).promise;if((0,kd.isErrorResponse)(n))throw(0,yd.serializeError)(n.errorMessage,"generic");if("string"!=typeof n.result)throw(0,yd.serializeError)("result was not a string","generic");return n.result}async connectAndSignIn(e){var t;let r;null===(t=this.diagnostic)||void 0===t||t.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0});try{const t=await this.initializeRelay();if(!(t instanceof _d.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(r=await t.connectAndSignIn(e).promise,(0,kd.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied account authorization");throw s}if(!r.result)throw new Error("accounts received is empty");const{accounts:n}=r.result;return this._setAddresses(n),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),r.result}async selectProvider(e){const t=await this.initializeRelay(),r=await t.selectProvider(e).promise;if((0,kd.isErrorResponse)(r))throw(0,yd.serializeError)(r.errorMessage,"selectProvider");if("string"!=typeof r.result)throw(0,yd.serializeError)("result was not a string","selectProvider");return r.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(e){const t={jsonrpc:"2.0",id:e.id},{method:r}=e;if(t.result=this._handleSynchronousMethods(e),void 0===t.result)throw new Error(`Coinbase Wallet does not support calling ${r} synchronously without a callback. Please provide a callback parameter to call ${r} asynchronously.`);return t}_setAddresses(e,t){if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,wd.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,this.emit("accountsChanged",this._addresses),this._storage.setItem(bd.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,r)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n});const s=this._handleAsynchronousFilterMethods(e);if(void 0!==s)return void s.then((r=>t(Object.assign(Object.assign({},r),{id:e.id})))).catch((e=>r(e)));const i=this._handleSubscriptionMethods(e);if(void 0!==i)return void i.then((r=>t({jsonrpc:"2.0",id:e.id,result:r.result}))).catch((e=>r(e)))}catch(n){return r(n)}this._handleAsynchronousMethods(e).then((r=>r&&t(Object.assign(Object.assign({},r),{id:e.id})))).catch((e=>r(e)))}))}_sendMultipleRequestsAsync(e){return Promise.all(e.map((e=>this._sendRequestAsync(e))))}_handleSynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(r);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(e,this.jsonRpcUrl).catch((t=>{var r;throw t.code!==yd.standardErrorCodes.rpc.methodNotFound&&t.code!==yd.standardErrorCodes.rpc.methodNotSupported||null===(r=this.diagnostic)||void 0===r||r.log(Sd.EVENTS.METHOD_NOT_IMPLEMENTED,{method:e.method,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),t}))}_handleAsynchronousFilterMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_newFilter":return this._eth_newFilter(r);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(r);case"eth_getFilterLogs":return this._eth_getFilterLogs(r)}}_handleSubscriptionMethods(e){switch(e.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(e)}}_isKnownAddress(e){try{const t=(0,wd.ensureAddressString)(e);return this._addresses.map((e=>(0,wd.ensureAddressString)(e))).includes(t)}catch(t){}return!1}_ensureKnownAddress(e){var t;if(!this._isKnownAddress(e))throw null===(t=this.diagnostic)||void 0===t||t.log(Sd.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,wd.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,wd.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,wd.ensureBN)(e.value):new gd.default(0),data:e.data?(0,wd.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,wd.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,wd.ensureBN)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,wd.ensureBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,wd.ensureBN)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,wd.ensureBN)(e.gas):null,chainId:e.chainId?(0,wd.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw yd.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw yd.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,n){this._ensureKnownAddress(t);try{const s=await this.initializeRelay(),i=await s.signEthereumMessage(e,t,r,n).promise;if((0,kd.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied message signature");throw s}}async _ethereumAddressFromSignedMessage(e,t,r){const n=await this.initializeRelay(),s=await n.ethereumAddressFromSignedMessage(e,t,r).promise;if((0,kd.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,wd.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Rd);if(!e)return(0,wd.ensureIntNumber)(this._chainIdFromOpts);const t=parseInt(e,10);return(0,wd.ensureIntNumber)(t)}async _eth_requestAccounts(){var e;if(null===(e=this.diagnostic)||void 0===e||e.log(Sd.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?Ed.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let t;try{const e=await this.initializeRelay();if(t=await e.requestEthereumAccounts().promise,(0,kd.isErrorResponse)(t))throw new Error(t.errorMessage)}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied account authorization");throw r}if(!t.result)throw new Error("accounts received is empty");return this._setAddresses(t.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,wd.ensureBuffer)(e[0]),r=(0,wd.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=await this.initializeRelay(),r=await e.signEthereumTransaction(t).promise;if((0,kd.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw r}}async _eth_sendRawTransaction(e){const t=(0,wd.ensureBuffer)(e[0]),r=await this.initializeRelay(),n=await r.submitEthereumTransaction(t,this.getChainId()).promise;if((0,kd.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=await this.initializeRelay(),r=await e.signAndSubmitEthereumTransaction(t).promise;if((0,kd.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}catch(r){if("string"==typeof r.message&&r.message.match(/(denied|rejected)/i))throw yd.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,wd.ensureParsedJSONObject)(e[0]),r=(0,wd.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const n=Md.default.hashForSignTypedDataLegacy({data:t}),s=JSON.stringify(t,null,2);return this._signEthereumMessage(n,r,!1,s)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=Md.default.hashForSignTypedData_v3({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,s)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,wd.ensureAddressString)(e[0]),r=(0,wd.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const n=Md.default.hashForSignTypedData_v4({data:r}),s=JSON.stringify(r,null,2);return this._signEthereumMessage(n,t,!1,s)}async _cbwallet_arbitrary(e){const t=e[0],r=e[1];if("string"!=typeof r)throw new Error("parameter must be a string");if("object"!=typeof t||null===t)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(t,r)}}async _wallet_addEthereumChain(e){var t,r,n,s;const i=e[0];if(0===(null===(t=i.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!i.chainName||""===i.chainName.trim())throw yd.standardErrors.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw yd.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(i.chainId,16);return await this.addEthereumChain(o,null!==(r=i.rpcUrls)&&void 0!==r?r:[],null!==(n=i.blockExplorerUrls)&&void 0!==n?n:[],i.chainName,null!==(s=i.iconUrls)&&void 0!==s?s:[],i.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw yd.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw yd.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw yd.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw yd.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:n,symbol:s,image:i,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,n,s,o,i,r)}}_eth_uninstallFilter(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.uninstallFilter(t)}async _eth_newFilter(e){const t=e[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(t)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.getFilterChanges(t)}_eth_getFilterLogs(e){const t=(0,wd.ensureHexString)(e[0]);return this._filterPolyfill.getFilterLogs(t)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then((e=>(e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),e.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=e,e)))}}ee.CoinbaseWalletProvider=Ad;var Nd={};Object.defineProperty(Nd,"__esModule",{value:!0}),Nd.RelayEventManager=void 0;const Od=d;Nd.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,Od.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}},Object.defineProperty(l,"__esModule",{value:!0}),l.CoinbaseWalletSDK=void 0;const Pd=u,Ld=h,Td=d,jd=X,Bd=ee,Dd=ne,Fd=zn,$d=Nd,Ud=xe,Hd=se,Vd=R;class qd{constructor(e){var t,r,n;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const s=e.linkAPIUrl||Ld.LINK_API_URL;void 0===e.overrideIsMetaMask?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=e.overrideIsMetaMask,this._overrideIsCoinbaseWallet=null===(t=e.overrideIsCoinbaseWallet)||void 0===t||t,this._overrideIsCoinbaseBrowser=null!==(r=e.overrideIsCoinbaseBrowser)&&void 0!==r&&r,this._diagnosticLogger=e.diagnosticLogger,this._reloadOnDisconnect=null===(n=e.reloadOnDisconnect)||void 0===n||n;const i=new URL(s),o=`${i.protocol}//${i.host}`;if(this._storage=new jd.ScopedLocalStorage(`-walletlink:${o}`),this._storage.setItem("version",qd.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new $d.RelayEventManager;const a=(0,Td.isMobileWeb)(),c=e.uiConstructor||(e=>a?new Fd.MobileRelayUI(e):new Ud.WalletLinkRelayUI(e)),l={linkAPIUrl:s,version:Vd.LIB_VERSION,darkMode:!!e.darkMode,headlessMode:!!e.headlessMode,uiConstructor:c,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:e.enableMobileWalletLink};this._relay=a?new Dd.MobileRelay(l):new Hd.WalletLinkRelay(l),this.setAppInfo(e.appName,e.appLogoUrl),e.headlessMode||this._relay.attachUI()}makeWeb3Provider(e="",t=1){const r=this.walletExtension;if(r)return this.isCipherProvider(r)||r.setProviderInfo(e,t),!1===this._reloadOnDisconnect&&"function"==typeof r.disableReloadOnDisconnect&&r.disableReloadOnDisconnect(),r;const n=this.coinbaseBrowser;if(n)return n;const s=this._relay;if(!s||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return e||s.setConnectDisabled(!0),new Bd.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(s),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:e,chainId:t,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(e,t){var r;this._appName=e||"DApp",this._appLogoUrl=t||(0,Td.getFavicon)();const n=this.walletExtension;n?this.isCipherProvider(n)||n.setAppInfo(this._appName,this._appLogoUrl):null===(r=this._relay)||void 0===r||r.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var e;const t=null==this?void 0:this.walletExtension;t?t.close():null===(e=this._relay)||void 0===e||e.resetAndReload()}getQrUrl(){var e,t;return null!==(t=null===(e=this._relay)||void 0===e?void 0:e.getQRCodeUrl())&&void 0!==t?t:null}getCoinbaseWalletLogo(e,t=240){return(0,Pd.walletLogo)(e,t)}get walletExtension(){var e;return null!==(e=window.coinbaseWalletExtension)&&void 0!==e?e:window.walletLinkExtension}get coinbaseBrowser(){var e,t;try{const r=null!==(e=window.ethereum)&&void 0!==e?e:null===(t=window.top)||void 0===t?void 0:t.ethereum;if(!r)return;return"isCoinbaseBrowser"in r&&r.isCoinbaseBrowser?r:void 0}catch(r){return}}isCipherProvider(e){return"boolean"==typeof e.isCipher&&e.isCipher}}l.CoinbaseWalletSDK=qd,qd.VERSION=Vd.LIB_VERSION,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletProvider=e.CoinbaseWalletSDK=void 0;const t=l,r=ee;var n=l;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var s=ee;Object.defineProperty(e,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return s.CoinbaseWalletProvider}}),e.default=t.CoinbaseWalletSDK,"undefined"!=typeof window&&(window.CoinbaseWalletSDK=t.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=t.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)}(c);const Wd=r(c),zd=Object.freeze(Object.defineProperty({__proto__:null,default:Wd},Symbol.toStringTag,{value:"Module"}));export{zd as i}; diff --git a/kinode/src/register-ui/build/assets/index-DRmNTW-M.js b/kinode/src/register-ui/build/assets/index-BiTIzhEC.js similarity index 99% rename from kinode/src/register-ui/build/assets/index-DRmNTW-M.js rename to kinode/src/register-ui/build/assets/index-BiTIzhEC.js index 6cea565ab..c6ac7e2aa 100644 --- a/kinode/src/register-ui/build/assets/index-DRmNTW-M.js +++ b/kinode/src/register-ui/build/assets/index-BiTIzhEC.js @@ -1 +1 @@ -import{k as e,h as t,f as n}from"./index-C3h8FZ1j.js";import{j as r,s,r as i}from"./clsx.m-BnvdjbFk.js";var a={},o={},c={};Object.defineProperty(c,"__esModule",{value:!0}),c.walletLogo=void 0;c.walletLogo=(e,t)=>{let n;switch(e){case"standard":default:return n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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`}};var d={},l={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,i||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],o]:e._events[c].push(o):(e._events[c]=o,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),o.prototype.eventNames=function(){var e,r,s=[];if(0===this._eventsCount)return s;for(r in e=this._events)t.call(e,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},o.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,i=r.length,a=new Array(i);s=-32099&&e<=-32e3}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=s,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:i=!1}={}){const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&o(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,o(t,"data")&&(d.data=t.data)):(d.message=r(d.code),d.data={originalError:a(e)})}else d.code=t.standardErrorCodes.rpc.internal,d.message=c(e,"message")?e.message:n,d.data={originalError:a(e)};return i&&(d.stack=c(e,"stack")?e.stack:void 0),d}}(f),Object.defineProperty(g,"__esModule",{value:!0}),g.standardErrors=void 0;const _=p,m=f;function y(e,t){const[n,r]=v(t);return new w(e,n||(0,m.getMessageFromCode)(e),r)}function b(e,t){const[n,r]=v(t);return new E(e,n||(0,m.getMessageFromCode)(e),r)}function v(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}g.standardErrors={rpc:{parse:e=>y(_.standardErrorCodes.rpc.parse,e),invalidRequest:e=>y(_.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>y(_.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>y(_.standardErrorCodes.rpc.methodNotFound,e),internal:e=>y(_.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return y(t,e)},invalidInput:e=>y(_.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>y(_.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>y(_.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>y(_.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>y(_.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>y(_.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>b(_.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>b(_.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>b(_.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>b(_.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>b(_.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>b(_.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new E(t,n,r)}}};class w extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}}class E extends w{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=void 0;var t=p;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});var n=g;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}})}(h);var S={},C={};Object.defineProperty(C,"__esModule",{value:!0}),C.isErrorResponse=void 0,C.isErrorResponse=function(e){return void 0!==e.errorMessage};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.LIB_VERSION=void 0,k.LIB_VERSION="4.0.3",Object.defineProperty(S,"__esModule",{value:!0}),S.serializeError=void 0;const I=C,M=k,x=p,L=f;S.serializeError=function(e,t){const n=(0,L.serialize)(function(e){if("string"==typeof e)return{message:e,code:x.standardErrorCodes.rpc.internal};if((0,I.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",M.LIB_VERSION),r.searchParams.set("code",n.code.toString());const s=function(e,t){const n=null==e?void 0:e.method;if(n)return n;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(n.data,t);return s&&r.searchParams.set("method",s),r.searchParams.set("message",n.message),Object.assign(Object.assign({},n),{docUrl:r.href})};var A={};function R(){return e=>e}Object.defineProperty(A,"__esModule",{value:!0}),A.RegExpString=A.IntNumber=A.BigIntString=A.AddressString=A.HexString=A.OpaqueType=void 0,A.OpaqueType=R,A.HexString=e=>e,A.AddressString=e=>e,A.BigIntString=e=>e,A.IntNumber=function(e){return Math.floor(e)},A.RegExpString=e=>e;var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.areAddressArraysEqual=P.getFavicon=P.range=P.isBigNumber=P.ensureParsedJSONObject=P.ensureBigInt=P.ensureRegExpString=P.ensureIntNumber=P.ensureBuffer=P.ensureAddressString=P.ensureEvenLengthHexString=P.ensureHexString=P.isHexString=P.prepend0x=P.strip0x=P.has0xPrefix=P.hexStringFromIntNumber=P.intNumberFromHexString=P.bigIntStringFromBigInt=P.hexStringFromBuffer=P.hexStringToUint8Array=P.uint8ArrayToHex=P.randomBytesHex=void 0;const N=h,j=A,O=/^[0-9]*$/,D=/^[a-f0-9]*$/;function T(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function U(e){return e.startsWith("0x")||e.startsWith("0X")}function W(e){return U(e)?e.slice(2):e}function B(e){return U(e)?`0x${e.slice(2)}`:`0x${e}`}function H(e){if("string"!=typeof e)return!1;const t=W(e).toLowerCase();return D.test(t)}function q(e,t=!1){if("string"==typeof e){const n=W(e).toLowerCase();if(D.test(n))return(0,j.HexString)(t?`0x${n}`:n)}throw N.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function F(e,t=!1){let n=q(e,!1);return n.length%2==1&&(n=(0,j.HexString)(`0${n}`)),t?(0,j.HexString)(`0x${n}`):n}function V(e){if("number"==typeof e&&Number.isInteger(e))return(0,j.IntNumber)(e);if("string"==typeof e){if(O.test(e))return(0,j.IntNumber)(Number(e));if(H(e))return(0,j.IntNumber)(Number(BigInt(F(e,!0))))}throw N.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function K(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}P.randomBytesHex=function(e){return T(crypto.getRandomValues(new Uint8Array(e)))},P.uint8ArrayToHex=T,P.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},P.hexStringFromBuffer=function(e,t=!1){const n=e.toString("hex");return(0,j.HexString)(t?`0x${n}`:n)},P.bigIntStringFromBigInt=function(e){return(0,j.BigIntString)(e.toString(10))},P.intNumberFromHexString=function(e){return(0,j.IntNumber)(Number(BigInt(F(e,!0))))},P.hexStringFromIntNumber=function(e){return(0,j.HexString)(`0x${BigInt(e).toString(16)}`)},P.has0xPrefix=U,P.strip0x=W,P.prepend0x=B,P.isHexString=H,P.ensureHexString=q,P.ensureEvenLengthHexString=F,P.ensureAddressString=function(e){if("string"==typeof e){const t=W(e).toLowerCase();if(H(t)&&40===t.length)return(0,j.AddressString)(B(t))}throw N.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},P.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(H(e)){const t=F(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw N.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},P.ensureIntNumber=V,P.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,j.RegExpString)(e.toString());throw N.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},P.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||K(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(V(e));if("string"==typeof e){if(O.test(e))return BigInt(e);if(H(e))return BigInt(F(e,!0))}throw N.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},P.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw N.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},P.isBigNumber=K,P.range=function(e,t){return Array.from({length:t-e},((t,n)=>e+n))},P.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:n}=document.location,r=e?e.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?t+r:`${t}//${n}${r}`},P.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))};var z={},Z={},$={},G={};Object.defineProperty(G,"__esModule",{value:!0}),G.decryptContent=G.encryptContent=G.importKeyFromHexString=G.exportKeyToHexString=G.decrypt=G.encrypt=G.deriveSharedSecret=G.generateKeyPair=void 0;const Y=P;async function J(e,t){const n=crypto.getRandomValues(new Uint8Array(12));return{iv:n,cipherText:await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,(new TextEncoder).encode(t))}}async function Q(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(r)}function X(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}G.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},G.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},G.encrypt=J,G.decrypt=Q,G.exportKeyToHexString=async function(e,t){const n=X(e),r=await crypto.subtle.exportKey(n,t);return(0,Y.uint8ArrayToHex)(new Uint8Array(r))},G.importKeyFromHexString=async function(e,t){const n=X(e),r=(0,Y.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(n,r,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},G.encryptContent=async function(e,t){return J(t,JSON.stringify(e,((e,t)=>{if(!(t instanceof Error))return t;const n=t;return Object.assign(Object.assign({},n.code?{code:n.code}:{}),{message:n.message})})))},G.decryptContent=async function(e,t){return JSON.parse(await Q(t,e))};var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.ScopedLocalStorage=void 0;class te{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let n=0;nlocalStorage.removeItem(e)))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new te("CBWSDK").clear(),new te("walletlink").clear()}}ee.ScopedLocalStorage=te,Object.defineProperty($,"__esModule",{value:!0}),$.SCWKeyManager=void 0;const ne=G,re=ee,se={storageKey:"ownPrivateKey",keyType:"private"},ie={storageKey:"ownPublicKey",keyType:"public"},ae={storageKey:"peerPublicKey",keyType:"public"};$.SCWKeyManager=class{constructor(){this.storage=new re.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(ae,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(ie.storageKey),this.storage.removeItem(se.storageKey),this.storage.removeItem(ae.storageKey)}async generateKeyPair(){const e=await(0,ne.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(se,e.privateKey),await this.storeKey(ie,e.publicKey)}async loadKeysIfNeeded(){if(null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(se)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(ie)),null!==this.ownPrivateKey&&null!==this.ownPublicKey||await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(ae)),null===this.sharedSecret){if(null===this.ownPrivateKey||null===this.peerPublicKey)return;this.sharedSecret=await(0,ne.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,ne.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const n=await(0,ne.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}};var oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.SCWStateManager=void 0;const ce=ee,de="accounts",le="activeChain",ue="availableChains",he="walletCapabilities";oe.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new ce.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(ue),this._walletCapabilities=this.loadItemFromStorage(he);const r=this.loadItemFromStorage(de),s=this.loadItemFromStorage(le);r&&this.updateListener.onAccountsUpdate({accounts:r,source:"storage"}),s&&this.updateListener.onChainUpdate({chain:s,source:"storage"}),this._accounts=r||[],this._activeChain=s||{id:null!==(n=null===(t=e.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(de,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=null===(t=this.availableChains)||void 0===t?void 0:t.find((t=>t.id===e));return!!n&&(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(le,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0)}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;const t=Object.entries(e).map((([e,t])=>({id:Number(e),rpcUrl:t})));this.availableChains=t,this.storeItemToStorage(ue,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(he,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}},Object.defineProperty(Z,"__esModule",{value:!0}),Z.SCWSigner=void 0;const pe=$,ge=oe,fe=h,_e=P,me=G;Z.SCWSigner=class{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new pe.SCWKeyManager,this.stateManager=new ge.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,me.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);const r=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},r);const s=r.result;if("error"in s)throw s.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const n=await this.sendEncryptedRequest(e),r=await this.decryptResponseMessage(n);this.updateInternalState(e,r);const s=r.result;if("error"in s)throw s.error;return s.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const n=e.params;if(!n||!(null===(t=n[0])||void 0===t?void 0:t.chainId))throw fe.standardErrors.rpc.invalidParams();const r=(0,_e.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(r)?null:void 0}case"wallet_getCapabilities":{const e=this.stateManager.walletCapabilities;if(!e)throw fe.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return e}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw fe.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await(0,me.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),r=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(r)}async createRequestMessage(e){const t=await(0,me.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const n=await this.keyManager.getSharedSecret();if(!n)throw fe.standardErrors.provider.unauthorized("Invalid session");return(0,me.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,r;const s=null===(n=t.data)||void 0===n?void 0:n.chains;s&&this.stateManager.updateAvailableChains(s);const i=null===(r=t.data)||void 0===r?void 0:r.capabilities;i&&this.stateManager.updateWalletCapabilities(i);const a=t.result;if(!("error"in a))switch(e.method){case"eth_requestAccounts":{const e=a.value;this.stateManager.updateAccounts(e);break}case"wallet_switchEthereumChain":{if(null!==a.value)return;const t=e.params,n=(0,_e.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(n);break}}}};var ye={};const be=r;function ve(e){return Buffer.allocUnsafe(e).fill(0)}function we(e,t){let n=e.toString(16);n.length%2!=0&&(n="0"+n);const r=n.match(/.{1,2}/g).map((e=>parseInt(e,16)));for(;r.lengthn)throw new Error("Elements exceed array size: "+n);for(i in s=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)s.push(Ne(e,t[i]));if("dynamic"===n){var a=Ne("uint256",t.length);s.unshift(a)}return Buffer.concat(s)}if("bytes"===e)return t=new Buffer(t),s=Buffer.concat([Ne("uint256",t.length),t]),t.length%32!=0&&(s=Buffer.concat([s,Me.zeros(32-t.length%32)])),s;if(e.startsWith("bytes")){if((n=Le(e))<1||n>32)throw new Error("Invalid bytes width: "+n);return Me.setLengthRight(t,32)}if(e.startsWith("uint")){if((n=Le(e))%8||n<8||n>256)throw new Error("Invalid uint width: "+n);r=Pe(t);const s=Me.bitLengthFromBigInt(r);if(s>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+s);if(r<0)throw new Error("Supplied uint is negative");return Me.bufferBEFromBigInt(r,32)}if(e.startsWith("int")){if((n=Le(e))%8||n<8||n>256)throw new Error("Invalid int width: "+n);r=Pe(t);const s=Me.bitLengthFromBigInt(r);if(s>n)throw new Error("Supplied int exceeds width: "+n+" vs "+s);const i=Me.twosFromBigInt(r,256);return Me.bufferBEFromBigInt(i,32)}if(e.startsWith("ufixed")){if(n=Ae(e),(r=Pe(t))<0)throw new Error("Supplied ufixed is negative");return Ne("uint256",r*BigInt(2)**BigInt(n[1]))}if(e.startsWith("fixed"))return n=Ae(e),Ne("int256",Pe(t)*BigInt(2)**BigInt(n[1]));throw new Error("Unsupported or invalid type: "+e)}function je(e){return"string"===e||"bytes"===e||"dynamic"===Re(e)}function Oe(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+n);s.push(Me.setLengthRight(o,n))}else if(a.startsWith("uint")){if((n=Le(a))%8||n<8||n>256)throw new Error("Invalid uint width: "+n);r=Pe(o);const e=Me.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+e);s.push(Me.bufferBEFromBigInt(r,n/8))}else{if(!a.startsWith("int"))throw new Error("Unsupported or invalid type: "+a);{if((n=Le(a))%8||n<8||n>256)throw new Error("Invalid int width: "+n);r=Pe(o);const e=Me.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied int exceeds width: "+n+" vs "+e);const t=Me.twosFromBigInt(r,n);s.push(Me.bufferBEFromBigInt(t,n/8))}}}return Buffer.concat(s)}const De=Ie,Te={rawEncode:function(e,t){var n=[],r=[],s=32*e.length;for(var i in e){var a=xe(e[i]),o=Ne(a,t[i]);je(a)?(n.push(Ne("uint256",s)),r.push(o),s+=o.length):n.push(o)}return Buffer.concat(n.concat(r))},solidityPack:Oe,soliditySHA3:function(e,t){return Me.keccak(Oe(e,t))}},Ue={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"]},We={encodeData(e,t,n,r=!0){const s=["bytes32"],i=[this.hashType(e,n)];if(r){const a=(e,t,s)=>{if(void 0!==n[t])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":De.keccak(this.encodeData(t,s,n,r))];if(void 0===s)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",De.keccak(s)];if("string"===t)return"string"==typeof s&&(s=Buffer.from(s,"utf8")),["bytes32",De.keccak(s)];if(t.lastIndexOf("]")===t.length-1){const n=t.slice(0,t.lastIndexOf("[")),r=s.map((t=>a(e,n,t)));return["bytes32",De.keccak(Te.rawEncode(r.map((([e])=>e)),r.map((([,e])=>e))))]}return[t,s]};for(const r of n[e]){const[e,n]=a(r.name,r.type,t[r.name]);s.push(e),i.push(n)}}else for(const a of n[e]){let e=t[a.name];if(void 0!==e)if("bytes"===a.type)s.push("bytes32"),e=De.keccak(e),i.push(e);else if("string"===a.type)s.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=De.keccak(e),i.push(e);else if(void 0!==n[a.type])s.push("bytes32"),e=De.keccak(this.encodeData(a.type,e,n,r)),i.push(e);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(e)}}return Te.rawEncode(s,i)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter((t=>t!==e));r=[e].concat(r.sort());for(const s of r){if(!t[s])throw new Error("No type definition specified: "+s);n+=s+"("+t[s].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||void 0===t[e])return n;n.push(e);for(const r of t[e])for(const e of this.findTypeDependencies(r.type,t,n))!n.includes(e)&&n.push(e);return n},hashStruct(e,t,n,r=!0){return De.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return De.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in Ue.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),"EIP712Domain"!==n.primaryType&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),De.keccak(Buffer.concat(r))}};var Be={TYPED_MESSAGE_SCHEMA:Ue,TypedDataUtils:We,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const n=e.map((function(e){return"bytes"===e.type?De.toBuffer(e.value):e.value})),r=e.map((function(e){return e.type})),s=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Te.soliditySHA3(["bytes32","bytes32"],[Te.soliditySHA3(new Array(e.length).fill("string"),s),Te.soliditySHA3(r,n)])}(e.data)},hashForSignTypedData_v3:function(e){return We.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return We.hash(e.data)}};var He={};Object.defineProperty(He,"__esModule",{value:!0}),He.APP_VERSION_KEY=He.LOCAL_STORAGE_ADDRESSES_KEY=He.WALLET_USER_NAME_KEY=void 0,He.WALLET_USER_NAME_KEY="walletUsername",He.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",He.APP_VERSION_KEY="AppVersion";var qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.RelayEventManager=void 0;const Fe=P;qe.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,Fe.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}};var Ve={},Ke={},ze={};Object.defineProperty(ze,"__esModule",{value:!0}),ze.WalletLinkCipher=void 0;const Ze=P;ze.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.importKey("raw",(0,Ze.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,i=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},r,s.encode(e)),a=i.slice(i.byteLength-16),o=i.slice(0,i.byteLength-16),c=new Uint8Array(a),d=new Uint8Array(o),l=new Uint8Array([...n,...c,...d]);return(0,Ze.uint8ArrayToHex)(l)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((n,r)=>{!async function(){const s=await crypto.subtle.importKey("raw",(0,Ze.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=(0,Ze.hexStringToUint8Array)(e),a=i.slice(0,12),o=i.slice(12,28),c=i.slice(28),d=new Uint8Array([...c,...o]),l={name:"AES-GCM",iv:new Uint8Array(a)};try{const e=await window.crypto.subtle.decrypt(l,s,d),t=new TextDecoder;n(t.decode(e))}catch(u){r(u)}}()}))}};var $e={};Object.defineProperty($e,"__esModule",{value:!0}),$e.WalletLinkHTTP=void 0;$e.WalletLinkHTTP=class{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const r=`${t}:${n}`;this.auth=`Basic ${btoa(r)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:n,error:r}=await t.json();if(r)throw new Error(`Check unseen events failed: ${r}`);const s=null!==(e=null==n?void 0:n.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${t.status}`)}};var Ge,Ye,Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.WalletLinkWebSocket=Je.ConnectionState=void 0,(Ye=Ge||(Je.ConnectionState=Ge={}))[Ye.DISCONNECTED=0]="DISCONNECTED",Ye[Ye.CONNECTING=1]="CONNECTING",Ye[Ye.CONNECTED=2]="CONNECTED";Je.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var n;let r;try{this.webSocket=r=new this.WebSocketClass(this.url)}catch(s){return void t(s)}null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.CONNECTING),r.onclose=e=>{var n;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.DISCONNECTED)},r.onopen=t=>{var n;if(e(),null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},r.onmessage=e=>{var t,n;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(n=this.incomingDataListener)||void 0===n||n.call(this,t)}catch(r){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,Ge.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(n){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.WalletLinkConnection=void 0;const Qe=He,Xe=ze,et=$e,tt=Je,nt=A;Ke.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:n,WebSocketClass:r=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,nt.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach(((t,n)=>{const r=e[n];void 0!==r&&t(r)}))},this.handleDestroyed=e=>{var t;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;{const n=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(n)}},this.handleMetadataUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.metadataUpdated(e,r)}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(Qe.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(Qe.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(e),s=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.chainUpdated(r,s)}},this.session=e,this.cipher=new Xe.WalletLinkCipher(e.secret),this.listener=n;const s=new tt.WalletLinkWebSocket(`${t}/rpc`,r);s.setConnectionStateListener((async e=>{let t=!1;switch(e){case tt.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||s.connect().catch((()=>{e()}))};e()}break;case tt.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),t=!0}catch(n){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case tt.ConnectionState.CONNECTING:}this.connected!==t&&(this.connected=t)})),s.setIncomingDataListener((e=>{var t;switch(e.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null===(t=this.requestResolutions.get(e.id))||void 0===t||t(e))})),this.ws=s,this.http=new et.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this))}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,n;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(n=this.listener)||void 0===n||n.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t;if("Event"===e.type&&"Web3Response"===e.event){const n=await this.cipher.decrypt(e.data),r=JSON.parse(n);if("WEB3_RESPONSE"!==r.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(r)}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const n={type:"SetSessionConfig",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(n);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,n=!1){const r=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:r,callWebhook:n};return this.setOnceLinked((async()=>{const e=await this.makeRequest(s);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const n=e.id;let r;return this.sendData(e),Promise.race([new Promise(((e,s)=>{r=window.setTimeout((()=>{s(new Error(`request ${n} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(n,(t=>{clearTimeout(r),e(t),this.requestResolutions.delete(n)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var rt={};Object.defineProperty(rt,"__esModule",{value:!0}),rt.WalletLinkSession=void 0;const st=s,it=P,at="session:id",ot="session:secret",ct="session:linked";class dt{constructor(e,t,n,r){this._storage=e,this._id=t||(0,it.randomBytesHex)(16),this._secret=n||(0,it.randomBytesHex)(32),this._key=(new st.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!r}static load(e){const t=e.getItem(at),n=e.getItem(ct),r=e.getItem(ot);return t&&r?new dt(e,t,r,"1"===n):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(at,this._id),this._storage.setItem(ot,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(ct,this._linked?"1":"0")}}rt.WalletLinkSession=dt;var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.isDarkMode=lt.isMobileWeb=lt.getLocation=lt.createQrUrl=void 0,lt.createQrUrl=function(e,t,n,r,s,i){const a=r?"parent-id":"id";return`${n}/#/link?${new URLSearchParams({[a]:e,secret:t,server:n,v:s,chainId:i.toString()}).toString()}`},lt.getLocation=function(){try{return function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top?window.top.location:window.location}catch(e){return window.location}},lt.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)},lt.isDarkMode=function(){var e,t;return null!==(t=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&void 0!==t&&t};var ut={},ht={},pt={};Object.defineProperty(pt,"__esModule",{value:!0}),pt.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 gt=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.injectCssReset=void 0;const ft=gt(pt);ht.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(ft.default)),document.documentElement.appendChild(e)};var _t,mt,yt,bt,vt,wt,Et,St,Ct,kt,It,Mt,xt={},Lt={},At=[],Rt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pt=Array.isArray;function Nt(e,t){for(var n in t)e[n]=t[n];return e}function jt(e){var t=e.parentNode;t&&t.removeChild(e)}function Ot(e,t,n){var r,s,i,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?_t.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return Dt(e,a,r,s,null)}function Dt(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++yt:s,__i:-1,__u:0};return null==s&&null!=mt.vnode&&mt.vnode(i),i}function Tt(e){return e.children}function Ut(e,t){this.props=e,this.context=t}function Wt(e,t){if(null==t)return e.__?Wt(e.__,e.__i+1):null;for(var n;tt&&vt.sort(St));qt.__r=0}function Ft(e,t,n,r,s,i,a,o,c,d,l){var u,h,p,g,f,_=r&&r.__k||At,m=t.length;for(n.__d=c,function(e,t,n){var r,s,i,a,o,c=t.length,d=n.length,l=d,u=0;for(e.__k=[],r=0;r0?Dt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,o=Kt(s,n,a,l),s.__i=o,i=null,-1!==o&&(l--,(i=n[o])&&(i.__u|=131072)),null==i||null===i.__v?(-1==o&&u--,"function"!=typeof s.type&&(s.__u|=65536)):o!==a&&(o===a+1?u++:o>a?l>c-a?u+=o-a:u--:o(null==c||131072&c.__u?0:1))for(;a>=0||o=0){if((c=t[a])&&!(131072&c.__u)&&s==c.key&&i===c.type)return a;a--}if(o2&&(o.children=arguments.length>3?_t.call(arguments,2):n),Dt(e.type,o,r||e.key,s||e.ref,null)},createContext:function(e,t){var n={__c:t="__cC"+Mt++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,Ht(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createElement:Ot,createRef:function(){return{current:null}},h:Ot,hydrate:function e(t,n){en(t,n,e)},get isValidElement(){return bt},get options(){return mt},render:en,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(Pt(t)?t.some((function(t){e(t,n)})):n.push(t)),n}},Symbol.toStringTag,{value:"Module"})),nn=t(tn);var rn,sn,an,on,cn=0,dn=[],ln=[],un=mt,hn=un.__b,pn=un.__r,gn=un.diffed,fn=un.__c,_n=un.unmount,mn=un.__;function yn(e,t){un.__h&&un.__h(sn,e,cn||t),cn=0;var n=sn.__H||(sn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:ln}),n.__[e]}function bn(e){return cn=1,vn(Ln,e)}function vn(e,t,n){var r=yn(rn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ln(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=sn,!sn.u)){var s=function(e,t,n){if(!r.__c.__H)return!0;var s=r.__c.__H.__.filter((function(e){return!!e.__c}));if(s.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var a=!1;return s.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};sn.u=!0;var i=sn.shouldComponentUpdate,a=sn.componentWillUpdate;sn.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,s(e,t,n),i=r}a&&a.call(this,e,t,n)},sn.shouldComponentUpdate=s}return r.__N||r.__}function wn(e,t){var n=yn(rn++,4);!un.__s&&xn(n.__H,t)&&(n.__=e,n.i=t,sn.__h.push(n))}function En(e,t){var n=yn(rn++,7);return xn(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Sn(){for(var e;e=dn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(In),e.__H.__h.forEach(Mn),e.__H.__h=[]}catch(t){e.__H.__h=[],un.__e(t,e.__v)}}un.__b=function(e){sn=null,hn&&hn(e)},un.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mn&&mn(e,t)},un.__r=function(e){pn&&pn(e),rn=0;var t=(sn=e.__c).__H;t&&(an===sn?(t.__h=[],sn.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=ln,e.__N=e.i=void 0}))):(t.__h.forEach(In),t.__h.forEach(Mn),t.__h=[],rn=0)),an=sn},un.diffed=function(e){gn&&gn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==dn.push(t)&&on===un.requestAnimationFrame||((on=un.requestAnimationFrame)||kn)(Sn)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==ln&&(e.__=e.__V),e.i=void 0,e.__V=ln}))),an=sn=null},un.__c=function(e,t){t.some((function(e){try{e.__h.forEach(In),e.__h=e.__h.filter((function(e){return!e.__||Mn(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],un.__e(n,e.__v)}})),fn&&fn(e,t)},un.unmount=function(e){_n&&_n(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{In(e)}catch(n){t=n}})),n.__H=void 0,t&&un.__e(t,n.__v))};var Cn="function"==typeof requestAnimationFrame;function kn(e){var t,n=function(){clearTimeout(r),Cn&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Cn&&(t=requestAnimationFrame(n))}function In(e){var t=sn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),sn=t}function Mn(e){var t=sn;e.__c=e.__(),sn=t}function xn(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ln(e,t){return"function"==typeof t?t(e):t}const An=t(Object.freeze(Object.defineProperty({__proto__:null,useCallback:function(e,t){return cn=8,En((function(){return e}),t)},useContext:function(e){var t=sn.context[e.__c],n=yn(rn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(sn)),t.props.value):e.__},useDebugValue:function(e,t){un.useDebugValue&&un.useDebugValue(t?t(e):e)},useEffect:function(e,t){var n=yn(rn++,3);!un.__s&&xn(n.__H,t)&&(n.__=e,n.i=t,sn.__H.__h.push(n))},useErrorBoundary:function(e){var t=yn(rn++,10),n=bn();return t.__=e,sn.componentDidCatch||(sn.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:function(){var e=yn(rn++,11);if(!e.__){for(var t=sn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},useImperativeHandle:function(e,t,n){cn=6,wn((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))},useLayoutEffect:wn,useMemo:En,useReducer:vn,useRef:function(e){return cn=5,En((function(){return{current:e}}),[])},useState:bn},Symbol.toStringTag,{value:"Module"})));var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.default=(()=>".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}")(),function(t){var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=n(i),s=nn,a=An,o=lt,c=n(Rn);t.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,o.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,s.render)((0,s.h)("div",null,(0,s.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,n])=>(0,s.h)(t.SnackbarInstance,Object.assign({},n,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,s.h)("style",null,c.default),(0,s.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:n})=>{const[i,o]=(0,a.useState)(!0),[c,d]=(0,a.useState)(null!=e&&e);(0,a.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!1)}),1),window.setTimeout((()=>{d(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",i&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{d(!c)}},(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,s.h)("div",{class:"-gear-container"},!c&&(0,s.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map(((e,t)=>(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,s.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,s.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(xt),Object.defineProperty(ut,"__esModule",{value:!0}),ut.WalletLinkRelayUI=void 0;const Pn=ht,Nn=xt;ut.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new Nn.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,Pn.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}};var jn={},On={},Dn={};Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.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 Tn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(On,"__esModule",{value:!0}),On.RedirectDialog=void 0;const Un=Tn(i),Wn=nn,Bn=ht,Hn=xt,qn=lt,Fn=Tn(Dn);On.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,qn.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Bn.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Wn.render)(null,this.root),e&&(0,Wn.render)((0,Wn.h)(Vn,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const Vn=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:s})=>{const i=n?"dark":"light";return(0,Wn.h)(Hn.SnackbarContainer,{darkMode:n},(0,Wn.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Wn.h)("style",null,Fn.default),(0,Wn.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Wn.h)("div",{class:(0,Un.default)("-cbwsdk-redirect-dialog-box",i)},(0,Wn.h)("p",null,e),(0,Wn.h)("button",{onClick:r},t))))};var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.CBW_MOBILE_DEEPLINK_URL=Kn.WALLETLINK_URL=Kn.CB_KEYS_URL=void 0,Kn.CB_KEYS_URL="https://keys.coinbase.com/connect",Kn.WALLETLINK_URL="https://www.walletlink.org",Kn.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink",Object.defineProperty(jn,"__esModule",{value:!0}),jn.WLMobileRelayUI=void 0;const zn=On,Zn=lt,$n=Kn;jn.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new zn.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL($n.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Zn.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}},Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.WalletLinkRelay=void 0;const Gn=Ke,Yn=He,Jn=qe,Qn=rt,Xn=C,er=lt,tr=ut,nr=jn,rr=h,sr=P,ir=ee;class ar{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,er.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{this.isLinked=e;const t=this.storage.getItem(Yn.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){const n=t.split(" "),r="true"===this.storage.getItem("IsStandaloneSigning");""===n[0]||e||!this._session.linked||r||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),ar.accountRequestCallbackIds.size>0&&(Array.from(ar.accountRequestCallbackIds.values()).forEach((t=>{const n={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},n),{id:t}))})),ar.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:n,connection:r}=this.subscribe();this._session=t,this.connection=r,this.relayEventManager=new Jn.RelayEventManager,this.ui=n}subscribe(){const e=Qn.WalletLinkSession.load(this.storage)||new Qn.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Gn.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),r=this.isMobileWeb?new nr.WLMobileRelayUI:new tr.WalletLinkRelayUI;return n.connect(),{session:e,ui:r,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{this.connection.destroy();const e=Qn.WalletLinkSession.load(this.storage);(null==e?void 0:e.id)===this._session.id&&ir.ScopedLocalStorage.clearAll(),document.location.reload()})).catch((e=>{}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,r){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,sr.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:r||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,sr.hexStringFromBuffer)(e,!0),signature:(0,sr.hexStringFromBuffer)(t,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,sr.bigIntStringFromBigInt)(e.weiValue),data:(0,sr.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,sr.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,sr.bigIntStringFromBigInt)(e.weiValue),data:(0,sr.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,sr.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,sr.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,sr.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,sr.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const n=(0,sr.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),null==t||t()};return new Promise(((s,i)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:r,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,(e=>{if(null==t||t(),(0,Xn.isErrorResponse)(e))return i(new Error(e.errorMessage));s(e)})),this.publishWeb3RequestEvent(n,e)}))}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then((e=>{})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})})),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof nr.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if("requestEthereumAccounts"===t.method)return ar.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void ar.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,n){var r;const s=null!==(r=null==n?void 0:n.message)&&void 0!==r?r:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:s}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,sr.randomBytesHex)(8);return new Promise(((n,r)=>{this.relayEventManager.callbacks.set(t,(e=>{if((0,Xn.isErrorResponse)(e))return r(new Error(e.errorMessage));n(e)})),ar.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)}))}watchAsset(e,t,n,r,s,i){const a={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,decimals:r,image:s},chainId:i}};let o=null;const c=(0,sr.randomBytesHex)(8),d=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Xn.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}addEthereumChain(e,t,n,r,s,i){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:r,chainName:s,iconUrls:n,nativeCurrency:i}};let o=null;const c=(0,sr.randomBytesHex)(8),d=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Xn.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}switchEthereumChain(e,t){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},r=(0,sr.randomBytesHex)(8);return new Promise(((e,t)=>{this.relayEventManager.callbacks.set(r,(n=>(0,Xn.isErrorResponse)(n)&&n.errorCode?t(rr.standardErrors.provider.custom({code:n.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,Xn.isErrorResponse)(n)?t(new Error(n.errorMessage)):void e(n))),this.publishWeb3RequestEvent(r,n)}))}}Ve.WalletLinkRelay=ar,ar.accountRequestCallbackIds=new Set;var or=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.WalletLinkSigner=void 0;const cr=or(Be),dr=He,lr=qe,ur=C,hr=Ve,pr=Kn,gr=h,fr=P,_r=ee,mr="DefaultChainId",yr="DefaultJsonRpcUrl";ye.WalletLinkSigner=class{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:r,appLogoUrl:s}=e.metadata;this._appName=r,this._appLogoUrl=s,this._storage=new _r.ScopedLocalStorage("walletlink",pr.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new lr.RelayEventManager,this._jsonRpcUrlFromOpts="";const i=this._storage.getItem(dr.LOCAL_STORAGE_ADDRESSES_KEY);if(i){const e=i.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,fr.ensureAddressString)(e))),null===(t=this.updateListener)||void 0===t||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(mr)&&(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(yr))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(yr,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(mr,t.toString(10));!((0,fr.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,r,s,i){const a=this.initializeRelay(),o=await a.watchAsset(e,t,n,r,s,null==i?void 0:i.toString());return!(0,ur.isErrorResponse)(o)&&!!o.result}async addEthereumChain(e,t,n,r,s,i){var a,o;if((0,fr.ensureIntNumber)(e)===this.getChainId())return!1;const c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts();const d=await c.addEthereumChain(e.toString(),t,s,n,r,i);return!(0,ur.isErrorResponse)(d)&&(!0===(null===(a=d.result)||void 0===a?void 0:a.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(o=d.result)||void 0===o?void 0:o.isApproved))}async switchEthereumChain(e){const t=this.initializeRelay(),n=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,ur.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===gr.standardErrorCodes.provider.unsupportedChain?gr.standardErrors.provider.unsupportedChain():gr.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const r=n.result;r.isApproved&&r.rpcUrl.length>0&&this.updateProviderInfo(r.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch((e=>{throw e}))}catch(t){return Promise.reject(t)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw gr.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw gr.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw gr.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const r=void 0===n?[]:n,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:r,jsonrpc:"2.0",id:s})).result}_setAddresses(e,t){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,fr.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,null===(n=this.updateListener)||void 0===n||n.onAccountsUpdate({accounts:r,source:"wallet"}),this._storage.setItem(dr.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,n)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n})}catch(r){return n(r)}this._handleAsynchronousMethods(e).then((n=>n&&t(Object.assign(Object.assign({},n),{id:e.id})))).catch((e=>n(e)))}))}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,n=e.params||[];switch(t){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":default: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"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}}_isKnownAddress(e){try{const t=(0,fr.ensureAddressString)(e);return this._addresses.map((e=>(0,fr.ensureAddressString)(e))).includes(t)}catch(t){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,fr.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,fr.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,fr.ensureBigInt)(e.value):BigInt(0),data:e.data?(0,fr.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,fr.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,fr.ensureBigInt)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,fr.ensureBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,fr.ensureBigInt)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,fr.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,fr.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw gr.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw gr.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,n,r){this._ensureKnownAddress(t);try{const s=this.initializeRelay(),i=await s.signEthereumMessage(e,t,n,r);if((0,ur.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied message signature");throw s}}async _ethereumAddressFromSignedMessage(e,t,n){const r=this.initializeRelay(),s=await r.ethereumAddressFromSignedMessage(e,t,n);if((0,ur.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,fr.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(mr);if(!e)return(0,fr.ensureIntNumber)(1);const t=parseInt(e,10);return(0,fr.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{const t=this.initializeRelay();if(e=await t.requestEthereumAccounts(),(0,ur.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){if("string"==typeof t.message&&t.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied account authorization");throw t}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signEthereumTransaction(t);if((0,ur.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(n){if("string"==typeof n.message&&n.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw n}}async _eth_sendRawTransaction(e){const t=(0,fr.ensureBuffer)(e[0]),n=this.initializeRelay(),r=await n.submitEthereumTransaction(t,this.getChainId());if((0,ur.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signAndSubmitEthereumTransaction(t);if((0,ur.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(n){if("string"==typeof n.message&&n.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,fr.ensureParsedJSONObject)(e[0]),n=(0,fr.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const r=cr.default.hashForSignTypedDataLegacy({data:t}),s=JSON.stringify(t,null,2);return this._signEthereumMessage(r,n,!1,s)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=cr.default.hashForSignTypedData_v3({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,s)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=cr.default.hashForSignTypedData_v4({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,s)}async _wallet_addEthereumChain(e){var t,n,r,s;const i=e[0];if(0===(null===(t=i.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!i.chainName||""===i.chainName.trim())throw gr.standardErrors.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw gr.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(i.chainId,16);return await this.addEthereumChain(a,null!==(n=i.rpcUrls)&&void 0!==n?n:[],null!==(r=i.blockExplorerUrls)&&void 0!==r?r:[],i.chainName,null!==(s=i.iconUrls)&&void 0!==s?s:[],i.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw gr.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw gr.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw gr.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw gr.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:r,symbol:s,image:i,decimals:a}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,r,s,a,i,n)}}initializeRelay(){if(!this._relay){const e=new hr.WalletLinkRelay({linkAPIUrl:pr.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),this._relay=e}return this._relay}};var br={};Object.defineProperty(br,"__esModule",{value:!0}),br.checkErrorForInvalidRequestArgs=br.getCoinbaseInjectedProvider=br.getCoinbaseInjectedSigner=br.fetchRPCRequest=void 0;const vr=k,wr=h;function Er(){return globalThis.coinbaseWalletSigner}br.fetchRPCRequest=async function(e,t){if(!t.rpcUrl)throw wr.standardErrors.rpc.internal("No RPC URL set for chain");const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t.rpcUrl,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":vr.LIB_VERSION}});return(await r.json()).result},br.getCoinbaseInjectedSigner=Er,br.getCoinbaseInjectedProvider=function({metadata:e,preference:t}){var n,r,s;const i=globalThis;if("smartWalletOnly"!==t.options){if(Er())return;const t=i.coinbaseWalletExtension;if(t){const{appName:r,appLogoUrl:s,appChainIds:i}=e;return null===(n=t.setAppInfo)||void 0===n||n.call(t,r,s,i),t}}const a=null!==(r=i.ethereum)&&void 0!==r?r:null===(s=i.top)||void 0===s?void 0:s.ethereum;if(null==a?void 0:a.isCoinbaseBrowser)return a},br.checkErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return wr.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;return"string"!=typeof t||0===t.length?wr.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e}):void 0===n||Array.isArray(n)||"object"==typeof n&&null!==n?void 0:wr.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e})},Object.defineProperty(z,"__esModule",{value:!0}),z.createSigner=z.fetchSignerType=z.storeSignerType=z.loadSignerType=void 0;const Sr=Z,Cr=ye,kr=h,Ir=br,Mr="SignerType",xr=new ee.ScopedLocalStorage("CBWSDK","SignerConfigurator");z.loadSignerType=function(){return xr.getItem(Mr)},z.storeSignerType=function(e){xr.setItem(Mr,e)},z.fetchSignerType=async function(e){const{communicator:t,metadata:n}=e;(async function(e,t){await e.onMessage((({event:e})=>"WalletLinkSessionRequest"===e));const n=new Cr.WalletLinkSigner({metadata:t});e.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})})(t,n).catch((()=>{}));const r={id:crypto.randomUUID(),event:"selectSignerType",data:e.preference},{data:s}=await t.postRequestAndWaitForResponse(r);return s},z.createSigner=function(e){const{signerType:t,metadata:n,communicator:r,updateListener:s}=e;switch(t){case"scw":return new Sr.SCWSigner({metadata:n,updateListener:s,communicator:r});case"walletlink":return new Cr.WalletLinkSigner({metadata:n,updateListener:s});case"extension":{const e=(0,Ir.getCoinbaseInjectedSigner)();if(!e)throw kr.standardErrors.rpc.internal("injected signer not found");return e}}};var Lr={},Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.closePopup=Ar.openPopup=void 0;const Rr=h;Ar.openPopup=function(e){const t=(window.innerWidth-420)/2+window.screenX,n=(window.innerHeight-540)/2+window.screenY,r=window.open(e,"Smart Wallet",`width=420, height=540, left=${t}, top=${n}`);if(null==r||r.focus(),!r)throw Rr.standardErrors.rpc.internal("Pop up window failed to open");return r},Ar.closePopup=function(e){e&&!e.closed&&e.close()},Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Communicator=void 0;const Pr=k,Nr=Ar,jr=Kn,Or=h;Lr.Communicator=class{constructor(e=jr.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{const t=this.onMessage((({requestId:t})=>t===e.id));return this.postMessage(e),await t},this.onMessage=async e=>new Promise(((t,n)=>{const r=n=>{if(n.origin!==this.url.origin)return;const s=n.data;e(s)&&(t(s),window.removeEventListener("message",r),this.listeners.delete(r))};window.addEventListener("message",r),this.listeners.set(r,{reject:n})})),this.disconnect=()=>{(0,Nr.closePopup)(this.popup),this.popup=null,this.listeners.forEach((({reject:e},t)=>{e(Or.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)})),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,Nr.openPopup)(this.url),this.onMessage((({event:e})=>"PopupUnload"===e)).then(this.disconnect).catch((()=>{})),this.onMessage((({event:e})=>"PopupLoaded"===e)).then((e=>{this.postMessage({requestId:e.id,data:{version:Pr.LIB_VERSION}})})).then((()=>{if(!this.popup)throw Or.standardErrors.rpc.internal();return this.popup}))),this.url=new URL(e)}};var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.determineMethodCategory=void 0;const Tr={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};Dr.determineMethodCategory=function(e){for(const t in Tr){const n=t;if(Tr[n].includes(e))return n}};var Ur=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s{try{if(this.connected)return this.emit("connect",{chainId:(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id))}),this.accounts;const e=await this.requestSignerSelection(),t=this.initSigner(e),n=await t.handshake();return this.signer=t,(0,Kr.storeSignerType)(e),this.emit("connect",{chainId:(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id))}),n}catch(t){throw this.handleUnauthorizedError(t),t}},sign:async e=>{if(!this.connected||!this.signer)throw Hr.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(e)}catch(t){throw this.handleUnauthorizedError(t),t}},fetch:e=>(0,zr.fetchRPCRequest)(e,this.chain),state:e=>{const t=()=>{if(this.connected)return this.accounts;throw Hr.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(e.method){case"eth_chainId":return(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return t();case"eth_coinbase":return t()[0];default:return this.handlers.unsupported(e)}},deprecated:({method:e})=>{throw Hr.standardErrors.rpc.methodNotSupported(`Method ${e} is deprecated.`)},unsupported:({method:e})=>{throw Hr.standardErrors.rpc.methodNotSupported(`Method ${e} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:e,source:t})=>{(0,Vr.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:e,source:t})=>{e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(e.id))))}},this.metadata=r,this.preference=a,this.communicator=new Zr.Communicator(i),this.chain={id:null!==(n=null===(t=r.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1};const o=(0,Kr.loadSignerType)();this.signer=o?this.initSigner(o):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const n=(0,zr.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const r=null!==(t=(0,$r.determineMethodCategory)(e.method))&&void 0!==t?t:"fetch";return this.handlers[r](e)}catch(n){return Promise.reject((0,qr.serializeError)(n,e.method))}}handleUnauthorizedError(e){e.code===Hr.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Gr.ScopedLocalStorage.clearAll(),this.emit("disconnect",Hr.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,Kr.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,Kr.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}d.CoinbaseWalletProvider=Yr,Object.defineProperty(o,"__esModule",{value:!0}),o.CoinbaseWalletSDK=void 0;const Jr=c,Qr=d,Xr=ee,es=k,ts=P,ns=br;o.CoinbaseWalletSDK=class{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,ts.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const n={metadata:this.metadata,preference:e};return null!==(t=(0,ns.getCoinbaseInjectedProvider)(n))&&void 0!==t?t:new Qr.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,Jr.walletLogo)(e,t)}storeLatestVersion(){new Xr.ScopedLocalStorage("CBWSDK").setItem("VERSION",es.LIB_VERSION)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletSDK=void 0;const t=o;e.default=t.CoinbaseWalletSDK;var n=o;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}})}(a);const rs=n(a),ss=Object.freeze(Object.defineProperty({__proto__:null,default:rs},Symbol.toStringTag,{value:"Module"}));export{ss as i}; +import{k as e,h as t,f as n}from"./index-Dm7MnfGv.js";import{j as r,s,r as i}from"./clsx.m-DBHroLNK.js";var a={},o={},c={};Object.defineProperty(c,"__esModule",{value:!0}),c.walletLogo=void 0;c.walletLogo=(e,t)=>{let n;switch(e){case"standard":default:return n=t,`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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 n=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${n}' 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`}};var d={},l={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function s(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,i||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],o]:e._events[c].push(o):(e._events[c]=o,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),o.prototype.eventNames=function(){var e,r,s=[];if(0===this._eventsCount)return s;for(r in e=this._events)t.call(e,r)&&s.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},o.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,i=r.length,a=new Array(i);s=-32099&&e<=-32e3}function a(e){return e&&"object"==typeof e&&!Array.isArray(e)?Object.assign({},e):e}function o(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return"object"==typeof e&&null!==e&&t in e&&"string"==typeof e[t]}e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.",e.getMessageFromCode=r,e.isValidCode=s,e.getErrorCode=function(e){var t;return"number"==typeof e?e:function(e){return"object"==typeof e&&null!==e&&("number"==typeof e.code||"number"==typeof e.errorCode)}(e)?null!==(t=e.code)&&void 0!==t?t:e.errorCode:void 0},e.serialize=function(e,{shouldIncludeStack:i=!1}={}){const d={};if(e&&"object"==typeof e&&!Array.isArray(e)&&o(e,"code")&&s(e.code)){const t=e;d.code=t.code,t.message&&"string"==typeof t.message?(d.message=t.message,o(t,"data")&&(d.data=t.data)):(d.message=r(d.code),d.data={originalError:a(e)})}else d.code=t.standardErrorCodes.rpc.internal,d.message=c(e,"message")?e.message:n,d.data={originalError:a(e)};return i&&(d.stack=c(e,"stack")?e.stack:void 0),d}}(f),Object.defineProperty(g,"__esModule",{value:!0}),g.standardErrors=void 0;const _=p,m=f;function y(e,t){const[n,r]=v(t);return new w(e,n||(0,m.getMessageFromCode)(e),r)}function b(e,t){const[n,r]=v(t);return new E(e,n||(0,m.getMessageFromCode)(e),r)}function v(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}g.standardErrors={rpc:{parse:e=>y(_.standardErrorCodes.rpc.parse,e),invalidRequest:e=>y(_.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>y(_.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>y(_.standardErrorCodes.rpc.methodNotFound,e),internal:e=>y(_.standardErrorCodes.rpc.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return y(t,e)},invalidInput:e=>y(_.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>y(_.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>y(_.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>y(_.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>y(_.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>y(_.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>b(_.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>b(_.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>b(_.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>b(_.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>b(_.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>b(_.standardErrorCodes.provider.unsupportedChain,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||"string"!=typeof n)throw new Error('"message" must be a nonempty string');return new E(t,n,r)}}};class w extends Error{constructor(e,t,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==n&&(this.data=n)}}class E extends w{constructor(e,t,n){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=void 0;var t=p;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});var n=g;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return n.standardErrors}})}(h);var S={},C={};Object.defineProperty(C,"__esModule",{value:!0}),C.isErrorResponse=void 0,C.isErrorResponse=function(e){return void 0!==e.errorMessage};var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.LIB_VERSION=void 0,k.LIB_VERSION="4.0.3",Object.defineProperty(S,"__esModule",{value:!0}),S.serializeError=void 0;const I=C,M=k,x=p,L=f;S.serializeError=function(e,t){const n=(0,L.serialize)(function(e){if("string"==typeof e)return{message:e,code:x.standardErrorCodes.rpc.internal};if((0,I.isErrorResponse)(e))return Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}});return e}(e),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",M.LIB_VERSION),r.searchParams.set("code",n.code.toString());const s=function(e,t){const n=null==e?void 0:e.method;if(n)return n;if(void 0===t)return;if("string"==typeof t)return t;if(!Array.isArray(t))return t.method;if(t.length>0)return t[0].method;return}(n.data,t);return s&&r.searchParams.set("method",s),r.searchParams.set("message",n.message),Object.assign(Object.assign({},n),{docUrl:r.href})};var A={};function R(){return e=>e}Object.defineProperty(A,"__esModule",{value:!0}),A.RegExpString=A.IntNumber=A.BigIntString=A.AddressString=A.HexString=A.OpaqueType=void 0,A.OpaqueType=R,A.HexString=e=>e,A.AddressString=e=>e,A.BigIntString=e=>e,A.IntNumber=function(e){return Math.floor(e)},A.RegExpString=e=>e;var P={};Object.defineProperty(P,"__esModule",{value:!0}),P.areAddressArraysEqual=P.getFavicon=P.range=P.isBigNumber=P.ensureParsedJSONObject=P.ensureBigInt=P.ensureRegExpString=P.ensureIntNumber=P.ensureBuffer=P.ensureAddressString=P.ensureEvenLengthHexString=P.ensureHexString=P.isHexString=P.prepend0x=P.strip0x=P.has0xPrefix=P.hexStringFromIntNumber=P.intNumberFromHexString=P.bigIntStringFromBigInt=P.hexStringFromBuffer=P.hexStringToUint8Array=P.uint8ArrayToHex=P.randomBytesHex=void 0;const N=h,j=A,O=/^[0-9]*$/,D=/^[a-f0-9]*$/;function T(e){return[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function U(e){return e.startsWith("0x")||e.startsWith("0X")}function W(e){return U(e)?e.slice(2):e}function B(e){return U(e)?`0x${e.slice(2)}`:`0x${e}`}function H(e){if("string"!=typeof e)return!1;const t=W(e).toLowerCase();return D.test(t)}function q(e,t=!1){if("string"==typeof e){const n=W(e).toLowerCase();if(D.test(n))return(0,j.HexString)(t?`0x${n}`:n)}throw N.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}function F(e,t=!1){let n=q(e,!1);return n.length%2==1&&(n=(0,j.HexString)(`0${n}`)),t?(0,j.HexString)(`0x${n}`):n}function V(e){if("number"==typeof e&&Number.isInteger(e))return(0,j.IntNumber)(e);if("string"==typeof e){if(O.test(e))return(0,j.IntNumber)(Number(e));if(H(e))return(0,j.IntNumber)(Number(BigInt(F(e,!0))))}throw N.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}function K(e){if(null==e||"function"!=typeof e.constructor)return!1;const{constructor:t}=e;return"function"==typeof t.config&&"number"==typeof t.EUCLID}P.randomBytesHex=function(e){return T(crypto.getRandomValues(new Uint8Array(e)))},P.uint8ArrayToHex=T,P.hexStringToUint8Array=function(e){return new Uint8Array(e.match(/.{1,2}/g).map((e=>parseInt(e,16))))},P.hexStringFromBuffer=function(e,t=!1){const n=e.toString("hex");return(0,j.HexString)(t?`0x${n}`:n)},P.bigIntStringFromBigInt=function(e){return(0,j.BigIntString)(e.toString(10))},P.intNumberFromHexString=function(e){return(0,j.IntNumber)(Number(BigInt(F(e,!0))))},P.hexStringFromIntNumber=function(e){return(0,j.HexString)(`0x${BigInt(e).toString(16)}`)},P.has0xPrefix=U,P.strip0x=W,P.prepend0x=B,P.isHexString=H,P.ensureHexString=q,P.ensureEvenLengthHexString=F,P.ensureAddressString=function(e){if("string"==typeof e){const t=W(e).toLowerCase();if(H(t)&&40===t.length)return(0,j.AddressString)(B(t))}throw N.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)},P.ensureBuffer=function(e){if(Buffer.isBuffer(e))return e;if("string"==typeof e){if(H(e)){const t=F(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw N.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)},P.ensureIntNumber=V,P.ensureRegExpString=function(e){if(e instanceof RegExp)return(0,j.RegExpString)(e.toString());throw N.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)},P.ensureBigInt=function(e){if(null!==e&&("bigint"==typeof e||K(e)))return BigInt(e.toString(10));if("number"==typeof e)return BigInt(V(e));if("string"==typeof e){if(O.test(e))return BigInt(e);if(H(e))return BigInt(F(e,!0))}throw N.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)},P.ensureParsedJSONObject=function(e){if("string"==typeof e)return JSON.parse(e);if("object"==typeof e)return e;throw N.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)},P.isBigNumber=K,P.range=function(e,t){return Array.from({length:t-e},((t,n)=>e+n))},P.getFavicon=function(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:n}=document.location,r=e?e.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?t+r:`${t}//${n}${r}`},P.areAddressArraysEqual=function(e,t){return e.length===t.length&&e.every(((e,n)=>e===t[n]))};var z={},Z={},$={},G={};Object.defineProperty(G,"__esModule",{value:!0}),G.decryptContent=G.encryptContent=G.importKeyFromHexString=G.exportKeyToHexString=G.decrypt=G.encrypt=G.deriveSharedSecret=G.generateKeyPair=void 0;const Y=P;async function J(e,t){const n=crypto.getRandomValues(new Uint8Array(12));return{iv:n,cipherText:await crypto.subtle.encrypt({name:"AES-GCM",iv:n},e,(new TextEncoder).encode(t))}}async function Q(e,{iv:t,cipherText:n}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:t},e,n);return(new TextDecoder).decode(r)}function X(e){switch(e){case"public":return"spki";case"private":return"pkcs8"}}G.generateKeyPair=async function(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])},G.deriveSharedSecret=async function(e,t){return crypto.subtle.deriveKey({name:"ECDH",public:t},e,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])},G.encrypt=J,G.decrypt=Q,G.exportKeyToHexString=async function(e,t){const n=X(e),r=await crypto.subtle.exportKey(n,t);return(0,Y.uint8ArrayToHex)(new Uint8Array(r))},G.importKeyFromHexString=async function(e,t){const n=X(e),r=(0,Y.hexStringToUint8Array)(t).buffer;return await crypto.subtle.importKey(n,r,{name:"ECDH",namedCurve:"P-256"},!0,"private"===e?["deriveKey"]:[])},G.encryptContent=async function(e,t){return J(t,JSON.stringify(e,((e,t)=>{if(!(t instanceof Error))return t;const n=t;return Object.assign(Object.assign({},n.code?{code:n.code}:{}),{message:n.message})})))},G.decryptContent=async function(e,t){return JSON.parse(await Q(t,e))};var ee={};Object.defineProperty(ee,"__esModule",{value:!0}),ee.ScopedLocalStorage=void 0;class te{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let n=0;nlocalStorage.removeItem(e)))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new te("CBWSDK").clear(),new te("walletlink").clear()}}ee.ScopedLocalStorage=te,Object.defineProperty($,"__esModule",{value:!0}),$.SCWKeyManager=void 0;const ne=G,re=ee,se={storageKey:"ownPrivateKey",keyType:"private"},ie={storageKey:"ownPublicKey",keyType:"public"},ae={storageKey:"peerPublicKey",keyType:"public"};$.SCWKeyManager=class{constructor(){this.storage=new re.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey(ae,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(ie.storageKey),this.storage.removeItem(se.storageKey),this.storage.removeItem(ae.storageKey)}async generateKeyPair(){const e=await(0,ne.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(se,e.privateKey),await this.storeKey(ie,e.publicKey)}async loadKeysIfNeeded(){if(null===this.ownPrivateKey&&(this.ownPrivateKey=await this.loadKey(se)),null===this.ownPublicKey&&(this.ownPublicKey=await this.loadKey(ie)),null!==this.ownPrivateKey&&null!==this.ownPublicKey||await this.generateKeyPair(),null===this.peerPublicKey&&(this.peerPublicKey=await this.loadKey(ae)),null===this.sharedSecret){if(null===this.ownPrivateKey||null===this.peerPublicKey)return;this.sharedSecret=await(0,ne.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,ne.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const n=await(0,ne.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}};var oe={};Object.defineProperty(oe,"__esModule",{value:!0}),oe.SCWStateManager=void 0;const ce=ee,de="accounts",le="activeChain",ue="availableChains",he="walletCapabilities";oe.SCWStateManager=class{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new ce.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(ue),this._walletCapabilities=this.loadItemFromStorage(he);const r=this.loadItemFromStorage(de),s=this.loadItemFromStorage(le);r&&this.updateListener.onAccountsUpdate({accounts:r,source:"storage"}),s&&this.updateListener.onChainUpdate({chain:s,source:"storage"}),this._accounts=r||[],this._activeChain=s||{id:null!==(n=null===(t=e.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(de,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=null===(t=this.availableChains)||void 0===t?void 0:t.find((t=>t.id===e));return!!n&&(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(le,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0)}updateAvailableChains(e){if(!e||0===Object.keys(e).length)return;const t=Object.entries(e).map((([e,t])=>({id:Number(e),rpcUrl:t})));this.availableChains=t,this.storeItemToStorage(ue,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(he,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}},Object.defineProperty(Z,"__esModule",{value:!0}),Z.SCWSigner=void 0;const pe=$,ge=oe,fe=h,_e=P,me=G;Z.SCWSigner=class{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new pe.SCWKeyManager,this.stateManager=new ge.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,me.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);const r=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},r);const s=r.result;if("error"in s)throw s.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(void 0!==t){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const n=await this.sendEncryptedRequest(e),r=await this.decryptResponseMessage(n);this.updateInternalState(e,r);const s=r.result;if("error"in s)throw s.error;return s.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const n=e.params;if(!n||!(null===(t=n[0])||void 0===t?void 0:t.chainId))throw fe.standardErrors.rpc.invalidParams();const r=(0,_e.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(r)?null:void 0}case"wallet_getCapabilities":{const e=this.stateManager.walletCapabilities;if(!e)throw fe.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return e}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw fe.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await(0,me.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),r=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(r)}async createRequestMessage(e){const t=await(0,me.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const n=await this.keyManager.getSharedSecret();if(!n)throw fe.standardErrors.provider.unauthorized("Invalid session");return(0,me.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,r;const s=null===(n=t.data)||void 0===n?void 0:n.chains;s&&this.stateManager.updateAvailableChains(s);const i=null===(r=t.data)||void 0===r?void 0:r.capabilities;i&&this.stateManager.updateWalletCapabilities(i);const a=t.result;if(!("error"in a))switch(e.method){case"eth_requestAccounts":{const e=a.value;this.stateManager.updateAccounts(e);break}case"wallet_switchEthereumChain":{if(null!==a.value)return;const t=e.params,n=(0,_e.ensureIntNumber)(t[0].chainId);this.stateManager.switchChain(n);break}}}};var ye={};const be=r;function ve(e){return Buffer.allocUnsafe(e).fill(0)}function we(e,t){let n=e.toString(16);n.length%2!=0&&(n="0"+n);const r=n.match(/.{1,2}/g).map((e=>parseInt(e,16)));for(;r.lengthn)throw new Error("Elements exceed array size: "+n);for(i in s=[],e=e.slice(0,e.lastIndexOf("[")),"string"==typeof t&&(t=JSON.parse(t)),t)s.push(Ne(e,t[i]));if("dynamic"===n){var a=Ne("uint256",t.length);s.unshift(a)}return Buffer.concat(s)}if("bytes"===e)return t=new Buffer(t),s=Buffer.concat([Ne("uint256",t.length),t]),t.length%32!=0&&(s=Buffer.concat([s,Me.zeros(32-t.length%32)])),s;if(e.startsWith("bytes")){if((n=Le(e))<1||n>32)throw new Error("Invalid bytes width: "+n);return Me.setLengthRight(t,32)}if(e.startsWith("uint")){if((n=Le(e))%8||n<8||n>256)throw new Error("Invalid uint width: "+n);r=Pe(t);const s=Me.bitLengthFromBigInt(r);if(s>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+s);if(r<0)throw new Error("Supplied uint is negative");return Me.bufferBEFromBigInt(r,32)}if(e.startsWith("int")){if((n=Le(e))%8||n<8||n>256)throw new Error("Invalid int width: "+n);r=Pe(t);const s=Me.bitLengthFromBigInt(r);if(s>n)throw new Error("Supplied int exceeds width: "+n+" vs "+s);const i=Me.twosFromBigInt(r,256);return Me.bufferBEFromBigInt(i,32)}if(e.startsWith("ufixed")){if(n=Ae(e),(r=Pe(t))<0)throw new Error("Supplied ufixed is negative");return Ne("uint256",r*BigInt(2)**BigInt(n[1]))}if(e.startsWith("fixed"))return n=Ae(e),Ne("int256",Pe(t)*BigInt(2)**BigInt(n[1]));throw new Error("Unsupported or invalid type: "+e)}function je(e){return"string"===e||"bytes"===e||"dynamic"===Re(e)}function Oe(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var n,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+n);s.push(Me.setLengthRight(o,n))}else if(a.startsWith("uint")){if((n=Le(a))%8||n<8||n>256)throw new Error("Invalid uint width: "+n);r=Pe(o);const e=Me.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+e);s.push(Me.bufferBEFromBigInt(r,n/8))}else{if(!a.startsWith("int"))throw new Error("Unsupported or invalid type: "+a);{if((n=Le(a))%8||n<8||n>256)throw new Error("Invalid int width: "+n);r=Pe(o);const e=Me.bitLengthFromBigInt(r);if(e>n)throw new Error("Supplied int exceeds width: "+n+" vs "+e);const t=Me.twosFromBigInt(r,n);s.push(Me.bufferBEFromBigInt(t,n/8))}}}return Buffer.concat(s)}const De=Ie,Te={rawEncode:function(e,t){var n=[],r=[],s=32*e.length;for(var i in e){var a=xe(e[i]),o=Ne(a,t[i]);je(a)?(n.push(Ne("uint256",s)),r.push(o),s+=o.length):n.push(o)}return Buffer.concat(n.concat(r))},solidityPack:Oe,soliditySHA3:function(e,t){return Me.keccak(Oe(e,t))}},Ue={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"]},We={encodeData(e,t,n,r=!0){const s=["bytes32"],i=[this.hashType(e,n)];if(r){const a=(e,t,s)=>{if(void 0!==n[t])return["bytes32",null==s?"0x0000000000000000000000000000000000000000000000000000000000000000":De.keccak(this.encodeData(t,s,n,r))];if(void 0===s)throw new Error(`missing value for field ${e} of type ${t}`);if("bytes"===t)return["bytes32",De.keccak(s)];if("string"===t)return"string"==typeof s&&(s=Buffer.from(s,"utf8")),["bytes32",De.keccak(s)];if(t.lastIndexOf("]")===t.length-1){const n=t.slice(0,t.lastIndexOf("[")),r=s.map((t=>a(e,n,t)));return["bytes32",De.keccak(Te.rawEncode(r.map((([e])=>e)),r.map((([,e])=>e))))]}return[t,s]};for(const r of n[e]){const[e,n]=a(r.name,r.type,t[r.name]);s.push(e),i.push(n)}}else for(const a of n[e]){let e=t[a.name];if(void 0!==e)if("bytes"===a.type)s.push("bytes32"),e=De.keccak(e),i.push(e);else if("string"===a.type)s.push("bytes32"),"string"==typeof e&&(e=Buffer.from(e,"utf8")),e=De.keccak(e),i.push(e);else if(void 0!==n[a.type])s.push("bytes32"),e=De.keccak(this.encodeData(a.type,e,n,r)),i.push(e);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(e)}}return Te.rawEncode(s,i)},encodeType(e,t){let n="",r=this.findTypeDependencies(e,t).filter((t=>t!==e));r=[e].concat(r.sort());for(const s of r){if(!t[s])throw new Error("No type definition specified: "+s);n+=s+"("+t[s].map((({name:e,type:t})=>t+" "+e)).join(",")+")"}return n},findTypeDependencies(e,t,n=[]){if(e=e.match(/^\w*/)[0],n.includes(e)||void 0===t[e])return n;n.push(e);for(const r of t[e])for(const e of this.findTypeDependencies(r.type,t,n))!n.includes(e)&&n.push(e);return n},hashStruct(e,t,n,r=!0){return De.keccak(this.encodeData(e,t,n,r))},hashType(e,t){return De.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const n in Ue.properties)e[n]&&(t[n]=e[n]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const n=this.sanitizeData(e),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",n.domain,n.types,t)),"EIP712Domain"!==n.primaryType&&r.push(this.hashStruct(n.primaryType,n.message,n.types,t)),De.keccak(Buffer.concat(r))}};var Be={TYPED_MESSAGE_SCHEMA:Ue,TypedDataUtils:We,hashForSignTypedDataLegacy:function(e){return function(e){const t=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!e.length)throw t;const n=e.map((function(e){return"bytes"===e.type?De.toBuffer(e.value):e.value})),r=e.map((function(e){return e.type})),s=e.map((function(e){if(!e.name)throw t;return e.type+" "+e.name}));return Te.soliditySHA3(["bytes32","bytes32"],[Te.soliditySHA3(new Array(e.length).fill("string"),s),Te.soliditySHA3(r,n)])}(e.data)},hashForSignTypedData_v3:function(e){return We.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return We.hash(e.data)}};var He={};Object.defineProperty(He,"__esModule",{value:!0}),He.APP_VERSION_KEY=He.LOCAL_STORAGE_ADDRESSES_KEY=He.WALLET_USER_NAME_KEY=void 0,He.WALLET_USER_NAME_KEY="walletUsername",He.LOCAL_STORAGE_ADDRESSES_KEY="Addresses",He.APP_VERSION_KEY="AppVersion";var qe={};Object.defineProperty(qe,"__esModule",{value:!0}),qe.RelayEventManager=void 0;const Fe=P;qe.RelayEventManager=class{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,Fe.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}};var Ve={},Ke={},ze={};Object.defineProperty(ze,"__esModule",{value:!0}),ze.WalletLinkCipher=void 0;const Ze=P;ze.WalletLinkCipher=class{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.importKey("raw",(0,Ze.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,i=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},r,s.encode(e)),a=i.slice(i.byteLength-16),o=i.slice(0,i.byteLength-16),c=new Uint8Array(a),d=new Uint8Array(o),l=new Uint8Array([...n,...c,...d]);return(0,Ze.uint8ArrayToHex)(l)}async decrypt(e){const t=this.secret;if(64!==t.length)throw Error("secret must be 256 bits");return new Promise(((n,r)=>{!async function(){const s=await crypto.subtle.importKey("raw",(0,Ze.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=(0,Ze.hexStringToUint8Array)(e),a=i.slice(0,12),o=i.slice(12,28),c=i.slice(28),d=new Uint8Array([...c,...o]),l={name:"AES-GCM",iv:new Uint8Array(a)};try{const e=await window.crypto.subtle.decrypt(l,s,d),t=new TextDecoder;n(t.decode(e))}catch(u){r(u)}}()}))}};var $e={};Object.defineProperty($e,"__esModule",{value:!0}),$e.WalletLinkHTTP=void 0;$e.WalletLinkHTTP=class{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const r=`${t}:${n}`;this.auth=`Basic ${btoa(r)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map((e=>fetch(`${this.linkAPIUrl}/events/${e.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}})))).catch((e=>console.error("Unabled to mark event as failed:",e)))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:n,error:r}=await t.json();if(r)throw new Error(`Check unseen events failed: ${r}`);const s=null!==(e=null==n?void 0:n.filter((e=>"Web3Response"===e.event)).map((e=>({type:"Event",sessionId:this.sessionId,eventId:e.id,event:e.event,data:e.data}))))&&void 0!==e?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${t.status}`)}};var Ge,Ye,Je={};Object.defineProperty(Je,"__esModule",{value:!0}),Je.WalletLinkWebSocket=Je.ConnectionState=void 0,(Ye=Ge||(Je.ConnectionState=Ge={}))[Ye.DISCONNECTED=0]="DISCONNECTED",Ye[Ye.CONNECTING=1]="CONNECTING",Ye[Ye.CONNECTED=2]="CONNECTED";Je.WalletLinkWebSocket=class{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise(((e,t)=>{var n;let r;try{this.webSocket=r=new this.WebSocketClass(this.url)}catch(s){return void t(s)}null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.CONNECTING),r.onclose=e=>{var n;this.clearWebSocket(),t(new Error(`websocket error ${e.code}: ${e.reason}`)),null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.DISCONNECTED)},r.onopen=t=>{var n;if(e(),null===(n=this.connectionStateListener)||void 0===n||n.call(this,Ge.CONNECTED),this.pendingData.length>0){[...this.pendingData].forEach((e=>this.sendData(e))),this.pendingData=[]}},r.onmessage=e=>{var t,n;if("h"===e.data)null===(t=this.incomingDataListener)||void 0===t||t.call(this,{type:"Heartbeat"});else try{const t=JSON.parse(e.data);null===(n=this.incomingDataListener)||void 0===n||n.call(this,t)}catch(r){}}}))}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),null===(e=this.connectionStateListener)||void 0===e||e.call(this,Ge.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch(n){}}}sendData(e){const{webSocket:t}=this;if(!t)return this.pendingData.push(e),void this.connect();t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}},Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.WalletLinkConnection=void 0;const Qe=He,Xe=ze,et=$e,tt=Je,nt=A;Ke.WalletLinkConnection=class{constructor({session:e,linkAPIUrl:t,listener:n,WebSocketClass:r=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,nt.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=e=>{if(!e)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",t=>e.JsonRpcUrl&&this.handleChainUpdated(t,e.JsonRpcUrl)]]).forEach(((t,n)=>{const r=e[n];void 0!==r&&t(r)}))},this.handleDestroyed=e=>{var t;"1"===e&&(null===(t=this.listener)||void 0===t||t.resetAndReload())},this.handleAccountUpdated=async e=>{var t;{const n=await this.cipher.decrypt(e);null===(t=this.listener)||void 0===t||t.accountUpdated(n)}},this.handleMetadataUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.metadataUpdated(e,r)}},this.handleWalletUsernameUpdated=async e=>{this.handleMetadataUpdated(Qe.WALLET_USER_NAME_KEY,e)},this.handleAppVersionUpdated=async e=>{this.handleMetadataUpdated(Qe.APP_VERSION_KEY,e)},this.handleChainUpdated=async(e,t)=>{var n;{const r=await this.cipher.decrypt(e),s=await this.cipher.decrypt(t);null===(n=this.listener)||void 0===n||n.chainUpdated(r,s)}},this.session=e,this.cipher=new Xe.WalletLinkCipher(e.secret),this.listener=n;const s=new tt.WalletLinkWebSocket(`${t}/rpc`,r);s.setConnectionStateListener((async e=>{let t=!1;switch(e){case tt.ConnectionState.DISCONNECTED:if(!this.destroyed){const e=async()=>{await new Promise((e=>setTimeout(e,5e3))),this.destroyed||s.connect().catch((()=>{e()}))};e()}break;case tt.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),t=!0}catch(n){}this.updateLastHeartbeat(),setInterval((()=>{this.heartbeat()}),1e4),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();case tt.ConnectionState.CONNECTING:}this.connected!==t&&(this.connected=t)})),s.setIncomingDataListener((e=>{var t;switch(e.type){case"Heartbeat":return void this.updateLastHeartbeat();case"IsLinkedOK":case"Linked":{const t="IsLinkedOK"===e.type?e.linked:void 0;this.linked=t||e.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":this.handleSessionMetadataUpdated(e.metadata);break;case"Event":this.handleIncomingEvent(e)}void 0!==e.id&&(null===(t=this.requestResolutions.get(e.id))||void 0===t||t(e))})),this.ws=s,this.http=new et.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&(null===(t=this.onceConnected)||void 0===t||t.call(this))}setOnceConnected(e){return new Promise((t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}}))}get linked(){return this._linked}set linked(e){var t,n;this._linked=e,e&&(null===(t=this.onceLinked)||void 0===t||t.call(this)),null===(n=this.listener)||void 0===n||n.linkedUpdated(e)}setOnceLinked(e){return new Promise((t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}}))}async handleIncomingEvent(e){var t;if("Event"===e.type&&"Web3Response"===e.event){const n=await this.cipher.decrypt(e.data),r=JSON.parse(n);if("WEB3_RESPONSE"!==r.type)return;null===(t=this.listener)||void 0===t||t.handleWeb3ResponseMessage(r)}}async checkUnseenEvents(){if(this.connected){await new Promise((e=>setTimeout(e,250)));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}else this.shouldFetchUnseenEventsOnConnect=!0}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1;(await this.http.fetchUnseenEvents()).forEach((e=>this.handleIncomingEvent(e)))}async setSessionMetadata(e,t){const n={type:"SetSessionConfig",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected((async()=>{const e=await this.makeRequest(n);if("Fail"===e.type)throw new Error(e.error||"failed to set session metadata")}))}async publishEvent(e,t,n=!1){const r=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:r,callWebhook:n};return this.setOnceLinked((async()=>{const e=await this.makeRequest(s);if("Fail"===e.type)throw new Error(e.error||"failed to publish event");return e.eventId}))}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>2e4)this.ws.disconnect();else try{this.ws.sendData("h")}catch(e){}}async makeRequest(e,t=6e4){const n=e.id;let r;return this.sendData(e),Promise.race([new Promise(((e,s)=>{r=window.setTimeout((()=>{s(new Error(`request ${n} timed out`))}),t)})),new Promise((e=>{this.requestResolutions.set(n,(t=>{clearTimeout(r),e(t),this.requestResolutions.delete(n)}))}))])}async authenticate(){const e={type:"HostSession",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if("Fail"===t.type)throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,nt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}};var rt={};Object.defineProperty(rt,"__esModule",{value:!0}),rt.WalletLinkSession=void 0;const st=s,it=P,at="session:id",ot="session:secret",ct="session:linked";class dt{constructor(e,t,n,r){this._storage=e,this._id=t||(0,it.randomBytesHex)(16),this._secret=n||(0,it.randomBytesHex)(32),this._key=(new st.sha256).update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!r}static load(e){const t=e.getItem(at),n=e.getItem(ct),r=e.getItem(ot);return t&&r?new dt(e,t,r,"1"===n):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(at,this._id),this._storage.setItem(ot,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(ct,this._linked?"1":"0")}}rt.WalletLinkSession=dt;var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.isDarkMode=lt.isMobileWeb=lt.getLocation=lt.createQrUrl=void 0,lt.createQrUrl=function(e,t,n,r,s,i){const a=r?"parent-id":"id";return`${n}/#/link?${new URLSearchParams({[a]:e,secret:t,server:n,v:s,chainId:i.toString()}).toString()}`},lt.getLocation=function(){try{return function(){try{return null!==window.frameElement}catch(e){return!1}}()&&window.top?window.top.location:window.location}catch(e){return window.location}},lt.isMobileWeb=function(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(null===(e=null===window||void 0===window?void 0:window.navigator)||void 0===e?void 0:e.userAgent)},lt.isDarkMode=function(){var e,t;return null!==(t=null===(e=null===window||void 0===window?void 0:window.matchMedia)||void 0===e?void 0:e.call(window,"(prefers-color-scheme: dark)").matches)&&void 0!==t&&t};var ut={},ht={},pt={};Object.defineProperty(pt,"__esModule",{value:!0}),pt.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 gt=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.injectCssReset=void 0;const ft=gt(pt);ht.injectCssReset=function(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(ft.default)),document.documentElement.appendChild(e)};var _t,mt,yt,bt,vt,wt,Et,St,Ct,kt,It,Mt,xt={},Lt={},At=[],Rt=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Pt=Array.isArray;function Nt(e,t){for(var n in t)e[n]=t[n];return e}function jt(e){var t=e.parentNode;t&&t.removeChild(e)}function Ot(e,t,n){var r,s,i,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?s=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?_t.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return Dt(e,a,r,s,null)}function Dt(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==s?++yt:s,__i:-1,__u:0};return null==s&&null!=mt.vnode&&mt.vnode(i),i}function Tt(e){return e.children}function Ut(e,t){this.props=e,this.context=t}function Wt(e,t){if(null==t)return e.__?Wt(e.__,e.__i+1):null;for(var n;tt&&vt.sort(St));qt.__r=0}function Ft(e,t,n,r,s,i,a,o,c,d,l){var u,h,p,g,f,_=r&&r.__k||At,m=t.length;for(n.__d=c,function(e,t,n){var r,s,i,a,o,c=t.length,d=n.length,l=d,u=0;for(e.__k=[],r=0;r0?Dt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)?(s.__=e,s.__b=e.__b+1,o=Kt(s,n,a,l),s.__i=o,i=null,-1!==o&&(l--,(i=n[o])&&(i.__u|=131072)),null==i||null===i.__v?(-1==o&&u--,"function"!=typeof s.type&&(s.__u|=65536)):o!==a&&(o===a+1?u++:o>a?l>c-a?u+=o-a:u--:o(null==c||131072&c.__u?0:1))for(;a>=0||o=0){if((c=t[a])&&!(131072&c.__u)&&s==c.key&&i===c.type)return a;a--}if(o2&&(o.children=arguments.length>3?_t.call(arguments,2):n),Dt(e.type,o,r||e.key,s||e.ref,null)},createContext:function(e,t){var n={__c:t="__cC"+Mt++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,Ht(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n},createElement:Ot,createRef:function(){return{current:null}},h:Ot,hydrate:function e(t,n){en(t,n,e)},get isValidElement(){return bt},get options(){return mt},render:en,toChildArray:function e(t,n){return n=n||[],null==t||"boolean"==typeof t||(Pt(t)?t.some((function(t){e(t,n)})):n.push(t)),n}},Symbol.toStringTag,{value:"Module"})),nn=t(tn);var rn,sn,an,on,cn=0,dn=[],ln=[],un=mt,hn=un.__b,pn=un.__r,gn=un.diffed,fn=un.__c,_n=un.unmount,mn=un.__;function yn(e,t){un.__h&&un.__h(sn,e,cn||t),cn=0;var n=sn.__H||(sn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:ln}),n.__[e]}function bn(e){return cn=1,vn(Ln,e)}function vn(e,t,n){var r=yn(rn++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ln(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=sn,!sn.u)){var s=function(e,t,n){if(!r.__c.__H)return!0;var s=r.__c.__H.__.filter((function(e){return!!e.__c}));if(s.every((function(e){return!e.__N})))return!i||i.call(this,e,t,n);var a=!1;return s.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(a=!0)}})),!(!a&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};sn.u=!0;var i=sn.shouldComponentUpdate,a=sn.componentWillUpdate;sn.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,s(e,t,n),i=r}a&&a.call(this,e,t,n)},sn.shouldComponentUpdate=s}return r.__N||r.__}function wn(e,t){var n=yn(rn++,4);!un.__s&&xn(n.__H,t)&&(n.__=e,n.i=t,sn.__h.push(n))}function En(e,t){var n=yn(rn++,7);return xn(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Sn(){for(var e;e=dn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(In),e.__H.__h.forEach(Mn),e.__H.__h=[]}catch(t){e.__H.__h=[],un.__e(t,e.__v)}}un.__b=function(e){sn=null,hn&&hn(e)},un.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),mn&&mn(e,t)},un.__r=function(e){pn&&pn(e),rn=0;var t=(sn=e.__c).__H;t&&(an===sn?(t.__h=[],sn.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=ln,e.__N=e.i=void 0}))):(t.__h.forEach(In),t.__h.forEach(Mn),t.__h=[],rn=0)),an=sn},un.diffed=function(e){gn&&gn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==dn.push(t)&&on===un.requestAnimationFrame||((on=un.requestAnimationFrame)||kn)(Sn)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==ln&&(e.__=e.__V),e.i=void 0,e.__V=ln}))),an=sn=null},un.__c=function(e,t){t.some((function(e){try{e.__h.forEach(In),e.__h=e.__h.filter((function(e){return!e.__||Mn(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],un.__e(n,e.__v)}})),fn&&fn(e,t)},un.unmount=function(e){_n&&_n(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{In(e)}catch(n){t=n}})),n.__H=void 0,t&&un.__e(t,n.__v))};var Cn="function"==typeof requestAnimationFrame;function kn(e){var t,n=function(){clearTimeout(r),Cn&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Cn&&(t=requestAnimationFrame(n))}function In(e){var t=sn,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),sn=t}function Mn(e){var t=sn;e.__c=e.__(),sn=t}function xn(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function Ln(e,t){return"function"==typeof t?t(e):t}const An=t(Object.freeze(Object.defineProperty({__proto__:null,useCallback:function(e,t){return cn=8,En((function(){return e}),t)},useContext:function(e){var t=sn.context[e.__c],n=yn(rn++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(sn)),t.props.value):e.__},useDebugValue:function(e,t){un.useDebugValue&&un.useDebugValue(t?t(e):e)},useEffect:function(e,t){var n=yn(rn++,3);!un.__s&&xn(n.__H,t)&&(n.__=e,n.i=t,sn.__H.__h.push(n))},useErrorBoundary:function(e){var t=yn(rn++,10),n=bn();return t.__=e,sn.componentDidCatch||(sn.componentDidCatch=function(e,r){t.__&&t.__(e,r),n[1](e)}),[n[0],function(){n[1](void 0)}]},useId:function(){var e=yn(rn++,11);if(!e.__){for(var t=sn.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__},useImperativeHandle:function(e,t,n){cn=6,wn((function(){return"function"==typeof e?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0}),null==n?n:n.concat(e))},useLayoutEffect:wn,useMemo:En,useReducer:vn,useRef:function(e){return cn=5,En((function(){return{current:e}}),[])},useState:bn},Symbol.toStringTag,{value:"Module"})));var Rn={};Object.defineProperty(Rn,"__esModule",{value:!0}),Rn.default=(()=>".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}")(),function(t){var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=n(i),s=nn,a=An,o=lt,c=n(Rn);t.Snackbar=class{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,o.isDarkMode)()}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",e.appendChild(this.root),this.render()}presentItem(e){const t=this.nextItemKey++;return this.items.set(t,e),this.render(),()=>{this.items.delete(t),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,s.render)((0,s.h)("div",null,(0,s.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map((([e,n])=>(0,s.h)(t.SnackbarInstance,Object.assign({},n,{key:e})))))),this.root)}};t.SnackbarContainer=e=>(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,s.h)("style",null,c.default),(0,s.h)("div",{class:"-cbwsdk-snackbar"},e.children));t.SnackbarInstance=({autoExpand:e,message:t,menuItems:n})=>{const[i,o]=(0,a.useState)(!0),[c,d]=(0,a.useState)(null!=e&&e);(0,a.useEffect)((()=>{const e=[window.setTimeout((()=>{o(!1)}),1),window.setTimeout((()=>{d(!0)}),1e4)];return()=>{e.forEach(window.clearTimeout)}}));return(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",i&&"-cbwsdk-snackbar-instance-hidden",c&&"-cbwsdk-snackbar-instance-expanded")},(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:()=>{d(!c)}},(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},t),(0,s.h)("div",{class:"-gear-container"},!c&&(0,s.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,s.h)("img",{src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=",class:"-gear-icon",title:"Expand"}))),n&&n.length>0&&(0,s.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},n.map(((e,t)=>(0,s.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:e.onClick,key:t},(0,s.h)("svg",{width:e.svgWidth,height:e.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.h)("path",{"fill-rule":e.defaultFillRule,"clip-rule":e.defaultClipRule,d:e.path,fill:"#AAAAAA"})),(0,s.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",e.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},e.info))))))}}(xt),Object.defineProperty(ut,"__esModule",{value:!0}),ut.WalletLinkRelayUI=void 0;const Pn=ht,Nn=xt;ut.WalletLinkRelayUI=class{constructor(){this.attached=!1,this.snackbar=new Nn.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,Pn.injectCssReset)()}showConnecting(e){let t;return t=e.isUnlinkedErrorState?{autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:{message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}};var jn={},On={},Dn={};Object.defineProperty(Dn,"__esModule",{value:!0}),Dn.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 Tn=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(On,"__esModule",{value:!0}),On.RedirectDialog=void 0;const Un=Tn(i),Wn=nn,Bn=ht,Hn=xt,qn=lt,Fn=Tn(Dn);On.RedirectDialog=class{constructor(){this.root=null,this.darkMode=(0,qn.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Bn.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Wn.render)(null,this.root),e&&(0,Wn.render)((0,Wn.h)(Vn,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}};const Vn=({title:e,buttonText:t,darkMode:n,onButtonClick:r,onDismiss:s})=>{const i=n?"dark":"light";return(0,Wn.h)(Hn.SnackbarContainer,{darkMode:n},(0,Wn.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Wn.h)("style",null,Fn.default),(0,Wn.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Wn.h)("div",{class:(0,Un.default)("-cbwsdk-redirect-dialog-box",i)},(0,Wn.h)("p",null,e),(0,Wn.h)("button",{onClick:r},t))))};var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.CBW_MOBILE_DEEPLINK_URL=Kn.WALLETLINK_URL=Kn.CB_KEYS_URL=void 0,Kn.CB_KEYS_URL="https://keys.coinbase.com/connect",Kn.WALLETLINK_URL="https://www.walletlink.org",Kn.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink",Object.defineProperty(jn,"__esModule",{value:!0}),jn.WLMobileRelayUI=void 0;const zn=On,Zn=lt,$n=Kn;jn.WLMobileRelayUI=class{constructor(){this.attached=!1,this.redirectDialog=new zn.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL($n.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Zn.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout((()=>{this.redirectToCoinbaseWallet(e)}),99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}},Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.WalletLinkRelay=void 0;const Gn=Ke,Yn=He,Jn=qe,Qn=rt,Xn=C,er=lt,tr=ut,nr=jn,rr=h,sr=P,ir=ee;class ar{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,er.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=e=>{this.isLinked=e;const t=this.storage.getItem(Yn.LOCAL_STORAGE_ADDRESSES_KEY);if(e&&(this._session.linked=e),this.isUnlinkedErrorState=!1,t){const n=t.split(" "),r="true"===this.storage.getItem("IsStandaloneSigning");""===n[0]||e||!this._session.linked||r||(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(e,t)=>{this.storage.setItem(e,t)},this.chainUpdated=(e,t)=>{this.chainCallbackParams.chainId===e&&this.chainCallbackParams.jsonRpcUrl===t||(this.chainCallbackParams={chainId:e,jsonRpcUrl:t},this.chainCallback&&this.chainCallback(e,t))},this.accountUpdated=e=>{this.accountsCallback&&this.accountsCallback([e]),ar.accountRequestCallbackIds.size>0&&(Array.from(ar.accountRequestCallbackIds.values()).forEach((t=>{const n={type:"WEB3_RESPONSE",id:t,response:{method:"requestEthereumAccounts",result:[e]}};this.invokeCallback(Object.assign(Object.assign({},n),{id:t}))})),ar.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:n,connection:r}=this.subscribe();this._session=t,this.connection=r,this.relayEventManager=new Jn.RelayEventManager,this.ui=n}subscribe(){const e=Qn.WalletLinkSession.load(this.storage)||new Qn.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Gn.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),r=this.isMobileWeb?new nr.WLMobileRelayUI:new tr.WalletLinkRelayUI;return n.connect(),{session:e,ui:r,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise((e=>setTimeout((()=>e(null)),1e3)))]).then((()=>{this.connection.destroy();const e=Qn.WalletLinkSession.load(this.storage);(null==e?void 0:e.id)===this._session.id&&ir.ScopedLocalStorage.clearAll(),document.location.reload()})).catch((e=>{}))}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,r){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,sr.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:r||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,sr.hexStringFromBuffer)(e,!0),signature:(0,sr.hexStringFromBuffer)(t,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,sr.bigIntStringFromBigInt)(e.weiValue),data:(0,sr.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,sr.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,sr.bigIntStringFromBigInt)(e.weiValue),data:(0,sr.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,sr.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,sr.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,sr.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,sr.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,sr.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const n=(0,sr.randomBytesHex)(8),r=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),null==t||t()};return new Promise(((s,i)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:r,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,(e=>{if(null==t||t(),(0,Xn.isErrorResponse)(e))return i(new Error(e.errorMessage));s(e)})),this.publishWeb3RequestEvent(n,e)}))}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then((e=>{})).catch((e=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.id,response:{method:t.method,errorMessage:e.message}})})),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof nr.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",(()=>{window.addEventListener("focus",(()=>{this.connection.checkUnseenEvents()}),{once:!0})}),{once:!0}),this.ui.openCoinbaseWalletDeeplink()}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if("requestEthereumAccounts"===t.method)return ar.accountRequestCallbackIds.forEach((t=>this.invokeCallback(Object.assign(Object.assign({},e),{id:t})))),void ar.accountRequestCallbackIds.clear();this.invokeCallback(e)}handleErrorResponse(e,t,n){var r;const s=null!==(r=null==n?void 0:n.message)&&void 0!==r?r:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:s}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,sr.randomBytesHex)(8);return new Promise(((n,r)=>{this.relayEventManager.callbacks.set(t,(e=>{if((0,Xn.isErrorResponse)(e))return r(new Error(e.errorMessage));n(e)})),ar.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)}))}watchAsset(e,t,n,r,s,i){const a={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,decimals:r,image:s},chainId:i}};let o=null;const c=(0,sr.randomBytesHex)(8),d=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Xn.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}addEthereumChain(e,t,n,r,s,i){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:r,chainName:s,iconUrls:n,nativeCurrency:i}};let o=null;const c=(0,sr.randomBytesHex)(8),d=e=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,e),null==o||o()};return o=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:d,onResetConnection:this.resetAndReload}),new Promise(((e,t)=>{this.relayEventManager.callbacks.set(c,(n=>{if(null==o||o(),(0,Xn.isErrorResponse)(n))return t(new Error(n.errorMessage));e(n)})),this.publishWeb3RequestEvent(c,a)}))}switchEthereumChain(e,t){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},r=(0,sr.randomBytesHex)(8);return new Promise(((e,t)=>{this.relayEventManager.callbacks.set(r,(n=>(0,Xn.isErrorResponse)(n)&&n.errorCode?t(rr.standardErrors.provider.custom({code:n.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."})):(0,Xn.isErrorResponse)(n)?t(new Error(n.errorMessage)):void e(n))),this.publishWeb3RequestEvent(r,n)}))}}Ve.WalletLinkRelay=ar,ar.accountRequestCallbackIds=new Set;var or=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.WalletLinkSigner=void 0;const cr=or(Be),dr=He,lr=qe,ur=C,hr=Ve,pr=Kn,gr=h,fr=P,_r=ee,mr="DefaultChainId",yr="DefaultJsonRpcUrl";ye.WalletLinkSigner=class{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:r,appLogoUrl:s}=e.metadata;this._appName=r,this._appLogoUrl=s,this._storage=new _r.ScopedLocalStorage("walletlink",pr.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new lr.RelayEventManager,this._jsonRpcUrlFromOpts="";const i=this._storage.getItem(dr.LOCAL_STORAGE_ADDRESSES_KEY);if(i){const e=i.split(" ");""!==e[0]&&(this._addresses=e.map((e=>(0,fr.ensureAddressString)(e))),null===(t=this.updateListener)||void 0===t||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(mr)&&(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return null!==(e=this._storage.getItem(yr))&&void 0!==e?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(yr,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const r=this.getChainId();this._storage.setItem(mr,t.toString(10));!((0,fr.ensureIntNumber)(t)!==r)&&this.hasMadeFirstChainChangedEmission||(null===(n=this.updateListener)||void 0===n||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,r,s,i){const a=this.initializeRelay(),o=await a.watchAsset(e,t,n,r,s,null==i?void 0:i.toString());return!(0,ur.isErrorResponse)(o)&&!!o.result}async addEthereumChain(e,t,n,r,s,i){var a,o;if((0,fr.ensureIntNumber)(e)===this.getChainId())return!1;const c=this.initializeRelay();this._isAuthorized()||await c.requestEthereumAccounts();const d=await c.addEthereumChain(e.toString(),t,s,n,r,i);return!(0,ur.isErrorResponse)(d)&&(!0===(null===(a=d.result)||void 0===a?void 0:a.isApproved)&&this.updateProviderInfo(t[0],e),!0===(null===(o=d.result)||void 0===o?void 0:o.isApproved))}async switchEthereumChain(e){const t=this.initializeRelay(),n=await t.switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,ur.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===gr.standardErrorCodes.provider.unsupportedChain?gr.standardErrors.provider.unsupportedChain():gr.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const r=n.result;r.isApproved&&r.rpcUrl.length>0&&this.updateProviderInfo(r.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch((e=>{throw e}))}catch(t){return Promise.reject(t)}}async _request(e){if(!e||"object"!=typeof e||Array.isArray(e))throw gr.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;if("string"!=typeof t||0===t.length)throw gr.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw gr.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const r=void 0===n?[]:n,s=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:r,jsonrpc:"2.0",id:s})).result}_setAddresses(e,t){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const r=e.map((e=>(0,fr.ensureAddressString)(e)));JSON.stringify(r)!==JSON.stringify(this._addresses)&&(this._addresses=r,null===(n=this.updateListener)||void 0===n||n.onAccountsUpdate({accounts:r,source:"wallet"}),this._storage.setItem(dr.LOCAL_STORAGE_ADDRESSES_KEY,r.join(" ")))}_sendRequestAsync(e){return new Promise(((t,n)=>{try{const n=this._handleSynchronousMethods(e);if(void 0!==n)return t({jsonrpc:"2.0",id:e.id,result:n})}catch(r){return n(r)}this._handleAsynchronousMethods(e).then((n=>n&&t(Object.assign(Object.assign({},n),{id:e.id})))).catch((e=>n(e)))}))}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,n=e.params||[];switch(t){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":default: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"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}}_isKnownAddress(e){try{const t=(0,fr.ensureAddressString)(e);return this._addresses.map((e=>(0,fr.ensureAddressString)(e))).includes(t)}catch(t){}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,fr.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);return{fromAddress:t,toAddress:e.to?(0,fr.ensureAddressString)(e.to):null,weiValue:null!=e.value?(0,fr.ensureBigInt)(e.value):BigInt(0),data:e.data?(0,fr.ensureBuffer)(e.data):Buffer.alloc(0),nonce:null!=e.nonce?(0,fr.ensureIntNumber)(e.nonce):null,gasPriceInWei:null!=e.gasPrice?(0,fr.ensureBigInt)(e.gasPrice):null,maxFeePerGas:null!=e.maxFeePerGas?(0,fr.ensureBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:null!=e.maxPriorityFeePerGas?(0,fr.ensureBigInt)(e.maxPriorityFeePerGas):null,gasLimit:null!=e.gas?(0,fr.ensureBigInt)(e.gas):null,chainId:e.chainId?(0,fr.ensureIntNumber)(e.chainId):this.getChainId()}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw gr.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw gr.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,n,r){this._ensureKnownAddress(t);try{const s=this.initializeRelay(),i=await s.signEthereumMessage(e,t,n,r);if((0,ur.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(s){if("string"==typeof s.message&&s.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied message signature");throw s}}async _ethereumAddressFromSignedMessage(e,t,n){const r=this.initializeRelay(),s=await r.ethereumAddressFromSignedMessage(e,t,n);if((0,ur.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,fr.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(mr);if(!e)return(0,fr.ensureIntNumber)(1);const t=parseInt(e,10);return(0,fr.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{const t=this.initializeRelay();if(e=await t.requestEthereumAccounts(),(0,ur.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){if("string"==typeof t.message&&t.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied account authorization");throw t}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,fr.ensureBuffer)(e[0]),n=(0,fr.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signEthereumTransaction(t);if((0,ur.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(n){if("string"==typeof n.message&&n.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw n}}async _eth_sendRawTransaction(e){const t=(0,fr.ensureBuffer)(e[0]),n=this.initializeRelay(),r=await n.submitEthereumTransaction(t,this.getChainId());if((0,ur.isErrorResponse)(r))throw new Error(r.errorMessage);return{jsonrpc:"2.0",id:0,result:r.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const e=this.initializeRelay(),n=await e.signAndSubmitEthereumTransaction(t);if((0,ur.isErrorResponse)(n))throw new Error(n.errorMessage);return{jsonrpc:"2.0",id:0,result:n.result}}catch(n){if("string"==typeof n.message&&n.message.match(/(denied|rejected)/i))throw gr.standardErrors.provider.userRejectedRequest("User denied transaction signature");throw n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,fr.ensureParsedJSONObject)(e[0]),n=(0,fr.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const r=cr.default.hashForSignTypedDataLegacy({data:t}),s=JSON.stringify(t,null,2);return this._signEthereumMessage(r,n,!1,s)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=cr.default.hashForSignTypedData_v3({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,s)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,fr.ensureAddressString)(e[0]),n=(0,fr.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const r=cr.default.hashForSignTypedData_v4({data:n}),s=JSON.stringify(n,null,2);return this._signEthereumMessage(r,t,!1,s)}async _wallet_addEthereumChain(e){var t,n,r,s;const i=e[0];if(0===(null===(t=i.rpcUrls)||void 0===t?void 0:t.length))return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!i.chainName||""===i.chainName.trim())throw gr.standardErrors.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw gr.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(i.chainId,16);return await this.addEthereumChain(a,null!==(n=i.rpcUrls)&&void 0!==n?n:[],null!==(r=i.blockExplorerUrls)&&void 0!==r?r:[],i.chainName,null!==(s=i.iconUrls)&&void 0!==s?s:[],i.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw gr.standardErrors.rpc.invalidParams("Type is required");if("ERC20"!==(null==t?void 0:t.type))throw gr.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(null==t?void 0:t.options))throw gr.standardErrors.rpc.invalidParams("Options are required");if(!(null==t?void 0:t.options.address))throw gr.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:r,symbol:s,image:i,decimals:a}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,r,s,a,i,n)}}initializeRelay(){if(!this._relay){const e=new hr.WalletLinkRelay({linkAPIUrl:pr.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback(((e,t)=>this._setAddresses(e,t))),e.setChainCallback(((e,t)=>{this.updateProviderInfo(t,parseInt(e,10))})),this._relay=e}return this._relay}};var br={};Object.defineProperty(br,"__esModule",{value:!0}),br.checkErrorForInvalidRequestArgs=br.getCoinbaseInjectedProvider=br.getCoinbaseInjectedSigner=br.fetchRPCRequest=void 0;const vr=k,wr=h;function Er(){return globalThis.coinbaseWalletSigner}br.fetchRPCRequest=async function(e,t){if(!t.rpcUrl)throw wr.standardErrors.rpc.internal("No RPC URL set for chain");const n=Object.assign(Object.assign({},e),{jsonrpc:"2.0",id:crypto.randomUUID()}),r=await window.fetch(t.rpcUrl,{method:"POST",body:JSON.stringify(n),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":vr.LIB_VERSION}});return(await r.json()).result},br.getCoinbaseInjectedSigner=Er,br.getCoinbaseInjectedProvider=function({metadata:e,preference:t}){var n,r,s;const i=globalThis;if("smartWalletOnly"!==t.options){if(Er())return;const t=i.coinbaseWalletExtension;if(t){const{appName:r,appLogoUrl:s,appChainIds:i}=e;return null===(n=t.setAppInfo)||void 0===n||n.call(t,r,s,i),t}}const a=null!==(r=i.ethereum)&&void 0!==r?r:null===(s=i.top)||void 0===s?void 0:s.ethereum;if(null==a?void 0:a.isCoinbaseBrowser)return a},br.checkErrorForInvalidRequestArgs=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return wr.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:n}=e;return"string"!=typeof t||0===t.length?wr.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:e}):void 0===n||Array.isArray(n)||"object"==typeof n&&null!==n?void 0:wr.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:e})},Object.defineProperty(z,"__esModule",{value:!0}),z.createSigner=z.fetchSignerType=z.storeSignerType=z.loadSignerType=void 0;const Sr=Z,Cr=ye,kr=h,Ir=br,Mr="SignerType",xr=new ee.ScopedLocalStorage("CBWSDK","SignerConfigurator");z.loadSignerType=function(){return xr.getItem(Mr)},z.storeSignerType=function(e){xr.setItem(Mr,e)},z.fetchSignerType=async function(e){const{communicator:t,metadata:n}=e;(async function(e,t){await e.onMessage((({event:e})=>"WalletLinkSessionRequest"===e));const n=new Cr.WalletLinkSigner({metadata:t});e.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),e.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})})(t,n).catch((()=>{}));const r={id:crypto.randomUUID(),event:"selectSignerType",data:e.preference},{data:s}=await t.postRequestAndWaitForResponse(r);return s},z.createSigner=function(e){const{signerType:t,metadata:n,communicator:r,updateListener:s}=e;switch(t){case"scw":return new Sr.SCWSigner({metadata:n,updateListener:s,communicator:r});case"walletlink":return new Cr.WalletLinkSigner({metadata:n,updateListener:s});case"extension":{const e=(0,Ir.getCoinbaseInjectedSigner)();if(!e)throw kr.standardErrors.rpc.internal("injected signer not found");return e}}};var Lr={},Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.closePopup=Ar.openPopup=void 0;const Rr=h;Ar.openPopup=function(e){const t=(window.innerWidth-420)/2+window.screenX,n=(window.innerHeight-540)/2+window.screenY,r=window.open(e,"Smart Wallet",`width=420, height=540, left=${t}, top=${n}`);if(null==r||r.focus(),!r)throw Rr.standardErrors.rpc.internal("Pop up window failed to open");return r},Ar.closePopup=function(e){e&&!e.closed&&e.close()},Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Communicator=void 0;const Pr=k,Nr=Ar,jr=Kn,Or=h;Lr.Communicator=class{constructor(e=jr.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async e=>{(await this.waitForPopupLoaded()).postMessage(e,this.url.origin)},this.postRequestAndWaitForResponse=async e=>{const t=this.onMessage((({requestId:t})=>t===e.id));return this.postMessage(e),await t},this.onMessage=async e=>new Promise(((t,n)=>{const r=n=>{if(n.origin!==this.url.origin)return;const s=n.data;e(s)&&(t(s),window.removeEventListener("message",r),this.listeners.delete(r))};window.addEventListener("message",r),this.listeners.set(r,{reject:n})})),this.disconnect=()=>{(0,Nr.closePopup)(this.popup),this.popup=null,this.listeners.forEach((({reject:e},t)=>{e(Or.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",t)})),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,Nr.openPopup)(this.url),this.onMessage((({event:e})=>"PopupUnload"===e)).then(this.disconnect).catch((()=>{})),this.onMessage((({event:e})=>"PopupLoaded"===e)).then((e=>{this.postMessage({requestId:e.id,data:{version:Pr.LIB_VERSION}})})).then((()=>{if(!this.popup)throw Or.standardErrors.rpc.internal();return this.popup}))),this.url=new URL(e)}};var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.determineMethodCategory=void 0;const Tr={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};Dr.determineMethodCategory=function(e){for(const t in Tr){const n=t;if(Tr[n].includes(e))return n}};var Ur=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s{try{if(this.connected)return this.emit("connect",{chainId:(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id))}),this.accounts;const e=await this.requestSignerSelection(),t=this.initSigner(e),n=await t.handshake();return this.signer=t,(0,Kr.storeSignerType)(e),this.emit("connect",{chainId:(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id))}),n}catch(t){throw this.handleUnauthorizedError(t),t}},sign:async e=>{if(!this.connected||!this.signer)throw Hr.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(e)}catch(t){throw this.handleUnauthorizedError(t),t}},fetch:e=>(0,zr.fetchRPCRequest)(e,this.chain),state:e=>{const t=()=>{if(this.connected)return this.accounts;throw Hr.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(e.method){case"eth_chainId":return(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return t();case"eth_coinbase":return t()[0];default:return this.handlers.unsupported(e)}},deprecated:({method:e})=>{throw Hr.standardErrors.rpc.methodNotSupported(`Method ${e} is deprecated.`)},unsupported:({method:e})=>{throw Hr.standardErrors.rpc.methodNotSupported(`Method ${e} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:e,source:t})=>{(0,Vr.areAddressArraysEqual)(this.accounts,e)||(this.accounts=e,"storage"!==t&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:e,source:t})=>{e.id===this.chain.id&&e.rpcUrl===this.chain.rpcUrl||(this.chain=e,"storage"!==t&&this.emit("chainChanged",(0,Vr.hexStringFromIntNumber)((0,Fr.IntNumber)(e.id))))}},this.metadata=r,this.preference=a,this.communicator=new Zr.Communicator(i),this.chain={id:null!==(n=null===(t=r.appChainIds)||void 0===t?void 0:t[0])&&void 0!==n?n:1};const o=(0,Kr.loadSignerType)();this.signer=o?this.initSigner(o):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const n=(0,zr.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const r=null!==(t=(0,$r.determineMethodCategory)(e.method))&&void 0!==t?t:"fetch";return this.handlers[r](e)}catch(n){return Promise.reject((0,qr.serializeError)(n,e.method))}}handleUnauthorizedError(e){e.code===Hr.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},Gr.ScopedLocalStorage.clearAll(),this.emit("disconnect",Hr.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,Kr.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,Kr.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}d.CoinbaseWalletProvider=Yr,Object.defineProperty(o,"__esModule",{value:!0}),o.CoinbaseWalletSDK=void 0;const Jr=c,Qr=d,Xr=ee,es=k,ts=P,ns=br;o.CoinbaseWalletSDK=class{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,ts.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const n={metadata:this.metadata,preference:e};return null!==(t=(0,ns.getCoinbaseInjectedProvider)(n))&&void 0!==t?t:new Qr.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,Jr.walletLogo)(e,t)}storeLatestVersion(){new Xr.ScopedLocalStorage("CBWSDK").setItem("VERSION",es.LIB_VERSION)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CoinbaseWalletSDK=void 0;const t=o;e.default=t.CoinbaseWalletSDK;var n=o;Object.defineProperty(e,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}})}(a);const rs=n(a),ss=Object.freeze(Object.defineProperty({__proto__:null,default:rs},Symbol.toStringTag,{value:"Module"}));export{ss as i}; diff --git a/kinode/src/register-ui/build/assets/index-C3h8FZ1j.js b/kinode/src/register-ui/build/assets/index-Dm7MnfGv.js similarity index 99% rename from kinode/src/register-ui/build/assets/index-C3h8FZ1j.js rename to kinode/src/register-ui/build/assets/index-Dm7MnfGv.js index 51e882d86..987daae77 100644 --- a/kinode/src/register-ui/build/assets/index-C3h8FZ1j.js +++ b/kinode/src/register-ui/build/assets/index-Dm7MnfGv.js @@ -1,4 +1,4 @@ -const __vite__fileDeps=["assets/index-gj1MhC63.js","assets/___vite-browser-external_commonjs-proxy-CQs3Tny8.js","assets/clsx.m-BnvdjbFk.js","assets/index-DRmNTW-M.js","assets/index.es-DLVXSpXp.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +const __vite__fileDeps=["assets/index-BQNtOdwk.js","assets/___vite-browser-external_commonjs-proxy-B7j9NnZI.js","assets/clsx.m-DBHroLNK.js","assets/index-BiTIzhEC.js","assets/index.es-2cj2DIKP.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); var e,t,n,r,o,a,u,i,s,l,c,d,f,h,p,m,g,y,b,v,w,A,C,E,B,F,D,x,k,j,I,S,P,U,O,N,T,M,R,_,z,L,W,q,Q,H,V,$,G,K,J,Y,Z,X,ee,te,ne,re,oe,ae,ue,ie,se,le,ce,de,fe,he,pe,me,ge,ye,be=e=>{throw TypeError(e)},ve=(e,t,n)=>t.has(e)||be("Cannot "+n),we=(e,t,n)=>(ve(e,t,"read from private field"),n?n.call(e):t.get(e)),Ae=(e,t,n)=>t.has(e)?be("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ce=(e,t,n,r)=>(ve(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),Ee=(e,t,n)=>(ve(e,t,"access private method"),n),Be=(e,t,n,r)=>({set _(r){Ce(e,t,r,n)},get _(){return we(e,t,r)}});function Fe(e,t){for(var n=0;nr[t]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var De="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function xe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ke(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}var je={exports:{}},Ie={},Se={exports:{}},Pe={},Ue=Symbol.for("react.element"),Oe=Symbol.for("react.portal"),Ne=Symbol.for("react.fragment"),Te=Symbol.for("react.strict_mode"),Me=Symbol.for("react.profiler"),Re=Symbol.for("react.provider"),_e=Symbol.for("react.context"),ze=Symbol.for("react.forward_ref"),Le=Symbol.for("react.suspense"),We=Symbol.for("react.memo"),qe=Symbol.for("react.lazy"),Qe=Symbol.iterator;var He={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ve=Object.assign,$e={};function Ge(e,t,n){this.props=e,this.context=t,this.refs=$e,this.updater=n||He}function Ke(){}function Je(e,t,n){this.props=e,this.context=t,this.refs=$e,this.updater=n||He}Ge.prototype.isReactComponent={},Ge.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},Ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},Ke.prototype=Ge.prototype;var Ye=Je.prototype=new Ke;Ye.constructor=Je,Ve(Ye,Ge.prototype),Ye.isPureReactComponent=!0;var Ze=Array.isArray,Xe=Object.prototype.hasOwnProperty,et={current:null},tt={key:!0,ref:!0,__self:!0,__source:!0};function nt(e,t,n){var r,o={},a=null,u=null;if(null!=t)for(r in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(a=""+t.key),t)Xe.call(t,r)&&!tt.hasOwnProperty(r)&&(o[r]=t[r]);var i=arguments.length-2;if(1===i)o.children=n;else if(1{}));const qh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch(UM){}const Qh=pt.startTransition;function Hh(e){let{basename:t,children:n,future:r,window:o}=e,a=ft.useRef();null==a.current&&(a.current=Rf({window:o,v5Compat:!0}));let u=a.current,[i,s]=ft.useState({action:u.action,location:u.location}),{v7_startTransition:l}=r||{},c=ft.useCallback((e=>{l&&Qh?Qh((()=>s(e))):s(e)}),[s,l]);return ft.useLayoutEffect((()=>u.listen(c)),[u,c]),ft.createElement(_h,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:u,future:r})}const Vh="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,$h=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gh=ft.forwardRef((function(e,t){let n,{onClick:r,relative:o,reloadDocument:a,replace:u,state:i,target:s,to:l,preventScrollReset:c,unstable_viewTransition:d}=e,f=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,qh),{basename:h}=ft.useContext(wh),p=!1;if("string"==typeof l&&$h.test(l)&&(n=l,Vh))try{let e=new URL(window.location.href),t=l.startsWith("//")?new URL(e.protocol+l):new URL(l),n=ih(t.pathname,h);t.origin===e.origin&&null!=n?l=n+t.search+t.hash:p=!0}catch(UM){}let m=function(e,t){let{relative:n}=void 0===t?{}:t;Bh()||_f(!1);let{basename:r,navigator:o}=ft.useContext(wh),{hash:a,pathname:u,search:i}=kh(e,{relative:n}),s=u;return"/"!==r&&(s="/"===u?r:dh([r,u])),o.createHref({pathname:s,search:i,hash:a})}(l,{relative:o}),g=function(e,t){let{target:n,replace:r,state:o,preventScrollReset:a,relative:u,unstable_viewTransition:i}=void 0===t?{}:t,s=xh(),l=Fh(),c=kh(e,{relative:u});return ft.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==r?r:qf(l)===qf(c);s(e,{replace:n,state:o,preventScrollReset:a,relative:u,unstable_viewTransition:i})}}),[l,s,c,r,o,n,e,a,u,i])}(l,{replace:u,state:i,target:s,preventScrollReset:c,relative:o,unstable_viewTransition:d});return ft.createElement("a",Wh({},f,{href:n||m,onClick:p||a?r:function(e){r&&r(e),e.defaultPrevented||g(e)},ref:t,target:s}))}));var Kh,Jh,Yh,Zh;(Jh=Kh||(Kh={})).UseScrollRestoration="useScrollRestoration",Jh.UseSubmit="useSubmit",Jh.UseSubmitFetcher="useSubmitFetcher",Jh.UseFetcher="useFetcher",Jh.useViewTransitionState="useViewTransitionState",(Zh=Yh||(Yh={})).UseFetcher="useFetcher",Zh.UseFetchers="useFetchers",Zh.UseScrollRestoration="useScrollRestoration";const Xh={},ep=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),n=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));r=Promise.all(t.map((e=>{if((e=function(e){return"/"+e}(e))in Xh)return;Xh[e]=!0;const t=e.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${r}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script",o.crossOrigin=""),o.href=e,n&&o.setAttribute("nonce",n),document.head.appendChild(o),t?new Promise(((t,n)=>{o.addEventListener("load",t),o.addEventListener("error",(()=>n(new Error(`Unable to preload CSS for ${e}`))))})):void 0})))}return r.then((()=>e())).catch((e=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}))};var tp='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',np={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${tp}`,system:tp},rp={large:{actionButton:"9999px",connectButton:"12px",modal:"24px",modalMobile:"28px"},medium:{actionButton:"10px",connectButton:"8px",modal:"16px",modalMobile:"18px"},none:{actionButton:"0px",connectButton:"0px",modal:"0px",modalMobile:"0px"},small:{actionButton:"4px",connectButton:"4px",modal:"8px",modalMobile:"8px"}},op={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},ap=({borderRadius:e="large",fontStack:t="rounded",overlayBlur:n="none"})=>({blurs:{modalOverlay:op[n].modalOverlay},fonts:{body:np[t]},radii:{actionButton:rp[e].actionButton,connectButton:rp[e].connectButton,menuButton:rp[e].connectButton,modal:rp[e].modal,modalMobile:rp[e].modalMobile}}),up={blue:{accentColor:"#0E76FD",accentColorForeground:"#FFF"},green:{accentColor:"#1DB847",accentColorForeground:"#FFF"},orange:{accentColor:"#FF801F",accentColorForeground:"#FFF"},pink:{accentColor:"#FF5CA0",accentColorForeground:"#FFF"},purple:{accentColor:"#5F5AFA",accentColorForeground:"#FFF"},red:{accentColor:"#FA423C",accentColorForeground:"#FFF"}},ip=up.blue,sp=({accentColor:e=ip.accentColor,accentColorForeground:t=ip.accentColorForeground,...n}={})=>({...ap(n),colors:{accentColor:e,accentColorForeground:t,actionButtonBorder:"rgba(0, 0, 0, 0.04)",actionButtonBorderMobile:"rgba(0, 0, 0, 0.06)",actionButtonSecondaryBackground:"rgba(0, 0, 0, 0.06)",closeButton:"rgba(60, 66, 66, 0.8)",closeButtonBackground:"rgba(0, 0, 0, 0.06)",connectButtonBackground:"#FFF",connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06))",connectButtonText:"#25292E",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(255, 255, 255, 0) 9.49%, rgba(171, 171, 171, 0.04) 71.04%), #FFFFFF",downloadTopCardBackground:"linear-gradient(126deg, rgba(171, 171, 171, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%), #FFFFFF",error:"#FF494A",generalBorder:"rgba(0, 0, 0, 0.06)",generalBorderDim:"rgba(0, 0, 0, 0.03)",menuItemBackground:"rgba(60, 66, 66, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.3)",modalBackground:"#FFF",modalBorder:"transparent",modalText:"#25292E",modalTextDim:"rgba(60, 66, 66, 0.3)",modalTextSecondary:"rgba(60, 66, 66, 0.6)",profileAction:"#FFF",profileActionHover:"rgba(255, 255, 255, 0.5)",profileForeground:"rgba(60, 66, 66, 0.06)",selectedOptionBorder:"rgba(60, 66, 66, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.12)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});sp.accentColors=up;var lp='{\n "connect_wallet": {\n "label": "Connect Wallet",\n "wrong_network": {\n "label": "Wrong network"\n }\n },\n\n "intro": {\n "title": "What is a Wallet?",\n "description": "A wallet is used to send, receive, store, and display digital assets. It\'s also a new way to log in, without needing to create new accounts and passwords on every website.",\n "digital_asset": {\n "title": "A Home for your Digital Assets",\n "description": "Wallets are used to send, receive, store, and display digital assets like Ethereum and NFTs."\n },\n "login": {\n "title": "A New Way to Log In",\n "description": "Instead of creating new accounts and passwords on every website, just connect your wallet."\n },\n "get": {\n "label": "Get a Wallet"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n\n "sign_in": {\n "label": "Verify your account",\n "description": "To finish connecting, you must sign a message in your wallet to verify that you are the owner of this account.",\n "message": {\n "send": "Sign message",\n "preparing": "Preparing message...",\n "cancel": "Cancel",\n "preparing_error": "Error preparing message, please retry!"\n },\n "signature": {\n "waiting": "Waiting for signature...",\n "verifying": "Verifying signature...",\n "signing_error": "Error signing message, please retry!",\n "verifying_error": "Error verifying signature, please retry!",\n "oops_error": "Oops, something went wrong!"\n }\n },\n\n "connect": {\n "label": "Connect",\n "title": "Connect a Wallet",\n "new_to_ethereum": {\n "description": "New to Ethereum wallets?",\n "learn_more": {\n "label": "Learn More"\n }\n },\n "learn_more": {\n "label": "Learn more"\n },\n "recent": "Recent",\n "status": {\n "opening": "Opening %{wallet}...",\n "connecting": "Connecting",\n "connect_mobile": "Continue in %{wallet}",\n "not_installed": "%{wallet} is not installed",\n "not_available": "%{wallet} is not available",\n "confirm": "Confirm connection in the extension",\n "confirm_mobile": "Accept connection request in the wallet"\n },\n "secondary_action": {\n "get": {\n "description": "Don\'t have %{wallet}?",\n "label": "GET"\n },\n "install": {\n "label": "INSTALL"\n },\n "retry": {\n "label": "RETRY"\n }\n },\n "walletconnect": {\n "description": {\n "full": "Need the official WalletConnect modal?",\n "compact": "Need the WalletConnect modal?"\n },\n "open": {\n "label": "OPEN"\n }\n }\n },\n\n "connect_scan": {\n "title": "Scan with %{wallet}",\n "fallback_title": "Scan with your phone"\n },\n\n "connector_group": {\n "installed": "Installed",\n "recommended": "Recommended",\n "other": "Other",\n "popular": "Popular",\n "more": "More",\n "others": "Others"\n },\n\n "get": {\n "title": "Get a Wallet",\n "action": {\n "label": "GET"\n },\n "mobile": {\n "description": "Mobile Wallet"\n },\n "extension": {\n "description": "Browser Extension"\n },\n "mobile_and_extension": {\n "description": "Mobile Wallet and Extension"\n },\n "mobile_and_desktop": {\n "description": "Mobile and Desktop Wallet"\n },\n "looking_for": {\n "title": "Not what you\'re looking for?",\n "mobile": {\n "description": "Select a wallet on the main screen to get started with a different wallet provider."\n },\n "desktop": {\n "compact_description": "Select a wallet on the main screen to get started with a different wallet provider.",\n "wide_description": "Select a wallet on the left to get started with a different wallet provider."\n }\n }\n },\n\n "get_options": {\n "title": "Get started with %{wallet}",\n "short_title": "Get %{wallet}",\n "mobile": {\n "title": "%{wallet} for Mobile",\n "description": "Use the mobile wallet to explore the world of Ethereum.",\n "download": {\n "label": "Get the app"\n }\n },\n "extension": {\n "title": "%{wallet} for %{browser}",\n "description": "Access your wallet right from your favorite web browser.",\n "download": {\n "label": "Add to %{browser}"\n }\n },\n "desktop": {\n "title": "%{wallet} for %{platform}",\n "description": "Access your wallet natively from your powerful desktop.",\n "download": {\n "label": "Add to %{platform}"\n }\n }\n },\n\n "get_mobile": {\n "title": "Install %{wallet}",\n "description": "Scan with your phone to download on iOS or Android",\n "continue": {\n "label": "Continue"\n }\n },\n\n "get_instructions": {\n "mobile": {\n "connect": {\n "label": "Connect"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n "extension": {\n "refresh": {\n "label": "Refresh"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n "desktop": {\n "connect": {\n "label": "Connect"\n },\n "learn_more": {\n "label": "Learn More"\n }\n }\n },\n\n "chains": {\n "title": "Switch Networks",\n "wrong_network": "Wrong network detected, switch or disconnect to continue.",\n "confirm": "Confirm in Wallet",\n "switching_not_supported": "Your wallet does not support switching networks from %{appName}. Try switching networks from within your wallet instead.",\n "switching_not_supported_fallback": "Your wallet does not support switching networks from this app. Try switching networks from within your wallet instead.",\n "disconnect": "Disconnect",\n "connected": "Connected"\n },\n\n "profile": {\n "disconnect": {\n "label": "Disconnect"\n },\n "copy_address": {\n "label": "Copy Address",\n "copied": "Copied!"\n },\n "explorer": {\n "label": "View more on explorer"\n },\n "transactions": {\n "description": "%{appName} transactions will appear here...",\n "description_fallback": "Your transactions will appear here...",\n "recent": {\n "title": "Recent Transactions"\n },\n "clear": {\n "label": "Clear All"\n }\n }\n },\n\n "wallet_connectors": {\n "argent": {\n "qr_code": {\n "step1": {\n "description": "Put Argent on your home screen for faster access to your wallet.",\n "title": "Open the Argent app"\n },\n "step2": {\n "description": "Create a wallet and username, or import an existing wallet.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the Scan QR button"\n }\n }\n },\n\n "bifrost": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bifrost Wallet on your home screen for quicker access.",\n "title": "Open the Bifrost Wallet app"\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n }\n },\n\n "bitget": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bitget Wallet on your home screen for quicker access.",\n "title": "Open the Bitget Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Bitget Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Bitget Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "bitski": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Bitski to your taskbar for quicker access to your wallet.",\n "title": "Install the Bitski extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "bitverse": {\n "qr_code": {\n "step1": {\n "title": "Open the Bitverse Wallet app",\n "description": "Add Bitverse Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "bloom": {\n "desktop": {\n "step1": {\n "title": "Open the Bloom Wallet app",\n "description": "We recommend putting Bloom Wallet on your home screen for quicker access."\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you have a wallet, click on Connect to connect via Bloom. A connection prompt in the app will appear for you to confirm the connection.",\n "title": "Click on Connect"\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Bloom Wallet app",\n "description": "We recommend putting Bloom Wallet on your home screen for quicker access."\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you have a wallet, click on Connect to connect via Bloom. A connection prompt in the app will appear for you to confirm the connection.",\n "title": "Click on Connect"\n }\n }\n },\n\n "bybit": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bybit on your home screen for faster access to your wallet.",\n "title": "Open the Bybit app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "Click at the top right of your browser and pin Bybit Wallet for easy access.",\n "title": "Install the Bybit Wallet extension"\n },\n "step2": {\n "description": "Create a new wallet or import an existing one.",\n "title": "Create or Import a wallet"\n },\n "step3": {\n "description": "Once you set up Bybit Wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "coin98": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Coin98 Wallet on your home screen for faster access to your wallet.",\n "title": "Open the Coin98 Wallet app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the WalletConnect button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "Click at the top right of your browser and pin Coin98 Wallet for easy access.",\n "title": "Install the Coin98 Wallet extension"\n },\n "step2": {\n "description": "Create a new wallet or import an existing one.",\n "title": "Create or Import a wallet"\n },\n "step3": {\n "description": "Once you set up Coin98 Wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "coinbase": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Coinbase Wallet on your home screen for quicker access.",\n "title": "Open the Coinbase Wallet app"\n },\n "step2": {\n "description": "You can easily backup your wallet using the cloud backup feature.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Coinbase Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Coinbase Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "compass": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Compass Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Compass Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "core": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Core on your home screen for faster access to your wallet.",\n "title": "Open the Core app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the WalletConnect button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Core to your taskbar for quicker access to your wallet.",\n "title": "Install the Core extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "fox": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting FoxWallet on your home screen for quicker access.",\n "title": "Open the FoxWallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n }\n },\n\n "frontier": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Frontier Wallet on your home screen for quicker access.",\n "title": "Open the Frontier Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Frontier Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Frontier Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "im_token": {\n "qr_code": {\n "step1": {\n "title": "Open the imToken app",\n "description": "Put imToken app on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap Scanner Icon in top right corner",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "kaikas": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Kaikas to your taskbar for quicker access to your wallet.",\n "title": "Install the Kaikas extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Kaikas app",\n "description": "Put Kaikas app on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap Scanner Icon in top right corner",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "kraken": {\n "qr_code": {\n "step1": {\n "title": "Open the Kraken Wallet app",\n "description": "Add Kraken Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "kresus": {\n "qr_code": {\n "step1": {\n "title": "Open the Kresus Wallet app",\n "description": "Add Kresus Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "magicEden": {\n "extension": {\n "step1": {\n "title": "Install the Magic Eden extension",\n "description": "We recommend pinning Magic Eden to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "metamask": {\n "qr_code": {\n "step1": {\n "title": "Open the MetaMask app",\n "description": "We recommend putting MetaMask on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the MetaMask extension",\n "description": "We recommend pinning MetaMask to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "nestwallet": {\n "extension": {\n "step1": {\n "title": "Install the NestWallet extension",\n "description": "We recommend pinning NestWallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "okx": {\n "qr_code": {\n "step1": {\n "title": "Open the OKX Wallet app",\n "description": "We recommend putting OKX Wallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the OKX Wallet extension",\n "description": "We recommend pinning OKX Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "omni": {\n "qr_code": {\n "step1": {\n "title": "Open the Omni app",\n "description": "Add Omni to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your home screen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "1inch": {\n "qr_code": {\n "step1": {\n "description": "Put 1inch Wallet on your home screen for faster access to your wallet.",\n "title": "Open the 1inch Wallet app"\n },\n "step2": {\n "description": "Create a wallet and username, or import an existing wallet.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the Scan QR button"\n }\n }\n },\n\n "token_pocket": {\n "qr_code": {\n "step1": {\n "title": "Open the TokenPocket app",\n "description": "We recommend putting TokenPocket on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the TokenPocket extension",\n "description": "We recommend pinning TokenPocket to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "trust": {\n "qr_code": {\n "step1": {\n "title": "Open the Trust Wallet app",\n "description": "Put Trust Wallet on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the Trust Wallet extension",\n "description": "Click at the top right of your browser and pin Trust Wallet for easy access."\n },\n "step2": {\n "title": "Create or Import a wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up Trust Wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "uniswap": {\n "qr_code": {\n "step1": {\n "title": "Open the Uniswap app",\n "description": "Add Uniswap Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "zerion": {\n "qr_code": {\n "step1": {\n "title": "Open the Zerion app",\n "description": "We recommend putting Zerion on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the Zerion extension",\n "description": "We recommend pinning Zerion to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "rainbow": {\n "qr_code": {\n "step1": {\n "title": "Open the Rainbow app",\n "description": "We recommend putting Rainbow on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "You can easily backup your wallet using our backup feature on your phone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "enkrypt": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Enkrypt Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Enkrypt Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "frame": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Frame to your taskbar for quicker access to your wallet.",\n "title": "Install Frame & the companion extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "one_key": {\n "extension": {\n "step1": {\n "title": "Install the OneKey Wallet extension",\n "description": "We recommend pinning OneKey Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "phantom": {\n "extension": {\n "step1": {\n "title": "Install the Phantom extension",\n "description": "We recommend pinning Phantom to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "rabby": {\n "extension": {\n "step1": {\n "title": "Install the Rabby extension",\n "description": "We recommend pinning Rabby to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "ronin": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Ronin Wallet on your home screen for quicker access.",\n "title": "Open the Ronin Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Ronin Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Ronin Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "ramper": {\n "extension": {\n "step1": {\n "title": "Install the Ramper extension",\n "description": "We recommend pinning Ramper to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "safeheron": {\n "extension": {\n "step1": {\n "title": "Install the Core extension",\n "description": "We recommend pinning Safeheron to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "taho": {\n "extension": {\n "step1": {\n "title": "Install the Taho extension",\n "description": "We recommend pinning Taho to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "talisman": {\n "extension": {\n "step1": {\n "title": "Install the Talisman extension",\n "description": "We recommend pinning Talisman to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import an Ethereum Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "xdefi": {\n "extension": {\n "step1": {\n "title": "Install the XDEFI Wallet extension",\n "description": "We recommend pinning XDEFI Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "zeal": {\n "extension": {\n "step1": {\n "title": "Install the Zeal extension",\n "description": "We recommend pinning Zeal to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "safepal": {\n "extension": {\n "step1": {\n "title": "Install the SafePal Wallet extension",\n "description": "Click at the top right of your browser and pin SafePal Wallet for easy access."\n },\n "step2": {\n "title": "Create or Import a wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up SafePal Wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the SafePal Wallet app",\n "description": "Put SafePal Wallet on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "desig": {\n "extension": {\n "step1": {\n "title": "Install the Desig extension",\n "description": "We recommend pinning Desig to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "subwallet": {\n "extension": {\n "step1": {\n "title": "Install the SubWallet extension",\n "description": "We recommend pinning SubWallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the SubWallet app",\n "description": "We recommend putting SubWallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "clv": {\n "extension": {\n "step1": {\n "title": "Install the CLV Wallet extension",\n "description": "We recommend pinning CLV Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the CLV Wallet app",\n "description": "We recommend putting CLV Wallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "okto": {\n "qr_code": {\n "step1": {\n "title": "Open the Okto app",\n "description": "Add Okto to your home screen for quick access"\n },\n "step2": {\n "title": "Create an MPC Wallet",\n "description": "Create an account and generate a wallet"\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Tap the Scan QR icon at the top right and confirm the prompt to connect."\n }\n }\n },\n\n "ledger": {\n "desktop": {\n "step1": {\n "title": "Open the Ledger Live app",\n "description": "We recommend putting Ledger Live on your home screen for quicker access."\n },\n "step2": {\n "title": "Set up your Ledger",\n "description": "Set up a new Ledger or connect to an existing one."\n },\n "step3": {\n "title": "Connect",\n "description": "A connection prompt will appear for you to connect your wallet."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Ledger Live app",\n "description": "We recommend putting Ledger Live on your home screen for quicker access."\n },\n "step2": {\n "title": "Set up your Ledger",\n "description": "You can either sync with the desktop app or connect your Ledger."\n },\n "step3": {\n "title": "Scan the code",\n "description": "Tap WalletConnect then Switch to Scanner. After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n }\n }\n}\n';var cp=function(e,t){return Object.defineProperty(e,"__recipe__",{value:t,writable:!1}),e};function dp(e){var{conditions:t}=e;if(!t)throw new Error("Styles have no conditions");return cp((function(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e){if(!t.defaultCondition)throw new Error("No default condition");return{[t.defaultCondition]:e}}if(Array.isArray(e)){if(!("responsiveArray"in t))throw new Error("Responsive arrays are not supported");var n={};for(var r in t.responsiveArray)null!=e[r]&&(n[t.responsiveArray[r]]=e[r]);return n}return e}),{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:e.conditions}]})}function fp(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function hp(e,t,n){return(t=fp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mp(e){for(var t=1;te;const yp=e=>e;let bp=class e extends Error{constructor(t,n={}){var r;super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@2.16.2"});const o=n.cause instanceof e?n.cause.details:(null==(r=n.cause)?void 0:r.message)?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${n.docsBaseUrl??"https://viem.sh"}${a}${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...o?[`Details: ${o}`]:[],`Version: ${this.version}`].join("\n"),n.cause&&(this.cause=n.cause),this.details=o,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(e){return vp(this,e)}};function vp(e,t){return(null==t?void 0:t(e))?e:e&&"object"==typeof e&&"cause"in e?vp(e.cause,t):t?null:e}class wp extends bp{constructor({max:e,min:t,signed:n,size:r,value:o}){super(`Number "${o}" is not in safe ${r?`${8*r}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class Ap extends bp{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}}class Cp extends bp{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}class Ep extends bp{constructor({offset:e,position:t,size:n}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class Bp extends bp{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}class Fp extends bp{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${t} ${n} long, but is ${e} ${n} long.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesLengthError"})}}function Dp(e,{dir:t,size:n=32}={}){return"string"==typeof e?xp(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new Bp({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o2*n)throw new Bp({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}function kp(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function jp(e){return kp(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Ip(e,{dir:t="left"}={}){let n="string"==typeof e?e.replace("0x",""):e,r=0;for(let o=0;o=Up.zero&&e<=Up.nine?e-Up.zero:e>=Up.A&&e<=Up.F?e-(Up.A-10):e>=Up.a&&e<=Up.f?e-(Up.a-10):void 0}function Np(e,t={}){let n=e;t.size&&(Mp(n,{size:t.size}),n=Dp(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,a=new Uint8Array(o);for(let u=0,i=0;ut)throw new Cp({givenSize:jp(e),maxSize:t})}function Rp(e,t={}){const{signed:n}=t;t.size&&Mp(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2;return r<=(1n<<8n*BigInt(o)-1n)-1n?r:r-BigInt(`0x${"f".padStart(2*o,"f")}`)-1n}function _p(e,t={}){return Number(Rp(e,t))}function zp(e,t={}){let n=Np(e);return t.size&&(Mp(n,{size:t.size}),n=Ip(n,{dir:"right"})),(new TextDecoder).decode(n)}const Lp=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Wp(e,t={}){return"number"==typeof e||"bigint"==typeof e?Hp(e,t):"string"==typeof e?$p(e,t):"boolean"==typeof e?qp(e,t):Qp(e,t)}function qp(e,t={}){const n=`0x${Number(e)}`;return"number"==typeof t.size?(Mp(n,{size:t.size}),Dp(n,{size:t.size})):n}function Qp(e,t={}){let n="";for(let o=0;oa||ofunction(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${Kp(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}class Jp extends bp{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class Yp extends bp{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Zp extends bp{constructor({data:e,params:t,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${Kp(t,{includeName:!0})})`,`Data: ${e} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=n}}class Xp extends bp{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class em extends bp{constructor({expectedLength:e,givenLength:t,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class tm extends bp{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${jp(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class nm extends bp{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class rm extends bp{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class om extends bp{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}}class am extends bp{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class um extends bp{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class im extends bp{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class sm extends bp{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class lm extends bp{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Gp(e.abiItem)}\`, and`,`\`${t.type}\` in \`${Gp(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class cm extends bp{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class dm extends bp{constructor({abiItem:e,data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${Kp(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=n,this.size=r}}class fm extends bp{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${Gp(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class hm extends bp{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class pm extends bp{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class mm extends bp{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class gm extends bp{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class ym extends bp{constructor(e){super(`Type "${e}" is not supported for packed encoding.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedPackedAbiType"})}}function bm(e){return"string"==typeof e[0]?vm(e):function(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}(e)}function vm(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class wm extends bp{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class Am extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}function Cm(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Em(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Bm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Fm(e,t){Em(e);const n=t.outputLen;if(e.length>xm&Dm)}:{h:0|Number(e>>xm&Dm),l:0|Number(e&Dm)}}function jm(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;oe instanceof Uint8Array,Pm=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Um=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Om(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!Sm(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class Nm{clone(){return this._cloneInto()}}function Tm(e){const t=t=>e().update(Om(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Mm(e=32){if(Im&&"function"==typeof Im.getRandomValues)return Im.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[Rm,_m,zm]=[[],[],[]],Lm=BigInt(0),Wm=BigInt(1),qm=BigInt(2),Qm=BigInt(7),Hm=BigInt(256),Vm=BigInt(113);for(let NM=0,TM=Wm,MM=1,RM=0;NM<24;NM++){[MM,RM]=[RM,(2*MM+3*RM)%5],Rm.push(2*(5*RM+MM)),_m.push((NM+1)*(NM+2)/2%64);let e=Lm;for(let t=0;t<7;t++)TM=(TM<>Qm)*Vm)%Hm,TM&qm&&(e^=Wm<<(Wm<n>32?((e,t,n)=>t<>>64-n)(e,t,n):((e,t,n)=>e<>>32-n)(e,t,n),Jm=(e,t,n)=>n>32?((e,t,n)=>e<>>64-n)(e,t,n):((e,t,n)=>t<>>32-n)(e,t,n);class Ym extends Nm{constructor(e,t,n,r=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Cm(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var a;this.state=new Uint8Array(200),this.state32=(a=this.state,new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4)))}keccak(){!function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,o=(r+2)%10,a=n[o],u=n[o+1],i=Km(a,u,1)^n[t],s=Jm(a,u,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=i,e[r+n+1]^=s}let t=e[2],o=e[3];for(let n=0;n<24;n++){const r=_m[n],a=Km(t,o,r),u=Jm(t,o,r),i=Rm[n];t=e[i],o=e[i+1],e[i]=a,e[i+1]=u}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=$m[r],e[1]^=Gm[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Bm(this);const{blockLen:t,state:n}=this,r=(e=Om(e)).length;for(let o=0;o=n&&this.keccak();const a=Math.min(n-this.posOut,o-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Cm(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Fm(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:o,enableXOF:a}=this;return e||(e=new Ym(t,n,r,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=r,e.enableXOF=a,e.destroyed=this.destroyed,e}}const Zm=((e,t,n)=>Tm((()=>new Ym(t,e,n))))(1,136,32);function Xm(e,t){const n=t||"hex",r=Zm(kp(e,{strict:!1})?Pp(e):e);return"bytes"===n?r:Wp(r)}const eg=new Am(8192);function tg(e,t){if(eg.has(`${e}.${t}`))return eg.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Xm(Tp(n),"bytes"),o=n.split("");for(let u=0;u<40;u+=2)r[u>>1]>>4>=8&&o[u]&&(o[u]=o[u].toUpperCase()),(15&r[u>>1])>=8&&o[u+1]&&(o[u+1]=o[u+1].toUpperCase());const a=`0x${o.join("")}`;return eg.set(`${e}.${t}`,a),a}function ng(e,t){if(!ag(e,{strict:!1}))throw new wm({address:e});return tg(e,t)}const rg=/^0x[a-fA-F0-9]{40}$/,og=new Am(8192);function ag(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(og.has(r))return og.get(r);const o=!(!rg.test(e)||e.toLowerCase()!==e&&n&&tg(e)!==e);return og.set(r,o),o}function ug(e,t,n,{strict:r}={}){return kp(e,{strict:!1})?cg(e,t,n,{strict:r}):lg(e,t,n,{strict:r})}function ig(e,t){if("number"==typeof t&&t>0&&t>jp(e)-1)throw new Ep({offset:t,position:"start",size:jp(e)})}function sg(e,t,n){if("number"==typeof t&&"number"==typeof n&&jp(e)!==n-t)throw new Ep({offset:n,position:"end",size:jp(e)})}function lg(e,t,n,{strict:r}={}){ig(e,t);const o=e.slice(t,n);return r&&sg(o,t,n),o}function cg(e,t,n,{strict:r}={}){ig(e,t);const o=`0x${e.replace("0x","").slice(2*(t??0),2*(n??e.length))}`;return r&&sg(o,t,n),o}function dg(e,t){if(e.length!==t.length)throw new nm({expectedLength:e.length,givenLength:t.length});const n=function({params:e,values:t}){const n=[];for(let r=0;r0?bm([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:bm(a.map((({encoded:e})=>e)))}}(t,{length:r,param:{...e,type:o}})}if("tuple"===e.type)return function(e,{param:t}){let n=!1;const r=[];for(let o=0;oe)))}}(t,{param:e});if("address"===e.type)return function(e){if(!ag(e))throw new wm({address:e});return{dynamic:!1,encoded:xp(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new bp(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xp(qp(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:Hp(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,n]=t.type.split("bytes"),r=jp(e);if(!n){let t=e;return r%32!=0&&(t=xp(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:bm([xp(Hp(r,{size:32})),t])}}if(r!==Number.parseInt(n))throw new tm({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:xp(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=$p(e),n=Math.ceil(jp(t)/32),r=[];for(let o=0;o"type"in e&&"constructor"===e.type));if(!o)throw new Jp({docsPath:mg});if(!("inputs"in o))throw new Yp({docsPath:mg});if(!o.inputs||0===o.inputs.length)throw new Yp({docsPath:mg});return vm([r,dg(o.inputs,n)])}function yg(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}class bg extends bp{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class vg extends bp{constructor({blockNumber:e,chain:t,contract:n}){super(`Chain "${t.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...e&&n.blockCreated&&n.blockCreated>e?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${n.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}class wg extends bp{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}}class Ag extends bp{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}class Cg extends bp{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}class Eg extends bp{constructor({chainId:e}){super("number"==typeof e?`Chain ID "${e}" is invalid.`:"Chain ID is invalid."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}const Bg={gwei:9,wei:18},Fg={ether:-9,wei:9},Dg={ether:-18,gwei:-9};function xg(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${a?`.${a}`:""}`}function kg(e,t="wei"){return xg(e,Fg[t])}class jg extends bp{constructor({cause:e,message:t}={}){var n;const r=null==(n=null==t?void 0:t.replace("execution reverted: ",""))?void 0:n.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(jg,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(jg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ig extends bp{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${kg(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}Object.defineProperty(Ig,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Sg extends bp{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${kg(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}Object.defineProperty(Sg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Pg extends bp{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(Pg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ug extends bp{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(Ug,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Og extends bp{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(Og,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ng extends bp{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}Object.defineProperty(Ng,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class Tg extends bp{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}Object.defineProperty(Tg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Mg extends bp{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(Mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Rg extends bp{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Rg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class _g extends bp{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${kg(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${kg(n)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class zg extends bp{constructor({cause:e}){super(`An error occurred while executing: ${null==e?void 0:e.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}function Lg(e,t="wei"){return xg(e,Bg[t])}function Wg(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),n=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(n+1)} ${t}`)).join("\n")}class qg extends bp{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class Qg extends bp{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}class Hg extends bp{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Wg(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class Vg extends bp{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}class $g extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d}){var f;const h=Wg({chain:r&&`${null==r?void 0:r.name} (id: ${null==r?void 0:r.id})`,from:null==t?void 0:t.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(f=null==r?void 0:r.nativeCurrency)?void 0:f.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=e}}class Gg extends bp{constructor({blockHash:e,blockNumber:t,blockTag:n,hash:r,index:o}){let a="Transaction";n&&void 0!==o&&(a=`Transaction at block time "${n}" at index "${o}"`),e&&void 0!==o&&(a=`Transaction at block hash "${e}" at index "${o}"`),t&&void 0!==o&&(a=`Transaction at block number "${t}" at index "${o}"`),r&&(a=`Transaction with hash "${r}"`),super(`${a} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class Kg extends bp{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}}class Jg extends bp{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}}const Yg=(e,t,n)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),n);class Zg extends bp{constructor({body:e,details:t,headers:n,status:r,url:o}){super("HTTP request failed.",{details:t,metaMessages:[r&&`Status: ${r}`,`URL: ${o}`,e&&`Request body: ${Yg(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=n,this.status=r,this.url=o}}class Xg extends bp{constructor({body:e,error:t,url:n}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${n}`,`Request body: ${Yg(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class ey extends bp{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${Yg(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}class ty extends bp{constructor(e,{code:t,docsPath:n,metaMessages:r,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:r||(null==e?void 0:e.metaMessages)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof Xg?e.code:t??-1}}class ny extends ty{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class ry extends ty{constructor(e){super(e,{code:ry.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(ry,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class oy extends ty{constructor(e){super(e,{code:oy.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(oy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ay extends ty{constructor(e){super(e,{code:ay.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(ay,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class uy extends ty{constructor(e){super(e,{code:uy.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(uy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class iy extends ty{constructor(e){super(e,{code:iy.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(iy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class sy extends ty{constructor(e){super(e,{code:sy.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(sy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ly extends ty{constructor(e){super(e,{code:ly.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ly,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class cy extends ty{constructor(e){super(e,{code:cy.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(cy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class dy extends ty{constructor(e){super(e,{code:dy.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(dy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class fy extends ty{constructor(e){super(e,{code:fy.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(fy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class hy extends ty{constructor(e){super(e,{code:hy.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(hy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class py extends ty{constructor(e){super(e,{code:py.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(py,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class my extends ny{constructor(e){super(e,{code:my.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(my,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class gy extends ny{constructor(e){super(e,{code:gy.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(gy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class yy extends ny{constructor(e){super(e,{code:yy.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(yy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class by extends ny{constructor(e){super(e,{code:by.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(by,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class vy extends ny{constructor(e){super(e,{code:vy.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(vy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class wy extends ny{constructor(e){super(e,{code:wy.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(wy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Ay extends ty{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}function Cy(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof bp?e.walk((e=>e.code===jg.code)):e;return r instanceof bp?new jg({cause:e,message:r.details}):jg.nodeMessage.test(n)?new jg({cause:e,message:e.details}):Ig.nodeMessage.test(n)?new Ig({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas}):Sg.nodeMessage.test(n)?new Sg({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas}):Pg.nodeMessage.test(n)?new Pg({cause:e,nonce:null==t?void 0:t.nonce}):Ug.nodeMessage.test(n)?new Ug({cause:e,nonce:null==t?void 0:t.nonce}):Og.nodeMessage.test(n)?new Og({cause:e,nonce:null==t?void 0:t.nonce}):Ng.nodeMessage.test(n)?new Ng({cause:e}):Tg.nodeMessage.test(n)?new Tg({cause:e,gas:null==t?void 0:t.gas}):Mg.nodeMessage.test(n)?new Mg({cause:e,gas:null==t?void 0:t.gas}):Rg.nodeMessage.test(n)?new Rg({cause:e}):_g.nodeMessage.test(n)?new _g({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas,maxPriorityFeePerGas:null==t?void 0:t.maxPriorityFeePerGas}):new zg({cause:e})}function Ey(e,{format:t}){if(!t)return{};const n={};return function t(r){const o=Object.keys(r);for(const a of o)a in e&&(n[a]=e[a]),r[a]&&"object"==typeof r[a]&&!Array.isArray(r[a])&&t(r[a])}(t(e||{})),n}function By(e,t){return({exclude:n,format:r})=>({exclude:n,format:e=>{const o=t(e);if(n)for(const t of n)delete o[t];return{...o,...r(e)}},type:e})}const Fy={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function Dy(e){const t={};return void 0!==e.accessList&&(t.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?t.blobs=e.blobs.map((e=>Qp(e))):t.blobs=e.blobs),void 0!==e.data&&(t.data=e.data),void 0!==e.from&&(t.from=e.from),void 0!==e.gas&&(t.gas=Hp(e.gas)),void 0!==e.gasPrice&&(t.gasPrice=Hp(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=Hp(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=Hp(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=Hp(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(t.nonce=Hp(e.nonce)),void 0!==e.to&&(t.to=e.to),void 0!==e.type&&(t.type=Fy[e.type]),void 0!==e.value&&(t.value=Hp(e.value)),t}function xy(e,t,n){const r=e[t.name];if("function"==typeof r)return r;const o=e[n];return"function"==typeof o?o:n=>t(e,n)}function ky(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:a}=e,u=t?yg(t):void 0;if(u&&!ag(u.address))throw new wm({address:u.address});if(a&&!ag(a))throw new wm({address:a});if(void 0!==n&&(void 0!==r||void 0!==o))throw new qg;if(r&&r>2n**256n-1n)throw new Ig({maxFeePerGas:r});if(o&&r&&o>r)throw new _g({maxFeePerGas:r,maxPriorityFeePerGas:o})}async function jy(e){return _p(await e.request({method:"eth_chainId"},{dedupe:!0}))}class Iy extends bp{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class Sy extends bp{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class Py extends bp{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${kg(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Uy extends bp{constructor({blockHash:e,blockNumber:t}){let n="Block";e&&(n=`Block at hash "${e}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}const Oy={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function Ny(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?_p(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?_p(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Oy[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}const Ty=By("transaction",Ny);function My(e){var t;const n=null==(t=e.transactions)?void 0:t.map((e=>"string"==typeof e?e:Ny(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Ry=By("block",My);async function _y(e,{blockHash:t,blockNumber:n,blockTag:r,includeTransactions:o}={}){var a,u,i;const s=r??"latest",l=o??!1,c=void 0!==n?Hp(n):void 0;let d=null;if(d=t?await e.request({method:"eth_getBlockByHash",params:[t,l]},{dedupe:!0}):await e.request({method:"eth_getBlockByNumber",params:[c||s,l]},{dedupe:Boolean(c)}),!d)throw new Uy({blockHash:t,blockNumber:n});return((null==(i=null==(u=null==(a=e.chain)?void 0:a.formatters)?void 0:u.block)?void 0:i.format)||My)(d)}async function zy(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Ly(e,t){var n,r,o;const{block:a,chain:u=e.chain,request:i}=t||{};if("function"==typeof(null==(n=null==u?void 0:u.fees)?void 0:n.defaultPriorityFee)){const t=a||await xy(e,_y,"getBlock")({});return u.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==(null==(r=null==u?void 0:u.fees)?void 0:r.defaultPriorityFee))return null==(o=null==u?void 0:u.fees)?void 0:o.defaultPriorityFee;try{return Rp(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([a?Promise.resolve(a):xy(e,_y,"getBlock")({}),xy(e,zy,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new Sy;const r=n-t.baseFeePerGas;return r<0n?0n:r}}async function Wy(e,t){var n,r;const{block:o,chain:a=e.chain,request:u,type:i="eip1559"}=t||{},s=await(async()=>{var t,n;return"function"==typeof(null==(t=null==a?void 0:a.fees)?void 0:t.baseFeeMultiplier)?a.fees.baseFeeMultiplier({block:o,client:e,request:u}):(null==(n=null==a?void 0:a.fees)?void 0:n.baseFeeMultiplier)??1.2})();if(s<1)throw new Iy;const l=10**((null==(n=s.toString().split(".")[1])?void 0:n.length)??0),c=e=>e*BigInt(Math.ceil(s*l))/BigInt(l),d=o||await xy(e,_y,"getBlock")({});if("function"==typeof(null==(r=null==a?void 0:a.fees)?void 0:r.estimateFeesPerGas)){const t=await a.fees.estimateFeesPerGas({block:o,client:e,multiply:c,request:u,type:i});if(null!==t)return t}if("eip1559"===i){if("bigint"!=typeof d.baseFeePerGas)throw new Sy;const t="bigint"==typeof(null==u?void 0:u.maxPriorityFeePerGas)?u.maxPriorityFeePerGas:await Ly(e,{block:d,chain:a,request:u}),n=c(d.baseFeePerGas);return{maxFeePerGas:(null==u?void 0:u.maxFeePerGas)??n+t,maxPriorityFeePerGas:t}}return{gasPrice:(null==u?void 0:u.gasPrice)??c(await xy(e,zy,"getGasPrice")({}))}}class qy extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d}){var f;const h=Wg({from:null==t?void 0:t.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(f=null==r?void 0:r.nativeCurrency)?void 0:f.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}class Qy extends bp{constructor({address:e}){super(`State for account "${e}" is set multiple times.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountStateConflictError"})}}class Hy extends bp{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function Vy(e){return e.reduce(((e,{slot:t,value:n})=>`${e} ${t}: ${n}\n`),"")}function $y(e){if(e&&0!==e.length)return e.reduce(((e,{slot:t,value:n})=>{if(66!==t.length)throw new Fp({size:t.length,targetSize:66,type:"hex"});if(66!==n.length)throw new Fp({size:n.length,targetSize:66,type:"hex"});return e[t]=n,e}),{})}function Gy(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:a}=e,u={};if(void 0!==a&&(u.code=a),void 0!==t&&(u.balance=Hp(t)),void 0!==n&&(u.nonce=Hp(n)),void 0!==r&&(u.state=$y(r)),void 0!==o){if(u.state)throw new Hy;u.stateDiff=$y(o)}return u}function Ky(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ag(n,{strict:!1}))throw new wm({address:n});if(t[n])throw new Qy({address:n});t[n]=Gy(r)}return t}async function Jy(e,t){var n,r,o;const a=t.account??e.account,u=a?yg(a):void 0;try{const{accessList:a,blobs:i,blobVersionedHashes:s,blockNumber:l,blockTag:c,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:g,nonce:y,to:b,value:v,stateOverride:w,...A}=await kb(e,{...t,parameters:"local"===(null==u?void 0:u.type)?void 0:["blobVersionedHashes"]}),C=(l?Hp(l):void 0)||c,E=Ky(w);ky(t);const B=null==(o=null==(r=null==(n=e.chain)?void 0:n.formatters)?void 0:r.transactionRequest)?void 0:o.format,F=(B||Dy)({...Ey(A,{format:B}),from:null==u?void 0:u.address,accessList:a,blobs:i,blobVersionedHashes:s,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:g,nonce:y,to:b,value:v}),D=await e.request({method:"eth_estimateGas",params:E?[F,C??"latest",E]:C?[F,C]:[F]});return BigInt(D)}catch(i){throw function(e,{docsPath:t,...n}){const r=(()=>{const t=Cy(e,n);return t instanceof zg?e:t})();return new qy(r,{docsPath:t,...n})}(i,{...t,account:u,chain:e.chain})}}async function Yy(e,{address:t,blockTag:n="latest",blockNumber:r}){return _p(await e.request({method:"eth_getTransactionCount",params:[t,r?Hp(r):n]},{dedupe:Boolean(r)}))}function Zy(e){const{kzg:t}=e,n=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),r="string"==typeof e.blobs[0]?e.blobs.map((e=>Np(e))):e.blobs,o=[];for(const a of r)o.push(Uint8Array.from(t.blobToKzgCommitment(a)));return"bytes"===n?o:o.map((e=>Qp(e)))}function Xy(e){const{kzg:t}=e,n=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),r="string"==typeof e.blobs[0]?e.blobs.map((e=>Np(e))):e.blobs,o="string"==typeof e.commitments[0]?e.commitments.map((e=>Np(e))):e.commitments,a=[];for(let u=0;uQp(e)))}class eb extends Nm{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Pm(this.buffer)}update(e){Bm(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=Om(e)).length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let c=a;c>o&a),i=Number(n&a),s=r?4:0,l=r?0:4;e.setUint32(t+s,u,r),e.setUint32(t+l,i,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const u=Pm(e),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const s=i/4,l=this.get();if(s>l.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;ce&t^~e&n,nb=(e,t,n)=>e&t^e&n^t&n,rb=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ob=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ab=new Uint32Array(64);class ub extends eb{constructor(){super(64,32,8,!1),this.A=0|ob[0],this.B=0|ob[1],this.C=0|ob[2],this.D=0|ob[3],this.E=0|ob[4],this.F=0|ob[5],this.G=0|ob[6],this.H=0|ob[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:a,G:u,H:i}=this;return[e,t,n,r,o,a,u,i]}set(e,t,n,r,o,a,u,i){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|a,this.G=0|u,this.H=0|i}process(e,t){for(let c=0;c<16;c++,t+=4)ab[c]=e.getUint32(t,!1);for(let c=16;c<64;c++){const e=ab[c-15],t=ab[c-2],n=Um(e,7)^Um(e,18)^e>>>3,r=Um(t,17)^Um(t,19)^t>>>10;ab[c]=r+ab[c-7]+n+ab[c-16]|0}let{A:n,B:r,C:o,D:a,E:u,F:i,G:s,H:l}=this;for(let c=0;c<64;c++){const e=l+(Um(u,6)^Um(u,11)^Um(u,25))+tb(u,i,s)+rb[c]+ab[c]|0,t=(Um(n,2)^Um(n,13)^Um(n,22))+nb(n,r,o)|0;l=s,s=i,i=u,u=a+e|0,a=o,o=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,a=a+this.D|0,u=u+this.E|0,i=i+this.F|0,s=s+this.G|0,l=l+this.H|0,this.set(n,r,o,a,u,i,s,l)}roundClean(){ab.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ib=Tm((()=>new ub));function sb(e,t){const n=t||"hex",r=ib(kp(e,{strict:!1})?Pp(e):e);return"bytes"===n?r:Wp(r)}function lb(e){const{commitment:t,version:n=1}=e,r=e.to??("string"==typeof t?"hex":"bytes"),o=sb(t,"bytes");return o.set([n],0),"bytes"===r?o:Qp(o)}function cb(e){const{commitments:t,version:n}=e,r=e.to??("string"==typeof t[0]?"hex":"bytes"),o=[];for(const a of t)o.push(lb({commitment:a,to:r,version:n}));return o}const db=32,fb=4096,hb=db*fb,pb=6*hb-1-1*fb*6,mb=1;class gb extends bp{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class yb extends bp{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}class bb extends bp{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashSizeError"})}}class vb extends bp{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${mb}`,`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashVersionError"})}}class wb extends bp{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class Ab extends bp{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class Cb extends bp{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const Eb={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Cb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Ab({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new wb({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new wb({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Bb(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Eb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Fb(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??function(e){const t=e.to??("string"==typeof e.data?"hex":"bytes"),n="string"==typeof e.data?Np(e.data):e.data,r=jp(n);if(!r)throw new yb;if(r>pb)throw new gb({maxSize:pb,size:r});const o=[];let a=!0,u=0;for(;a;){const e=Bb(new Uint8Array(hb));let t=0;for(;te.bytes)):o.map((e=>Qp(e.bytes)))}({data:t,to:r}),a=e.commitments??Zy({blobs:o,kzg:n,to:r}),u=e.proofs??Xy({blobs:o,commitments:a,kzg:n,to:r}),i=[];for(let s=0;s{const t=Cy(e,n);return t instanceof zg?e:t})();return new $g(r,{docsPath:t,...n})}(A,{...t,account:w,chain:t.chain||void 0})}}const Sb=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Pb=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Ub=[...Pb,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Ob=[...Pb,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Nb=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Tb=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Mb=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}];function Rb(e,t={}){void 0!==t.size&&Mp(e,{size:t.size});return Rp(Qp(e,t),t)}function _b(e,t={}){let n=e;if(void 0!==t.size&&(Mp(n,{size:t.size}),n=Ip(n)),n.length>1||n[0]>1)throw new Ap(n);return Boolean(n[0])}function zb(e,t={}){void 0!==t.size&&Mp(e,{size:t.size});return _p(Qp(e,t),t)}function Lb(e,t){const n="string"==typeof t?Np(t):t,r=Bb(n);if(0===jp(n)&&e.length>0)throw new Xp;if(jp(t)&&jp(t)<32)throw new Zp({data:"string"==typeof t?t:Qp(t),params:e,size:jp(t)});let o=0;const a=[];for(let u=0;u!e)),o=r?[]:{};let a=0;if(Hb(t)){const u=n+zb(e.readBytes(Qb));for(let n=0;n48?Rb(o,{signed:n}):zb(o,{signed:n}),32]}(e,t);if("string"===t.type)return function(e,{staticPosition:t}){const n=zb(e.readBytes(32)),r=t+n;e.setPosition(r);const o=zb(e.readBytes(32));if(0===o)return e.setPosition(t+32),["",32];const a=e.readBytes(o,32),u=function(e,t={}){let n=e;return void 0!==t.size&&(Mp(n,{size:t.size}),n=Ip(n,{dir:"right"})),(new TextDecoder).decode(n)}(Ip(a));return e.setPosition(t+32),[u,32]}(e,{staticPosition:n});throw new pm(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const qb=32,Qb=32;function Hb(e){var t;const{type:n}=e;if("string"===n)return!0;if("bytes"===n)return!0;if(n.endsWith("[]"))return!0;if("tuple"===n)return null==(t=e.components)?void 0:t.some(Hb);const r=pg(e.type);return!(!r||!Hb({...e,type:r[1]}))}const Vb=e=>Xm(Pp(e));let $b=class e extends Error{constructor(t,n={}){var r;const o=n.cause instanceof e?n.cause.details:(null==(r=n.cause)?void 0:r.message)?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath;super([t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: https://abitype.dev${a}`]:[],...o?[`Details: ${o}`]:[],"Version: abitype@1.0.4"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=o,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Gb(e,t){const n=e.exec(t);return null==n?void 0:n.groups}const Kb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Jb=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Yb=/^\(.+?\).*?$/,Zb=/^tuple(?(\[(\d*)\])*)$/;function Xb(e){let t=e.type;if(Zb.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const nv=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const rv=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;const ov=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function av(e){return ov.test(e)}function uv(e){return Gb(ov,e)}const iv=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;const sv=/^fallback\(\) external(?:\s(?payable{1}))?$/;const lv=/^receive\(\) external payable$/;const cv=new Set(["indexed"]),dv=new Set(["calldata","memory","storage"]);class fv extends $b{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class hv extends $b{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class pv extends $b{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class mv extends $b{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class gv extends $b{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class yv extends $b{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class bv extends $b{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class vv extends $b{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class wv extends $b{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Av extends $b{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Cv extends $b{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Ev extends $b{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}const Bv=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Fv(e,t={}){if(function(e){return rv.test(e)}(e)){const n=function(e){return Gb(rv,e)}(e);if(!n)throw new vv({signature:e,type:"function"});const r=Iv(n.parameters),o=[],a=r.length;for(let e=0;e[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,xv=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,kv=/^u?int$/;function jv(e,t){var n,r;const o=function(e,t){return t?`${t}:${e}`:e}(e,null==t?void 0:t.type);if(Bv.has(o))return Bv.get(o);const a=Yb.test(e),u=Gb(a?xv:Dv,e);if(!u)throw new pv({param:e});if(u.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||Kb.test(e)||Jb.test(e)||Pv.test(e)}(u.name))throw new mv({param:e,name:u.name});const i=u.name?{name:u.name}:{},s="indexed"===u.modifier?{indexed:!0}:{},l=(null==t?void 0:t.structs)??{};let c,d={};if(a){c="tuple";const e=Iv(u.type),t=[],n=e.length;for(let r=0;r[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function Ov(e,t,n=new Set){const r=[],o=e.length;for(let a=0;a{var t;return function(e){let t=!0,n="",r=0,o="",a=!1;for(let u=0;uug(Mv(e),0,4);function zv(e){const{abi:t,args:n=[],name:r}=e,o=kp(r,{strict:!1}),a=t.filter((e=>o?"function"===e.type?_v(e)===r:"event"===e.type&&Rv(e)===r:"name"in e&&e.name===r));if(0===a.length)return;if(1===a.length)return a[0];let u;for(const i of a){if(!("inputs"in i))continue;if(!n||0===n.length){if(!i.inputs||0===i.inputs.length)return i;continue}if(!i.inputs)continue;if(0===i.inputs.length)continue;if(i.inputs.length!==n.length)continue;if(n.every(((e,t)=>{const n="inputs"in i&&i.inputs[t];return!!n&&Lv(e,n)}))){if(u&&"inputs"in u&&u.inputs){const e=Wv(i.inputs,u.inputs,n);if(e)throw new lm({abiItem:i,type:e[0]},{abiItem:u,type:e[1]})}u=i}}return u||a[0]}function Lv(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ag(e,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:return"tuple"===r&&"components"in t?Object.values(t.components).every(((t,n)=>Lv(Object.values(e)[n],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?"number"===n||"bigint"===n:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?"string"===n||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)&&(Array.isArray(e)&&e.every((e=>Lv(e,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function Wv(e,t,n){for(const r in e){const o=e[r],a=t[r];if("tuple"===o.type&&"tuple"===a.type&&"components"in o&&"components"in a)return Wv(o.components,a.components,n[r]);const u=[o.type,a.type];if(!(!u.includes("address")||!u.includes("bytes20"))||(u.includes("address")&&u.includes("string")||!(!u.includes("address")||!u.includes("bytes")))&&ag(n[r],{strict:!1}))return u}}const qv="/docs/contract/decodeFunctionResult";function Qv(e){const{abi:t,args:n,functionName:r,data:o}=e;let a=t[0];if(r){const e=zv({abi:t,args:n,name:r});if(!e)throw new im(r,{docsPath:qv});a=e}if("function"!==a.type)throw new im(void 0,{docsPath:qv});if(!a.outputs)throw new sm(a.name,{docsPath:qv});const u=Lb(a.outputs,o);return u&&u.length>1?u:u&&1===u.length?u[0]:void 0}const Hv="/docs/contract/encodeFunctionData";function Vv(e){const{args:t}=e,{abi:n,functionName:r}=1===e.abi.length&&(null==(o=e.functionName)?void 0:o.startsWith("0x"))?e:function(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const e=zv({abi:t,args:n,name:r});if(!e)throw new im(r,{docsPath:Hv});o=e}if("function"!==o.type)throw new im(void 0,{docsPath:Hv});return{abi:[o],functionName:_v(Gp(o))}}(e);var o;const a=n[0];return vm([r,("inputs"in a&&a.inputs?dg(a.inputs,t??[]):void 0)??"0x"])}function $v({blockNumber:e,chain:t,contract:n}){var r;const o=null==(r=null==t?void 0:t.contracts)?void 0:r[n];if(!o)throw new vg({chain:t,contract:{name:n}});if(e&&o.blockCreated&&o.blockCreated>e)throw new vg({blockNumber:e,chain:t,contract:{name:n,blockCreated:o.blockCreated}});return o.address}const Gv={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Kv={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Jv={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Yv(e){const{abi:t,data:n}=e,r=ug(n,0,4);if("0x"===r)throw new Xp;const o=[...t||[],Kv,Jv].find((e=>"error"===e.type&&r===_v(Gp(e))));if(!o)throw new rm(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Lb(o.inputs,ug(n,4)):void 0,errorName:o.name}}function Zv({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map(((e,n)=>`${r&&e.name?`${e.name}: `:""}${"object"==typeof t[n]?Yg(t[n]):t[n]}`)).join(", ")})`}class Xv extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d,stateOverride:f}){var h;const p=t?yg(t):void 0;let m=Wg({from:null==p?void 0:p.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(h=null==r?void 0:r.nativeCurrency)?void 0:h.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});f&&(m+=`\n${function(e){return e.reduce(((e,{address:t,...n})=>{let r=`${e} ${t}:\n`;return n.nonce&&(r+=` nonce: ${n.nonce}\n`),n.balance&&(r+=` balance: ${n.balance}\n`),n.code&&(r+=` code: ${n.code}\n`),n.state&&(r+=" state:\n",r+=Vy(n.state)),n.stateDiff&&(r+=" stateDiff:\n",r+=Vy(n.stateDiff)),r})," State Override:\n").slice(0,-1)}(f)}`),super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}}class ew extends bp{constructor(e,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:a,sender:u}){const i=zv({abi:t,args:n,name:a}),s=i?Zv({abiItem:i,args:n,includeFunctionName:!1,includeName:!1}):void 0,l=Wg({address:r&&r,function:i?Gp(i,{includeName:!0}):void 0,args:s&&"()"!==s&&`${[...Array((null==a?void 0:a.length)??0).keys()].map((()=>" ")).join("")}${s}`,sender:u});super(e.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:e,docsPath:o,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",l].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=n,this.cause=e,this.contractAddress=r,this.functionName=a,this.sender=u}}class tw extends bp{constructor({abi:e,data:t,functionName:n,message:r}){let o,a,u,i,s;if(t&&"0x"!==t)try{a=Yv({abi:e,data:t});const{abiItem:n,errorName:r,args:o}=a;if("Error"===r)i=o[0];else if("Panic"===r){const[e]=o;i=Gv[e]}else{const e=n?Gp(n,{includeName:!0}):void 0,t=n&&o?Zv({abiItem:n,args:o,includeFunctionName:!1,includeName:!1}):void 0;u=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array((null==r?void 0:r.length)??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(l){o=l}else r&&(i=r);o instanceof rm&&(s=o.signature,u=[`Unable to decode signature "${s}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${s}.`]),super(i&&"execution reverted"!==i||s?[`The contract function "${n}" reverted with the following ${s?"signature":"reason"}:`,i||s].join("\n"):`The contract function "${n}" reverted.`,{cause:o,metaMessages:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.reason=i,this.signature=s}}class nw extends bp{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}}class rw extends bp{constructor({factory:e}){super("Deployment for counterfactual contract call failed"+(e?` for factory "${e}".`:""),{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CounterfactualDeploymentFailedError"})}}class ow extends bp{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function aw(e,t){var n,r,o,a,u,i;if(!(e instanceof bp))return!1;const s=e.walk((e=>e instanceof tw));return s instanceof tw&&("ResolverNotFound"===(null==(n=s.data)?void 0:n.errorName)||("ResolverWildcardNotSupported"===(null==(r=s.data)?void 0:r.errorName)||("ResolverNotContract"===(null==(o=s.data)?void 0:o.errorName)||("ResolverError"===(null==(a=s.data)?void 0:a.errorName)||("HttpError"===(null==(u=s.data)?void 0:u.errorName)||(!!(null==(i=s.reason)?void 0:i.includes("Wildcard on non-extended resolvers is not supported"))||"reverse"===t&&s.reason===Gv[50]))))))}function uw(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return kp(t)?t:null}function iw(e){let t=new Uint8Array(32).fill(0);if(!e)return Qp(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const e=uw(n[r]),o=e?Pp(e):Xm(Tp(n[r]),"bytes");t=Xm(bm([t,o]),"bytes")}return Qp(t)}function sw(e){const t=new Uint8Array(32).fill(0);return e?uw(e)||Xm(Tp(e)):Qp(t)}function lw(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const n=new Uint8Array(Tp(t).byteLength+2);let r=0;const o=t.split(".");for(let a=0;a255&&(e=Tp(`[${sw(o[a]).slice(2)}]`)),n[r]=e.length,n.set(e,r+1),r+=e.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}const cw=3;function dw(e,{abi:t,address:n,args:r,docsPath:o,functionName:a,sender:u}){const{code:i,data:s,message:l,shortMessage:c}=e instanceof ow?e:e instanceof bp?e.walk((e=>"data"in e))||e.walk():{},d=e instanceof Xp?new nw({functionName:a}):[cw,iy.code].includes(i)&&(s||l||c)?new tw({abi:t,data:"object"==typeof s?s.data:s,functionName:a,message:c??l}):e;return new ew(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:a,sender:u})}const fw="0x82ad56cb",hw="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",pw="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",mw="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";const gw=new Map;function yw({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const a=async()=>{const t=i();u();const n=t.map((({args:e})=>e));0!==n.length&&e(n).then((e=>{var n;o&&Array.isArray(e)&&e.sort(o);for(let r=0;r{var n;for(let r=0;rgw.delete(t),i=()=>gw.get(t)||[],s=e=>gw.set(t,[...i(),e]);return{flush:u,async schedule(e){const t={},o=new Promise(((e,n)=>{t.resolve=e,t.reject=n}));(null==n?void 0:n([...i().map((({args:e})=>e)),e]))&&a();return i().length>0?(s({args:e,pendingPromise:t}),o):(s({args:e,pendingPromise:t}),setTimeout(a,r),o)}}}async function bw(e,t){var n,r,o,a;const{account:u=e.account,batch:i=Boolean(null==(n=e.batch)?void 0:n.multicall),blockNumber:s,blockTag:l="latest",accessList:c,blobs:d,code:f,data:h,factory:p,factoryData:m,gas:g,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:v,maxPriorityFeePerGas:w,nonce:A,to:C,value:E,stateOverride:B,...F}=t,D=u?yg(u):void 0;if(f&&(p||m))throw new bp("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(f&&C)throw new bp("Cannot provide both `code` & `to` as parameters.");const x=f&&h,k=p&&m&&C&&h,j=x||k,I=x?function(e){const{code:t,data:n}=e;return gg({abi:Nv(["constructor(bytes, bytes)"]),bytecode:hw,args:[t,n]})}({code:f,data:h}):k?function(e){const{data:t,factory:n,factoryData:r,to:o}=e;return gg({abi:Nv(["constructor(address, bytes, address, bytes)"]),bytecode:pw,args:[o,t,n,r]})}({data:h,factory:p,factoryData:m,to:C}):h;try{ky(t);const n=(s?Hp(s):void 0)||l,u=Ky(B),f=null==(a=null==(o=null==(r=e.chain)?void 0:r.formatters)?void 0:o.transactionRequest)?void 0:a.format,h=(f||Dy)({...Ey(F,{format:f}),from:null==D?void 0:D.address,accessList:c,blobs:d,data:I,gas:g,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:v,maxPriorityFeePerGas:w,nonce:A,to:j?void 0:C,value:E});if(i&&function({request:e}){const{data:t,to:n,...r}=e;return!!t&&(!t.startsWith(fw)&&(!!n&&!(Object.values(r).filter((e=>void 0!==e)).length>0)))}({request:h})&&!u)try{return await async function(e,t){var n;const{batchSize:r=1024,wait:o=0}="object"==typeof(null==(n=e.batch)?void 0:n.multicall)?e.batch.multicall:{},{blockNumber:a,blockTag:u="latest",data:i,multicallAddress:s,to:l}=t;let c=s;if(!c){if(!e.chain)throw new Cg;c=$v({blockNumber:a,chain:e.chain,contract:"multicall3"})}const d=a?Hp(a):void 0,f=d||u,{schedule:h}=yw({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch:e=>e.reduce(((e,{data:t})=>e+(t.length-2)),0)>2*r,fn:async t=>{const n=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),r=Vv({abi:Sb,args:[n],functionName:"aggregate3"}),o=await e.request({method:"eth_call",params:[{data:r,to:c},f]});return Qv({abi:Sb,args:[n],functionName:"aggregate3",data:o||"0x"})}}),[{returnData:p,success:m}]=await h({data:i,to:l});if(!m)throw new ow({data:p});return"0x"===p?{data:void 0}:{data:p}}(e,{...h,blockNumber:s,blockTag:l})}catch(S){if(!(S instanceof Cg||S instanceof vg))throw S}const p=await e.request({method:"eth_call",params:u?[h,n,u]:[h,n]});return"0x"===p?{data:void 0}:{data:p}}catch(S){const n=function(e){var t;if(!(e instanceof bp))return;const n=e.walk();return"object"==typeof(null==n?void 0:n.data)?null==(t=n.data)?void 0:t.data:n.data}(S),{offchainLookup:r,offchainLookupSignature:o}=await ep((async()=>{const{offchainLookup:e,offchainLookupSignature:t}=await import("./ccip-CqyhqZTu.js");return{offchainLookup:e,offchainLookupSignature:t}}),[]);if(!1!==e.ccipRead&&(null==n?void 0:n.slice(0,10))===o&&C)return{data:await r(e,{data:n,to:C})};if(j&&"0x101bb98d"===(null==n?void 0:n.slice(0,10)))throw new rw({factory:p});throw function(e,{docsPath:t,...n}){const r=(()=>{const t=Cy(e,n);return t instanceof zg?e:t})();return new Xv(r,{docsPath:t,...n})}(S,{...t,account:D,chain:e.chain})}}async function vw(e,t){const{abi:n,address:r,args:o,functionName:a,...u}=t,i=Vv({abi:n,args:o,functionName:a});try{const{data:t}=await xy(e,bw,"call")({...u,data:i,to:r});return Qv({abi:n,args:o,functionName:a,data:t||"0x"})}catch(s){throw dw(s,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:a})}}class ww extends bp{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class Aw extends bp{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class Cw extends bp{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Ew extends bp{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const Bw=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,Fw=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,Dw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,xw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function kw(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function jw({uri:e,gatewayUrls:t}){const n=Dw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=kw(null==t?void 0:t.ipfs,"https://ipfs.io"),o=kw(null==t?void 0:t.arweave,"https://arweave.net"),a=e.match(Bw),{protocol:u,subpath:i,target:s,subtarget:l=""}=(null==a?void 0:a.groups)||{},c="ipns:/"===u||"ipns/"===i,d="ipfs:/"===u||"ipfs/"===i||Fw.test(e);if(e.startsWith("http")&&!c&&!d){let n=e;return(null==t?void 0:t.arweave)&&(n=e.replace(/https:\/\/arweave.net/g,null==t?void 0:t.arweave)),{uri:n,isOnChain:!1,isEncoded:!1}}if((c||d)&&s)return{uri:`${r}/${c?"ipns":"ipfs"}/${s}${l}`,isOnChain:!1,isEncoded:!1};if("ar:/"===u&&s)return{uri:`${o}/${s}${l||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(xw,"");if(f.startsWith("{const n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=e}))}}(n);if(o)return n;throw new Cw({uri:t})}async function Pw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?async function(e,{gatewayUrls:t,record:n}){const r=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[a,u]=n.split(":"),[i,s]=r.split(":");if(!a||"eip155"!==a.toLowerCase())throw new Aw({reason:"Only EIP-155 supported"});if(!u)throw new Aw({reason:"Chain ID not found"});if(!s)throw new Aw({reason:"Contract address not found"});if(!o)throw new Aw({reason:"Token ID not found"});if(!i)throw new Aw({reason:"ERC namespace not found"});return{chainID:Number.parseInt(u),namespace:i.toLowerCase(),contractAddress:s,tokenID:o}}(n),o=await async function(e,{nft:t}){if("erc721"===t.namespace)return vw(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return vw(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Ew({namespace:t.namespace})}(e,{nft:r}),{uri:a,isOnChain:u,isEncoded:i}=jw({uri:o,gatewayUrls:t});if(u&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const e=i?atob(a.replace("data:application/json;base64,","")):a;return Sw({uri:Iw(JSON.parse(e)),gatewayUrls:t})}let s=r.tokenID;"erc1155"===r.namespace&&(s=s.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then((e=>e.json()));return await Sw({gatewayUrls:e,uri:Iw(n)})}catch{throw new Cw({uri:t})}}({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,s)})}(e,{gatewayUrls:t,record:n}):Sw({uri:n,gatewayUrls:t})}async function Uw(e,{blockNumber:t,blockTag:n,name:r,key:o,gatewayUrls:a,strict:u,universalResolverAddress:i}){let s=i;if(!s){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=$v({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const u={address:s,abi:Ub,functionName:"resolve",args:[Wp(lw(r)),Vv({abi:Nb,functionName:"text",args:[iw(r),o]})],blockNumber:t,blockTag:n},i=xy(e,vw,"readContract"),l=a?await i({...u,args:[...u.args,a]}):await i(u);if("0x"===l[0])return null;const c=Qv({abi:Nb,functionName:"text",data:l[0]});return""===c?null:c}catch(l){if(u)throw l;if(aw(l,"resolve"))return null;throw l}}async function Ow(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:a,strict:u,universalResolverAddress:i}){const s=await xy(e,Uw,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:i,gatewayUrls:a,strict:u});if(!s)return null;try{return await Pw(e,{record:s,gatewayUrls:r})}catch{return null}}async function Nw(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:a,universalResolverAddress:u}){let i=u;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=$v({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const s=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const a={address:i,abi:Ob,functionName:"reverse",args:[Wp(lw(s))],blockNumber:n,blockTag:r},u=xy(e,vw,"readContract"),[l,c]=o?await u({...a,args:[...a.args,o]}):await u(a);return t.toLowerCase()!==c.toLowerCase()?null:l}catch(l){if(a)throw l;if(aw(l,"reverse"))return null;throw l}}function Tw(e,{method:t}){var n,r;const o={};return"fallback"===e.transport.type&&(null==(r=(n=e.transport).onResponse)||r.call(n,(({method:e,response:n,status:r,transport:a})=>{"success"===r&&t===e&&(o[n]=a.request)}))),t=>o[t]||e.request}class Mw extends bp{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}const Rw="/docs/contract/encodeEventTopics";function _w(e){var t;const{abi:n,eventName:r,args:o}=e;let a=n[0];if(r){const e=zv({abi:n,name:r});if(!e)throw new um(r,{docsPath:Rw});a=e}if("event"!==a.type)throw new um(void 0,{docsPath:Rw});const u=Gp(a),i=Rv(u);let s=[];if(o&&"inputs"in a){const e=null==(t=a.inputs)?void 0:t.filter((e=>"indexed"in e&&e.indexed)),n=Array.isArray(o)?o:Object.values(o).length>0?(null==e?void 0:e.map((e=>o[e.name])))??[]:[];n.length>0&&(s=(null==e?void 0:e.map(((e,t)=>Array.isArray(n[t])?n[t].map(((r,o)=>zw({param:e,value:n[t][o]}))):n[t]?zw({param:e,value:n[t]}):null)))??[])}return[i,...s]}function zw({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return Xm(Pp(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Mw(e.type);return dg([e],[t])}async function Lw(e,t){const{address:n,abi:r,args:o,eventName:a,fromBlock:u,strict:i,toBlock:s}=t,l=Tw(e,{method:"eth_newFilter"}),c=a?_w({abi:r,args:o,eventName:a}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:"bigint"==typeof u?Hp(u):u,toBlock:"bigint"==typeof s?Hp(s):s,topics:c}]});return{abi:r,args:o,eventName:a,id:d,request:l(d),strict:Boolean(i),type:"event"}}async function Ww(e,{address:t,args:n,event:r,events:o,fromBlock:a,strict:u,toBlock:i}={}){const s=o??(r?[r]:void 0),l=Tw(e,{method:"eth_newFilter"});let c=[];if(s){c=[s.flatMap((e=>_w({abi:[e],eventName:e.name,args:n})))],r&&(c=c[0])}const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof a?Hp(a):a,toBlock:"bigint"==typeof i?Hp(i):i,...c.length?{topics:c}:{}}]});return{abi:s,args:n,eventName:r?r.name:void 0,fromBlock:a,id:d,request:l(d),strict:Boolean(u),toBlock:i,type:"event"}}async function qw(e){const t=Tw(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Qw(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n?Hp(n):void 0,a=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(a)}const Hw=new Map,Vw=new Map;async function $w(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:n=>t.set(e,n)}),n=t(e,Hw),r=t(e,Vw);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}(t),o=r.response.get();if(o&&n>0){if((new Date).getTime()-o.created.getTime()`blockNumber.${e}`;async function Kw(e,{cacheTime:t=e.cacheTime}={}){const n=await $w((()=>e.request({method:"eth_blockNumber"})),{cacheKey:Gw(e.uid),cacheTime:t});return BigInt(n)}async function Jw(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=void 0!==n?Hp(n):void 0,a=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:Boolean(o)});if("0x"!==a)return a}const Yw="/docs/contract/decodeEventLog";function Zw(e){const{abi:t,data:n,strict:r,topics:o}=e,a=r??!0,[u,...i]=o;if(!u)throw new om({docsPath:Yw});const s=t.find((e=>"event"===e.type&&u===Rv(Gp(e))));if(!s||!("name"in s)||"event"!==s.type)throw new am(u,{docsPath:Yw});const{name:l,inputs:c}=s,d=null==c?void 0:c.some((e=>!("name"in e&&e.name)));let f=d?[]:{};const h=c.filter((e=>"indexed"in e&&e.indexed));for(let g=0;g!("indexed"in e&&e.indexed)));if(p.length>0)if(n&&"0x"!==n)try{const e=Lb(p,n);if(e)if(d)f=[...f,...e];else for(let t=0;t0?f:void 0}}function Xw({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(Lb([e],t)||[])[0]}function eA({abi:e,eventName:t,logs:n,strict:r=!0}){return n.map((n=>{var o;try{const o=Zw({...n,abi:e,strict:r});return t&&!t.includes(o.eventName)?null:{...o,...n}}catch(a){let e,t;if(a instanceof am)return null;if(a instanceof dm||a instanceof fm){if(r)return null;e=a.abiItem.name,t=null==(o=a.abiItem.inputs)?void 0:o.some((e=>!("name"in e&&e.name)))}return{...n,args:t?[]:{},eventName:e}}})).filter(Boolean)}function tA(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function nA(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:a,events:u,args:i,strict:s}={}){const l=s??!1,c=u??(a?[a]:void 0);let d,f=[];if(c){f=[c.flatMap((e=>_w({abi:[e],eventName:e.name,args:i})))],a&&(f=f[0])}d=n?await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:"bigint"==typeof r?Hp(r):r,toBlock:"bigint"==typeof o?Hp(o):o}]});const h=d.map((e=>tA(e)));return c?eA({abi:c,logs:h,strict:l}):h}async function rA(e,t){const{abi:n,address:r,args:o,blockHash:a,eventName:u,fromBlock:i,toBlock:s,strict:l}=t,c=u?zv({abi:n,name:u}):void 0,d=c?void 0:n.filter((e=>"event"===e.type));return xy(e,nA,"getLogs")({address:r,args:o,blockHash:a,event:c,events:d,fromBlock:i,toBlock:s,strict:l})}class oA extends bp{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip712DomainNotFoundError"})}}const aA=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function uA(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const a=n?Hp(n):void 0;return function(e){var t;return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:null==(t=e.reward)?void 0:t.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[Hp(t),a||r,o]},{dedupe:Boolean(a)}))}async function iA(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof r[0])return r;const o=r.map((e=>tA(e)));return"abi"in t&&t.abi?eA({abi:t.abi,logs:o,strict:n}):o}async function sA(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:a}){var u,i,s;const l=r||"latest",c=void 0!==n?Hp(n):void 0;let d=null;if(o?d=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Hp(a)]},{dedupe:!0}):(c||l)&&(d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||l,Hp(a)]},{dedupe:Boolean(c)})),!d)throw new Gg({blockHash:t,blockNumber:n,blockTag:l,hash:o,index:a});return((null==(s=null==(i=null==(u=e.chain)?void 0:u.formatters)?void 0:i.transaction)?void 0:s.format)||Ny)(d)}const lA={"0x0":"reverted","0x1":"success"};function cA(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>tA(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?_p(e.transactionIndex):null,status:e.status?lA[e.status]:null,type:e.type?Oy[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const dA=By("transactionReceipt",cA);async function fA(e,{hash:t}){var n,r,o;const a=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!a)throw new Kg({hash:t});return((null==(o=null==(r=null==(n=e.chain)?void 0:n.formatters)?void 0:r.transactionReceipt)?void 0:o.format)||cA)(a)}async function hA(e,t){var n;const{allowFailure:r=!0,batchSize:o,blockNumber:a,blockTag:u,multicallAddress:i,stateOverride:s}=t,l=t.contracts,c=o??("object"==typeof(null==(n=e.batch)?void 0:n.multicall)&&e.batch.multicall.batchSize||1024);let d=i;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=$v({blockNumber:a,chain:e.chain,contract:"multicall3"})}const f=[[]];let h=0,p=0;for(let b=0;b0&&p>c&&f[h].length>0&&(h++,p=(r.length-2)/2,f[h]=[]),f[h]=[...f[h],{allowFailure:!0,callData:r,target:t}]}catch(y){const a=dw(y,{abi:e,address:t,args:n,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;f[h]=[...f[h],{allowFailure:!0,callData:"0x",target:t}]}}const m=await Promise.allSettled(f.map((t=>xy(e,vw,"readContract")({abi:Sb,address:d,args:[t],blockNumber:a,blockTag:u,functionName:"aggregate3",stateOverride:s})))),g=[];for(let b=0;bpA.get(e)||[],a=()=>{const t=mA.get(e);1===o().length&&t&&t(),(()=>{const t=o();pA.set(e,t.filter((e=>e.id!==r)))})()},u=o();if(pA.set(e,[...u,{id:r,fns:t}]),u&&u.length>0)return a;const i={};for(const l in t)i[l]=(...e)=>{var t,n;const r=o();if(0!==r.length)for(const o of r)null==(n=(t=o.fns)[l])||n.call(t,...e)};const s=n(i);return"function"==typeof s&&mA.set(e,s),a}async function bA(e){return new Promise((t=>setTimeout(t,e)))}function vA(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const a=()=>o=!1;return(async()=>{let u;t&&(u=await e({unpoll:a}));const i=await(null==n?void 0:n(u))??r;await bA(i);const s=async()=>{o&&(await e({unpoll:a}),await bA(r),s())};s()})(),a}function wA(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:a,pollingInterval:u=e.pollingInterval}){let i;return(void 0!==a?a:"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type))?yA(Yg(["watchBlockNumber",e.uid,t,n,u]),{onBlockNumber:r,onError:o},(r=>vA((async()=>{var t;try{const t=await xy(e,Kw,"getBlockNumber")({cacheTime:0});if(i){if(t===i)return;if(t-i>1&&n)for(let e=i+1n;ei)&&(r.onBlockNumber(t,i),i=t)}catch(o){null==(t=r.onError)||t.call(r,o)}}),{emitOnBegin:t,interval:u}))):yA(Yg(["watchBlockNumber",e.uid,t,n]),{onBlockNumber:r,onError:o},(t=>{let n=!0,r=()=>n=!1;return(async()=>{try{const o=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),{unsubscribe:a}=await o.subscribe({params:["newHeads"],onData(e){var r;if(!n)return;const o=Rp(null==(r=e.result)?void 0:r.number);t.onBlockNumber(o,i),i=o},onError(e){var n;null==(n=t.onError)||n.call(t,e)}});r=a,n||r()}catch(a){null==o||o(a)}})(),()=>r()}))}async function AA(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const CA=new Am(8192);function EA(e,{delay:t=100,retryCount:n=2,shouldRetry:r=(()=>!0)}={}){return new Promise(((o,a)=>{const u=async({count:i=0}={})=>{try{const t=await e();o(t)}catch(s){if(i{const n="function"==typeof t?t({count:i,error:e}):t;n&&await bA(n),u({count:i+1})})({error:s});a(s)}};u()}))}function BA(e,t={}){return async(n,r={})=>{const{dedupe:o=!1,retryDelay:a=150,retryCount:u=3,uid:i}={...t,...r};return function(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(CA.get(n))return CA.get(n);const r=e().finally((()=>CA.delete(n)));return CA.set(n,r),r}((()=>EA((async()=>{try{return await e(n)}catch(t){const e=t;switch(e.code){case ry.code:throw new ry(e);case oy.code:throw new oy(e);case ay.code:throw new ay(e);case uy.code:throw new uy(e);case iy.code:throw new iy(e);case sy.code:throw new sy(e);case ly.code:throw new ly(e);case cy.code:throw new cy(e);case dy.code:throw new dy(e);case fy.code:throw new fy(e);case hy.code:throw new hy(e);case py.code:throw new py(e);case my.code:throw new my(e);case gy.code:throw new gy(e);case yy.code:throw new yy(e);case by.code:throw new by(e);case vy.code:throw new vy(e);case wy.code:throw new wy(e);case 5e3:throw new my(e);default:if(t instanceof bp)throw t;throw new Ay(e)}}}),{delay:({count:e,error:t})=>{var n;if(t&&t instanceof Zg){const e=null==(n=null==t?void 0:t.headers)?void 0:n.get("Retry-After");if(null==e?void 0:e.match(/\d/))return 1e3*Number.parseInt(e)}return(1<function(e){if("code"in e&&"number"==typeof e.code)return-1===e.code||(e.code===hy.code||e.code===iy.code);if(e instanceof Zg&&e.status)return 403===e.status||(408===e.status||(413===e.status||(429===e.status||(500===e.status||(502===e.status||(503===e.status||504===e.status))))));return!0}(e)})),{enabled:o,id:o?Xm($p(`${i}.${Yg(n)}`)):void 0})}}function FA(e,t){if(!ag(e,{strict:!1}))throw new wm({address:e});if(!ag(t,{strict:!1}))throw new wm({address:t});return e.toLowerCase()===t.toLowerCase()}function DA(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const xA=/^(.*)\[([0-9]*)\]$/,kA=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,jA=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function IA(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise(((o,a)=>{(async()=>{let u;try{const i=new AbortController;n>0&&(u=setTimeout((()=>{r?i.abort():a(t)}),n)),o(await e({signal:(null==i?void 0:i.signal)||null}))}catch(i){"AbortError"===(null==i?void 0:i.name)&&a(t),a(i)}finally{clearTimeout(u)}})()}))}function SA(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const PA=SA();function UA(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:zA({domain:t}),...e.types};_A({domain:t,message:n,primaryType:r,types:o});const a=["0x1901"];return t&&a.push(function({domain:e,types:t}){return OA({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:o})),"EIP712Domain"!==r&&a.push(OA({data:n,primaryType:r,types:o})),Xm(bm(a))}function OA({data:e,primaryType:t,types:n}){return Xm(NA({data:e,primaryType:t,types:n}))}function NA({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[TA({primaryType:t,types:n})];for(const a of n[t]){const[t,u]=RA({types:n,name:a.name,type:a.type,value:e[a.name]});r.push(t),o.push(u)}return dg(r,o)}function TA({primaryType:e,types:t}){const n=Wp(function({primaryType:e,types:t}){let n="";const r=MA({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const a of o)n+=`${a}(${t[a].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return n}({primaryType:e,types:t}));return Xm(n)}function MA({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=null==r?void 0:r[0];if(n.has(o)||void 0===t[o])return n;n.add(o);for(const a of t[o])MA({primaryType:a.type,types:t},n);return n}function RA({types:e,name:t,type:n,value:r}){if(void 0!==e[n])return[{type:"bytes32"},Xm(NA({data:r,primaryType:n,types:e}))];if("bytes"===n){return[{type:"bytes32"},Xm(r=`0x${(r.length%2?"0":"")+r.slice(2)}`)]}if("string"===n)return[{type:"bytes32"},Xm(Wp(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),a=r.map((n=>RA({name:t,type:o,types:e,value:n})));return[{type:"bytes32"},Xm(dg(a.map((([e])=>e)),a.map((([,e])=>e))))]}return[{type:n},r]}function _A(e){const{domain:t,message:n,primaryType:r,types:o}=e,a=(e,t)=>{for(const n of e){const{name:e,type:r}=n,u=t[e],i=r.match(jA);if(i&&("number"==typeof u||"bigint"==typeof u)){const[e,t,n]=i;Hp(u,{signed:"int"===t,size:Number.parseInt(n)/8})}if("address"===r&&"string"==typeof u&&!ag(u))throw new wm({address:u});const s=r.match(kA);if(s){const[e,t]=s;if(t&&jp(u)!==Number.parseInt(t))throw new cm({expectedSize:Number.parseInt(t),givenSize:jp(u)})}const l=o[r];l&&a(l,u)}};o.EIP712Domain&&t&&a(o.EIP712Domain,t),"EIP712Domain"!==r&&a(o[r],n)}function zA({domain:e}){return["string"==typeof(null==e?void 0:e.name)&&{name:"name",type:"string"},(null==e?void 0:e.version)&&{name:"version",type:"string"},"number"==typeof(null==e?void 0:e.chainId)&&{name:"chainId",type:"uint256"},(null==e?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(null==e?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function LA(e,t){if(e.length!==t.length)throw new nm({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;re+t.length),0),n=HA(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>QA(e)))):function(e){const t="string"==typeof e?Np(e):e,n=HA(t.length),r=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length;return{length:r,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function HA(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new bp("Length is too large.")}const VA="Ethereum Signed Message:\n";function $A(e,t){return Xm(function(e){const t="string"==typeof e?$p(e):"string"==typeof e.raw?e.raw:Qp(e.raw);return bm([$p(`${VA}${jp(t)}`),t])}(e),t)}const GA="0x6492649264926492649264926492649264926492649264926492649264926492";function KA(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:o}=e;if(t<=0)throw new Eg({chainId:t});if(o&&!ag(o))throw new wm({address:o});if(r&&r>2n**256n-1n)throw new Ig({maxFeePerGas:r});if(n&&r&&n>r)throw new _g({maxFeePerGas:r,maxPriorityFeePerGas:n})}function JA(e){if(!e||0===e.length)return[];const t=[];for(let n=0;n2n**256n-1n)throw new Ig({maxFeePerGas:r})}(e);const c=JA(s),d=[Wp(n),a?Wp(a):"0x",l?Wp(l):"0x",r?Wp(r):"0x",u??"0x",i?Wp(i):"0x",o??"0x",c,...ZA(e,t)];return vm(["0x01",qA(d)])}(e,t):"eip4844"===n?function(e,t){const{chainId:n,gas:r,nonce:o,to:a,value:u,maxFeePerBlobGas:i,maxFeePerGas:s,maxPriorityFeePerGas:l,accessList:c,data:d}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new yb;for(const e of t){const t=jp(e),n=_p(ug(e,0,1));if(32!==t)throw new bb({hash:e,size:t});if(n!==mb)throw new vb({hash:e,version:n})}}KA(e)}(e);let f=e.blobVersionedHashes,h=e.sidecars;if(e.blobs&&(void 0===f||void 0===h)){const t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map((e=>Qp(e))),n=e.kzg,r=Zy({blobs:t,kzg:n});if(void 0===f&&(f=cb({commitments:r})),void 0===h){h=Fb({blobs:t,commitments:r,proofs:Xy({blobs:t,commitments:r,kzg:n})})}}const p=JA(c),m=[Wp(n),o?Wp(o):"0x",l?Wp(l):"0x",s?Wp(s):"0x",r?Wp(r):"0x",a??"0x",u?Wp(u):"0x",d??"0x",p,i?Wp(i):"0x",f??[],...ZA(e,t)],g=[],y=[],b=[];if(h)for(let v=0;v2n**256n-1n)throw new Ig({maxFeePerGas:r});if(u)throw new bp("`accessList` is not a valid Legacy Transaction attribute.")}(e);let l=[a?Wp(a):"0x",s?Wp(s):"0x",r?Wp(r):"0x",u??"0x",i?Wp(i):"0x",o??"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(n>0)return BigInt(2*n)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new Qg({v:t.v});return e})();l=[...l,Wp(e),t.r,t.s]}else n>0&&(l=[...l,Wp(n),"0x","0x"]);return qA(l)}(e,t)}function ZA(e,t){const n=t??e,{v:r,yParity:o}=n;if(void 0===n.r)return[];if(void 0===n.s)return[];if(void 0===r&&void 0===o)return[];const a=Ip(n.r),u=Ip(n.s);return["number"==typeof o?o?Wp(1):"0x":0n===r?"0x":1n===r?Wp(1):27n===r?"0x":Wp(1),"0x00"===a?"0x":a,"0x00"===u?"0x":u]}async function XA(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const a=r??"latest",u=void 0!==n?Hp(n):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?_p(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,o,u||a]}))}async function eC(e,{confirmations:t=1,hash:n,onReplaced:r,pollingInterval:o=e.pollingInterval,retryCount:a=6,retryDelay:u=(({count:e})=>200*(1<{i&&setTimeout((()=>m(new Jg({hash:n}))),i);const g=yA(s,{onReplaced:r,resolve:p,reject:m},(r=>{const i=xy(e,wA,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:o,async onBlockNumber(o){const s=e=>{i(),e(),g()};let p=o;if(!h){f>a&&s((()=>r.reject(new Jg({hash:n}))));try{if(d){if(t>1&&(!d.blockNumber||p-d.blockNumber+1nr.resolve(d)))}if(l||(h=!0,await EA((async()=>{l=await xy(e,sA,"getTransaction")({hash:n}),l.blockNumber&&(p=l.blockNumber)}),{delay:u,retryCount:a}),h=!1),d=await xy(e,fA,"getTransactionReceipt")({hash:n}),t>1&&(!d.blockNumber||p-d.blockNumber+1nr.resolve(d)))}catch(m){if(m instanceof Gg||m instanceof Kg){if(!l)return void(h=!1);try{c=l,h=!0;const n=await EA((()=>xy(e,_y,"getBlock")({blockNumber:p,includeTransactions:!0})),{delay:u,retryCount:a,shouldRetry:({error:e})=>e instanceof Uy});h=!1;const o=n.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!o)return;if(d=await xy(e,fA,"getTransactionReceipt")({hash:o.hash}),t>1&&(!d.blockNumber||p-d.blockNumber+1n{var e;null==(e=r.onReplaced)||e.call(r,{reason:i,replacedTransaction:c,transaction:o,transactionReceipt:d}),r.resolve(d)}))}catch(y){s((()=>r.reject(y)))}}else s((()=>r.reject(m)))}finally{f++}}}})}))}))}async function tC(e,{account:t=e.account,message:n}){if(!t)throw new bg({docsPath:"/docs/actions/wallet/signMessage"});const r=yg(t);if("local"===r.type)return r.signMessage({message:n});const o="string"==typeof n?$p(n):n.raw instanceof Uint8Array?Wp(n.raw):n.raw;return e.request({method:"personal_sign",params:[o,r.address]},{retryCount:0})}async function nC(e,t){const{account:n=e.account,domain:r,message:o,primaryType:a}=t;if(!n)throw new bg({docsPath:"/docs/actions/wallet/signTypedData"});const u=yg(n),i={EIP712Domain:zA({domain:r}),...t.types};if(_A({domain:r,message:o,primaryType:a,types:i}),"local"===u.type)return u.signTypedData({domain:r,message:o,primaryType:a,types:i});const s=function(e){const{domain:t,message:n,primaryType:r,types:o}=e,a=(e,t)=>{const n={...t};for(const r of e){const{name:e,type:t}=r;"address"===t&&(n[e]=n[e].toLowerCase())}return n},u=o.EIP712Domain&&t?a(o.EIP712Domain,t):{},i=(()=>{if("EIP712Domain"!==r)return a(o[r],n)})();return Yg({domain:u,message:i,primaryType:r,types:o})}({domain:r,message:o,primaryType:a,types:i});return e.request({method:"eth_signTypedData_v4",params:[u.address,s]},{retryCount:0})}async function rC(e,t){const{abi:n,address:r,args:o,dataSuffix:a,functionName:u,...i}=t,s=i.account?yg(i.account):e.account,l=Vv({abi:n,args:o,functionName:u});try{const{data:c}=await xy(e,bw,"call")({batch:!1,data:`${l}${a?a.replace("0x",""):""}`,to:r,...i,account:s}),d=Qv({abi:n,args:o,functionName:u,data:c||"0x"});return{result:d,request:{abi:n.filter((e=>"name"in e&&e.name===t.functionName)),address:r,args:o,dataSuffix:a,functionName:u,...i,account:s}}}catch(c){throw dw(c,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:u,sender:null==s?void 0:s.address})}} + */function Wh(){return Wh=Object.assign?Object.assign.bind():function(e){for(var t=1;t{}));const qh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"];try{window.__reactRouterVersion="6"}catch(UM){}const Qh=pt.startTransition;function Hh(e){let{basename:t,children:n,future:r,window:o}=e,a=ft.useRef();null==a.current&&(a.current=Rf({window:o,v5Compat:!0}));let u=a.current,[i,s]=ft.useState({action:u.action,location:u.location}),{v7_startTransition:l}=r||{},c=ft.useCallback((e=>{l&&Qh?Qh((()=>s(e))):s(e)}),[s,l]);return ft.useLayoutEffect((()=>u.listen(c)),[u,c]),ft.createElement(_h,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:u,future:r})}const Vh="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,$h=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gh=ft.forwardRef((function(e,t){let n,{onClick:r,relative:o,reloadDocument:a,replace:u,state:i,target:s,to:l,preventScrollReset:c,unstable_viewTransition:d}=e,f=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,qh),{basename:h}=ft.useContext(wh),p=!1;if("string"==typeof l&&$h.test(l)&&(n=l,Vh))try{let e=new URL(window.location.href),t=l.startsWith("//")?new URL(e.protocol+l):new URL(l),n=ih(t.pathname,h);t.origin===e.origin&&null!=n?l=n+t.search+t.hash:p=!0}catch(UM){}let m=function(e,t){let{relative:n}=void 0===t?{}:t;Bh()||_f(!1);let{basename:r,navigator:o}=ft.useContext(wh),{hash:a,pathname:u,search:i}=kh(e,{relative:n}),s=u;return"/"!==r&&(s="/"===u?r:dh([r,u])),o.createHref({pathname:s,search:i,hash:a})}(l,{relative:o}),g=function(e,t){let{target:n,replace:r,state:o,preventScrollReset:a,relative:u,unstable_viewTransition:i}=void 0===t?{}:t,s=xh(),l=Fh(),c=kh(e,{relative:u});return ft.useCallback((t=>{if(function(e,t){return!(0!==e.button||t&&"_self"!==t||function(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}(e))}(t,n)){t.preventDefault();let n=void 0!==r?r:qf(l)===qf(c);s(e,{replace:n,state:o,preventScrollReset:a,relative:u,unstable_viewTransition:i})}}),[l,s,c,r,o,n,e,a,u,i])}(l,{replace:u,state:i,target:s,preventScrollReset:c,relative:o,unstable_viewTransition:d});return ft.createElement("a",Wh({},f,{href:n||m,onClick:p||a?r:function(e){r&&r(e),e.defaultPrevented||g(e)},ref:t,target:s}))}));var Kh,Jh,Yh,Zh;(Jh=Kh||(Kh={})).UseScrollRestoration="useScrollRestoration",Jh.UseSubmit="useSubmit",Jh.UseSubmitFetcher="useSubmitFetcher",Jh.UseFetcher="useFetcher",Jh.useViewTransitionState="useViewTransitionState",(Zh=Yh||(Yh={})).UseFetcher="useFetcher",Zh.UseFetchers="useFetchers",Zh.UseScrollRestoration="useScrollRestoration";const Xh={},ep=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),n=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));r=Promise.all(t.map((e=>{if((e=function(e){return"/"+e}(e))in Xh)return;Xh[e]=!0;const t=e.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${r}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script",o.crossOrigin=""),o.href=e,n&&o.setAttribute("nonce",n),document.head.appendChild(o),t?new Promise(((t,n)=>{o.addEventListener("load",t),o.addEventListener("error",(()=>n(new Error(`Unable to preload CSS for ${e}`))))})):void 0})))}return r.then((()=>e())).catch((e=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}))};var tp='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',np={rounded:`SFRounded, ui-rounded, "SF Pro Rounded", ${tp}`,system:tp},rp={large:{actionButton:"9999px",connectButton:"12px",modal:"24px",modalMobile:"28px"},medium:{actionButton:"10px",connectButton:"8px",modal:"16px",modalMobile:"18px"},none:{actionButton:"0px",connectButton:"0px",modal:"0px",modalMobile:"0px"},small:{actionButton:"4px",connectButton:"4px",modal:"8px",modalMobile:"8px"}},op={large:{modalOverlay:"blur(20px)"},none:{modalOverlay:"blur(0px)"},small:{modalOverlay:"blur(4px)"}},ap=({borderRadius:e="large",fontStack:t="rounded",overlayBlur:n="none"})=>({blurs:{modalOverlay:op[n].modalOverlay},fonts:{body:np[t]},radii:{actionButton:rp[e].actionButton,connectButton:rp[e].connectButton,menuButton:rp[e].connectButton,modal:rp[e].modal,modalMobile:rp[e].modalMobile}}),up={blue:{accentColor:"#0E76FD",accentColorForeground:"#FFF"},green:{accentColor:"#1DB847",accentColorForeground:"#FFF"},orange:{accentColor:"#FF801F",accentColorForeground:"#FFF"},pink:{accentColor:"#FF5CA0",accentColorForeground:"#FFF"},purple:{accentColor:"#5F5AFA",accentColorForeground:"#FFF"},red:{accentColor:"#FA423C",accentColorForeground:"#FFF"}},ip=up.blue,sp=({accentColor:e=ip.accentColor,accentColorForeground:t=ip.accentColorForeground,...n}={})=>({...ap(n),colors:{accentColor:e,accentColorForeground:t,actionButtonBorder:"rgba(0, 0, 0, 0.04)",actionButtonBorderMobile:"rgba(0, 0, 0, 0.06)",actionButtonSecondaryBackground:"rgba(0, 0, 0, 0.06)",closeButton:"rgba(60, 66, 66, 0.8)",closeButtonBackground:"rgba(0, 0, 0, 0.06)",connectButtonBackground:"#FFF",connectButtonBackgroundError:"#FF494A",connectButtonInnerBackground:"linear-gradient(0deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.06))",connectButtonText:"#25292E",connectButtonTextError:"#FFF",connectionIndicator:"#30E000",downloadBottomCardBackground:"linear-gradient(126deg, rgba(255, 255, 255, 0) 9.49%, rgba(171, 171, 171, 0.04) 71.04%), #FFFFFF",downloadTopCardBackground:"linear-gradient(126deg, rgba(171, 171, 171, 0.2) 9.49%, rgba(255, 255, 255, 0) 71.04%), #FFFFFF",error:"#FF494A",generalBorder:"rgba(0, 0, 0, 0.06)",generalBorderDim:"rgba(0, 0, 0, 0.03)",menuItemBackground:"rgba(60, 66, 66, 0.1)",modalBackdrop:"rgba(0, 0, 0, 0.3)",modalBackground:"#FFF",modalBorder:"transparent",modalText:"#25292E",modalTextDim:"rgba(60, 66, 66, 0.3)",modalTextSecondary:"rgba(60, 66, 66, 0.6)",profileAction:"#FFF",profileActionHover:"rgba(255, 255, 255, 0.5)",profileForeground:"rgba(60, 66, 66, 0.06)",selectedOptionBorder:"rgba(60, 66, 66, 0.1)",standby:"#FFD641"},shadows:{connectButton:"0px 4px 12px rgba(0, 0, 0, 0.1)",dialog:"0px 8px 32px rgba(0, 0, 0, 0.32)",profileDetailsAction:"0px 2px 6px rgba(37, 41, 46, 0.04)",selectedOption:"0px 2px 6px rgba(0, 0, 0, 0.24)",selectedWallet:"0px 2px 6px rgba(0, 0, 0, 0.12)",walletLogo:"0px 2px 16px rgba(0, 0, 0, 0.16)"}});sp.accentColors=up;var lp='{\n "connect_wallet": {\n "label": "Connect Wallet",\n "wrong_network": {\n "label": "Wrong network"\n }\n },\n\n "intro": {\n "title": "What is a Wallet?",\n "description": "A wallet is used to send, receive, store, and display digital assets. It\'s also a new way to log in, without needing to create new accounts and passwords on every website.",\n "digital_asset": {\n "title": "A Home for your Digital Assets",\n "description": "Wallets are used to send, receive, store, and display digital assets like Ethereum and NFTs."\n },\n "login": {\n "title": "A New Way to Log In",\n "description": "Instead of creating new accounts and passwords on every website, just connect your wallet."\n },\n "get": {\n "label": "Get a Wallet"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n\n "sign_in": {\n "label": "Verify your account",\n "description": "To finish connecting, you must sign a message in your wallet to verify that you are the owner of this account.",\n "message": {\n "send": "Sign message",\n "preparing": "Preparing message...",\n "cancel": "Cancel",\n "preparing_error": "Error preparing message, please retry!"\n },\n "signature": {\n "waiting": "Waiting for signature...",\n "verifying": "Verifying signature...",\n "signing_error": "Error signing message, please retry!",\n "verifying_error": "Error verifying signature, please retry!",\n "oops_error": "Oops, something went wrong!"\n }\n },\n\n "connect": {\n "label": "Connect",\n "title": "Connect a Wallet",\n "new_to_ethereum": {\n "description": "New to Ethereum wallets?",\n "learn_more": {\n "label": "Learn More"\n }\n },\n "learn_more": {\n "label": "Learn more"\n },\n "recent": "Recent",\n "status": {\n "opening": "Opening %{wallet}...",\n "connecting": "Connecting",\n "connect_mobile": "Continue in %{wallet}",\n "not_installed": "%{wallet} is not installed",\n "not_available": "%{wallet} is not available",\n "confirm": "Confirm connection in the extension",\n "confirm_mobile": "Accept connection request in the wallet"\n },\n "secondary_action": {\n "get": {\n "description": "Don\'t have %{wallet}?",\n "label": "GET"\n },\n "install": {\n "label": "INSTALL"\n },\n "retry": {\n "label": "RETRY"\n }\n },\n "walletconnect": {\n "description": {\n "full": "Need the official WalletConnect modal?",\n "compact": "Need the WalletConnect modal?"\n },\n "open": {\n "label": "OPEN"\n }\n }\n },\n\n "connect_scan": {\n "title": "Scan with %{wallet}",\n "fallback_title": "Scan with your phone"\n },\n\n "connector_group": {\n "installed": "Installed",\n "recommended": "Recommended",\n "other": "Other",\n "popular": "Popular",\n "more": "More",\n "others": "Others"\n },\n\n "get": {\n "title": "Get a Wallet",\n "action": {\n "label": "GET"\n },\n "mobile": {\n "description": "Mobile Wallet"\n },\n "extension": {\n "description": "Browser Extension"\n },\n "mobile_and_extension": {\n "description": "Mobile Wallet and Extension"\n },\n "mobile_and_desktop": {\n "description": "Mobile and Desktop Wallet"\n },\n "looking_for": {\n "title": "Not what you\'re looking for?",\n "mobile": {\n "description": "Select a wallet on the main screen to get started with a different wallet provider."\n },\n "desktop": {\n "compact_description": "Select a wallet on the main screen to get started with a different wallet provider.",\n "wide_description": "Select a wallet on the left to get started with a different wallet provider."\n }\n }\n },\n\n "get_options": {\n "title": "Get started with %{wallet}",\n "short_title": "Get %{wallet}",\n "mobile": {\n "title": "%{wallet} for Mobile",\n "description": "Use the mobile wallet to explore the world of Ethereum.",\n "download": {\n "label": "Get the app"\n }\n },\n "extension": {\n "title": "%{wallet} for %{browser}",\n "description": "Access your wallet right from your favorite web browser.",\n "download": {\n "label": "Add to %{browser}"\n }\n },\n "desktop": {\n "title": "%{wallet} for %{platform}",\n "description": "Access your wallet natively from your powerful desktop.",\n "download": {\n "label": "Add to %{platform}"\n }\n }\n },\n\n "get_mobile": {\n "title": "Install %{wallet}",\n "description": "Scan with your phone to download on iOS or Android",\n "continue": {\n "label": "Continue"\n }\n },\n\n "get_instructions": {\n "mobile": {\n "connect": {\n "label": "Connect"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n "extension": {\n "refresh": {\n "label": "Refresh"\n },\n "learn_more": {\n "label": "Learn More"\n }\n },\n "desktop": {\n "connect": {\n "label": "Connect"\n },\n "learn_more": {\n "label": "Learn More"\n }\n }\n },\n\n "chains": {\n "title": "Switch Networks",\n "wrong_network": "Wrong network detected, switch or disconnect to continue.",\n "confirm": "Confirm in Wallet",\n "switching_not_supported": "Your wallet does not support switching networks from %{appName}. Try switching networks from within your wallet instead.",\n "switching_not_supported_fallback": "Your wallet does not support switching networks from this app. Try switching networks from within your wallet instead.",\n "disconnect": "Disconnect",\n "connected": "Connected"\n },\n\n "profile": {\n "disconnect": {\n "label": "Disconnect"\n },\n "copy_address": {\n "label": "Copy Address",\n "copied": "Copied!"\n },\n "explorer": {\n "label": "View more on explorer"\n },\n "transactions": {\n "description": "%{appName} transactions will appear here...",\n "description_fallback": "Your transactions will appear here...",\n "recent": {\n "title": "Recent Transactions"\n },\n "clear": {\n "label": "Clear All"\n }\n }\n },\n\n "wallet_connectors": {\n "argent": {\n "qr_code": {\n "step1": {\n "description": "Put Argent on your home screen for faster access to your wallet.",\n "title": "Open the Argent app"\n },\n "step2": {\n "description": "Create a wallet and username, or import an existing wallet.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the Scan QR button"\n }\n }\n },\n\n "bifrost": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bifrost Wallet on your home screen for quicker access.",\n "title": "Open the Bifrost Wallet app"\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n }\n },\n\n "bitget": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bitget Wallet on your home screen for quicker access.",\n "title": "Open the Bitget Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Bitget Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Bitget Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "bitski": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Bitski to your taskbar for quicker access to your wallet.",\n "title": "Install the Bitski extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "bitverse": {\n "qr_code": {\n "step1": {\n "title": "Open the Bitverse Wallet app",\n "description": "Add Bitverse Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "bloom": {\n "desktop": {\n "step1": {\n "title": "Open the Bloom Wallet app",\n "description": "We recommend putting Bloom Wallet on your home screen for quicker access."\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you have a wallet, click on Connect to connect via Bloom. A connection prompt in the app will appear for you to confirm the connection.",\n "title": "Click on Connect"\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Bloom Wallet app",\n "description": "We recommend putting Bloom Wallet on your home screen for quicker access."\n },\n "step2": {\n "description": "Create or import a wallet using your recovery phrase.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you have a wallet, click on Connect to connect via Bloom. A connection prompt in the app will appear for you to confirm the connection.",\n "title": "Click on Connect"\n }\n }\n },\n\n "bybit": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Bybit on your home screen for faster access to your wallet.",\n "title": "Open the Bybit app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "Click at the top right of your browser and pin Bybit Wallet for easy access.",\n "title": "Install the Bybit Wallet extension"\n },\n "step2": {\n "description": "Create a new wallet or import an existing one.",\n "title": "Create or Import a wallet"\n },\n "step3": {\n "description": "Once you set up Bybit Wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "coin98": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Coin98 Wallet on your home screen for faster access to your wallet.",\n "title": "Open the Coin98 Wallet app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the WalletConnect button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "Click at the top right of your browser and pin Coin98 Wallet for easy access.",\n "title": "Install the Coin98 Wallet extension"\n },\n "step2": {\n "description": "Create a new wallet or import an existing one.",\n "title": "Create or Import a wallet"\n },\n "step3": {\n "description": "Once you set up Coin98 Wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "coinbase": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Coinbase Wallet on your home screen for quicker access.",\n "title": "Open the Coinbase Wallet app"\n },\n "step2": {\n "description": "You can easily backup your wallet using the cloud backup feature.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Coinbase Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Coinbase Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "compass": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Compass Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Compass Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "core": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Core on your home screen for faster access to your wallet.",\n "title": "Open the Core app"\n },\n "step2": {\n "description": "You can easily backup your wallet using our backup feature on your phone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the WalletConnect button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Core to your taskbar for quicker access to your wallet.",\n "title": "Install the Core extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "fox": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting FoxWallet on your home screen for quicker access.",\n "title": "Open the FoxWallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n }\n },\n\n "frontier": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Frontier Wallet on your home screen for quicker access.",\n "title": "Open the Frontier Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Frontier Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Frontier Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "im_token": {\n "qr_code": {\n "step1": {\n "title": "Open the imToken app",\n "description": "Put imToken app on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap Scanner Icon in top right corner",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "kaikas": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Kaikas to your taskbar for quicker access to your wallet.",\n "title": "Install the Kaikas extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Kaikas app",\n "description": "Put Kaikas app on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap Scanner Icon in top right corner",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "kraken": {\n "qr_code": {\n "step1": {\n "title": "Open the Kraken Wallet app",\n "description": "Add Kraken Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "kresus": {\n "qr_code": {\n "step1": {\n "title": "Open the Kresus Wallet app",\n "description": "Add Kresus Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "magicEden": {\n "extension": {\n "step1": {\n "title": "Install the Magic Eden extension",\n "description": "We recommend pinning Magic Eden to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "metamask": {\n "qr_code": {\n "step1": {\n "title": "Open the MetaMask app",\n "description": "We recommend putting MetaMask on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the MetaMask extension",\n "description": "We recommend pinning MetaMask to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "nestwallet": {\n "extension": {\n "step1": {\n "title": "Install the NestWallet extension",\n "description": "We recommend pinning NestWallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "okx": {\n "qr_code": {\n "step1": {\n "title": "Open the OKX Wallet app",\n "description": "We recommend putting OKX Wallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the OKX Wallet extension",\n "description": "We recommend pinning OKX Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "omni": {\n "qr_code": {\n "step1": {\n "title": "Open the Omni app",\n "description": "Add Omni to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your home screen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "1inch": {\n "qr_code": {\n "step1": {\n "description": "Put 1inch Wallet on your home screen for faster access to your wallet.",\n "title": "Open the 1inch Wallet app"\n },\n "step2": {\n "description": "Create a wallet and username, or import an existing wallet.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the Scan QR button"\n }\n }\n },\n\n "token_pocket": {\n "qr_code": {\n "step1": {\n "title": "Open the TokenPocket app",\n "description": "We recommend putting TokenPocket on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the TokenPocket extension",\n "description": "We recommend pinning TokenPocket to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "trust": {\n "qr_code": {\n "step1": {\n "title": "Open the Trust Wallet app",\n "description": "Put Trust Wallet on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the Trust Wallet extension",\n "description": "Click at the top right of your browser and pin Trust Wallet for easy access."\n },\n "step2": {\n "title": "Create or Import a wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up Trust Wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "uniswap": {\n "qr_code": {\n "step1": {\n "title": "Open the Uniswap app",\n "description": "Add Uniswap Wallet to your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap the QR icon and scan",\n "description": "Tap the QR icon on your homescreen, scan the code and confirm the prompt to connect."\n }\n }\n },\n\n "zerion": {\n "qr_code": {\n "step1": {\n "title": "Open the Zerion app",\n "description": "We recommend putting Zerion on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n },\n\n "extension": {\n "step1": {\n "title": "Install the Zerion extension",\n "description": "We recommend pinning Zerion to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "rainbow": {\n "qr_code": {\n "step1": {\n "title": "Open the Rainbow app",\n "description": "We recommend putting Rainbow on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "You can easily backup your wallet using our backup feature on your phone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "enkrypt": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Enkrypt Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Enkrypt Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "frame": {\n "extension": {\n "step1": {\n "description": "We recommend pinning Frame to your taskbar for quicker access to your wallet.",\n "title": "Install Frame & the companion extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "one_key": {\n "extension": {\n "step1": {\n "title": "Install the OneKey Wallet extension",\n "description": "We recommend pinning OneKey Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "phantom": {\n "extension": {\n "step1": {\n "title": "Install the Phantom extension",\n "description": "We recommend pinning Phantom to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "rabby": {\n "extension": {\n "step1": {\n "title": "Install the Rabby extension",\n "description": "We recommend pinning Rabby to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "ronin": {\n "qr_code": {\n "step1": {\n "description": "We recommend putting Ronin Wallet on your home screen for quicker access.",\n "title": "Open the Ronin Wallet app"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "After you scan, a connection prompt will appear for you to connect your wallet.",\n "title": "Tap the scan button"\n }\n },\n\n "extension": {\n "step1": {\n "description": "We recommend pinning Ronin Wallet to your taskbar for quicker access to your wallet.",\n "title": "Install the Ronin Wallet extension"\n },\n "step2": {\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone.",\n "title": "Create or Import a Wallet"\n },\n "step3": {\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension.",\n "title": "Refresh your browser"\n }\n }\n },\n\n "ramper": {\n "extension": {\n "step1": {\n "title": "Install the Ramper extension",\n "description": "We recommend pinning Ramper to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "safeheron": {\n "extension": {\n "step1": {\n "title": "Install the Core extension",\n "description": "We recommend pinning Safeheron to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "taho": {\n "extension": {\n "step1": {\n "title": "Install the Taho extension",\n "description": "We recommend pinning Taho to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "talisman": {\n "extension": {\n "step1": {\n "title": "Install the Talisman extension",\n "description": "We recommend pinning Talisman to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import an Ethereum Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "xdefi": {\n "extension": {\n "step1": {\n "title": "Install the XDEFI Wallet extension",\n "description": "We recommend pinning XDEFI Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "zeal": {\n "extension": {\n "step1": {\n "title": "Install the Zeal extension",\n "description": "We recommend pinning Zeal to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "safepal": {\n "extension": {\n "step1": {\n "title": "Install the SafePal Wallet extension",\n "description": "Click at the top right of your browser and pin SafePal Wallet for easy access."\n },\n "step2": {\n "title": "Create or Import a wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up SafePal Wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the SafePal Wallet app",\n "description": "Put SafePal Wallet on your home screen for faster access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Create a new wallet or import an existing one."\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Choose New Connection, then scan the QR code and confirm the prompt to connect."\n }\n }\n },\n\n "desig": {\n "extension": {\n "step1": {\n "title": "Install the Desig extension",\n "description": "We recommend pinning Desig to your taskbar for easier access to your wallet."\n },\n "step2": {\n "title": "Create a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n }\n },\n\n "subwallet": {\n "extension": {\n "step1": {\n "title": "Install the SubWallet extension",\n "description": "We recommend pinning SubWallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your recovery phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the SubWallet app",\n "description": "We recommend putting SubWallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "clv": {\n "extension": {\n "step1": {\n "title": "Install the CLV Wallet extension",\n "description": "We recommend pinning CLV Wallet to your taskbar for quicker access to your wallet."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Refresh your browser",\n "description": "Once you set up your wallet, click below to refresh the browser and load up the extension."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the CLV Wallet app",\n "description": "We recommend putting CLV Wallet on your home screen for quicker access."\n },\n "step2": {\n "title": "Create or Import a Wallet",\n "description": "Be sure to back up your wallet using a secure method. Never share your secret phrase with anyone."\n },\n "step3": {\n "title": "Tap the scan button",\n "description": "After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n },\n\n "okto": {\n "qr_code": {\n "step1": {\n "title": "Open the Okto app",\n "description": "Add Okto to your home screen for quick access"\n },\n "step2": {\n "title": "Create an MPC Wallet",\n "description": "Create an account and generate a wallet"\n },\n "step3": {\n "title": "Tap WalletConnect in Settings",\n "description": "Tap the Scan QR icon at the top right and confirm the prompt to connect."\n }\n }\n },\n\n "ledger": {\n "desktop": {\n "step1": {\n "title": "Open the Ledger Live app",\n "description": "We recommend putting Ledger Live on your home screen for quicker access."\n },\n "step2": {\n "title": "Set up your Ledger",\n "description": "Set up a new Ledger or connect to an existing one."\n },\n "step3": {\n "title": "Connect",\n "description": "A connection prompt will appear for you to connect your wallet."\n }\n },\n "qr_code": {\n "step1": {\n "title": "Open the Ledger Live app",\n "description": "We recommend putting Ledger Live on your home screen for quicker access."\n },\n "step2": {\n "title": "Set up your Ledger",\n "description": "You can either sync with the desktop app or connect your Ledger."\n },\n "step3": {\n "title": "Scan the code",\n "description": "Tap WalletConnect then Switch to Scanner. After you scan, a connection prompt will appear for you to connect your wallet."\n }\n }\n }\n }\n}\n';var cp=function(e,t){return Object.defineProperty(e,"__recipe__",{value:t,writable:!1}),e};function dp(e){var{conditions:t}=e;if(!t)throw new Error("Styles have no conditions");return cp((function(e){if("string"==typeof e||"number"==typeof e||"boolean"==typeof e){if(!t.defaultCondition)throw new Error("No default condition");return{[t.defaultCondition]:e}}if(Array.isArray(e)){if(!("responsiveArray"in t))throw new Error("Responsive arrays are not supported");var n={};for(var r in t.responsiveArray)null!=e[r]&&(n[t.responsiveArray[r]]=e[r]);return n}return e}),{importPath:"@vanilla-extract/sprinkles/createUtils",importName:"createNormalizeValueFn",args:[{conditions:e.conditions}]})}function fp(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function hp(e,t,n){return(t=fp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function mp(e){for(var t=1;te;const yp=e=>e;let bp=class e extends Error{constructor(t,n={}){var r;super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@2.16.2"});const o=n.cause instanceof e?n.cause.details:(null==(r=n.cause)?void 0:r.message)?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${n.docsBaseUrl??"https://viem.sh"}${a}${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...o?[`Details: ${o}`]:[],`Version: ${this.version}`].join("\n"),n.cause&&(this.cause=n.cause),this.details=o,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(e){return vp(this,e)}};function vp(e,t){return(null==t?void 0:t(e))?e:e&&"object"==typeof e&&"cause"in e?vp(e.cause,t):t?null:e}class wp extends bp{constructor({max:e,min:t,signed:n,size:r,value:o}){super(`Number "${o}" is not in safe ${r?`${8*r}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class Ap extends bp{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}}class Cp extends bp{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}class Ep extends bp{constructor({offset:e,position:t,size:n}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${n}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class Bp extends bp{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}class Fp extends bp{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} is expected to be ${t} ${n} long, but is ${e} ${n} long.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesLengthError"})}}function Dp(e,{dir:t,size:n=32}={}){return"string"==typeof e?xp(e,{dir:t,size:n}):function(e,{dir:t,size:n=32}={}){if(null===n)return e;if(e.length>n)throw new Bp({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let o=0;o2*n)throw new Bp({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r["right"===t?"padEnd":"padStart"](2*n,"0")}`}function kp(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function jp(e){return kp(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Ip(e,{dir:t="left"}={}){let n="string"==typeof e?e.replace("0x",""):e,r=0;for(let o=0;o=Up.zero&&e<=Up.nine?e-Up.zero:e>=Up.A&&e<=Up.F?e-(Up.A-10):e>=Up.a&&e<=Up.f?e-(Up.a-10):void 0}function Np(e,t={}){let n=e;t.size&&(Mp(n,{size:t.size}),n=Dp(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const o=r.length/2,a=new Uint8Array(o);for(let u=0,i=0;ut)throw new Cp({givenSize:jp(e),maxSize:t})}function Rp(e,t={}){const{signed:n}=t;t.size&&Mp(e,{size:t.size});const r=BigInt(e);if(!n)return r;const o=(e.length-2)/2;return r<=(1n<<8n*BigInt(o)-1n)-1n?r:r-BigInt(`0x${"f".padStart(2*o,"f")}`)-1n}function _p(e,t={}){return Number(Rp(e,t))}function zp(e,t={}){let n=Np(e);return t.size&&(Mp(n,{size:t.size}),n=Ip(n,{dir:"right"})),(new TextDecoder).decode(n)}const Lp=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Wp(e,t={}){return"number"==typeof e||"bigint"==typeof e?Hp(e,t):"string"==typeof e?$p(e,t):"boolean"==typeof e?qp(e,t):Qp(e,t)}function qp(e,t={}){const n=`0x${Number(e)}`;return"number"==typeof t.size?(Mp(n,{size:t.size}),Dp(n,{size:t.size})):n}function Qp(e,t={}){let n="";for(let o=0;oa||ofunction(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${Kp(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}class Jp extends bp{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class Yp extends bp{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Zp extends bp{constructor({data:e,params:t,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${Kp(t,{includeName:!0})})`,`Data: ${e} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=n}}class Xp extends bp{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class em extends bp{constructor({expectedLength:e,givenLength:t,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class tm extends bp{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${jp(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class nm extends bp{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class rm extends bp{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class om extends bp{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}}class am extends bp{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class um extends bp{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class im extends bp{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class sm extends bp{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class lm extends bp{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Gp(e.abiItem)}\`, and`,`\`${t.type}\` in \`${Gp(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class cm extends bp{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class dm extends bp{constructor({abiItem:e,data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${Kp(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=n,this.size=r}}class fm extends bp{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${Gp(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class hm extends bp{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class pm extends bp{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class mm extends bp{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class gm extends bp{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class ym extends bp{constructor(e){super(`Type "${e}" is not supported for packed encoding.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedPackedAbiType"})}}function bm(e){return"string"==typeof e[0]?vm(e):function(e){let t=0;for(const o of e)t+=o.length;const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return n}(e)}function vm(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class wm extends bp{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class Am extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}function Cm(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Em(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Bm(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Fm(e,t){Em(e);const n=t.outputLen;if(e.length>xm&Dm)}:{h:0|Number(e>>xm&Dm),l:0|Number(e&Dm)}}function jm(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;oe instanceof Uint8Array,Pm=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Um=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Om(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!Sm(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class Nm{clone(){return this._cloneInto()}}function Tm(e){const t=t=>e().update(Om(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Mm(e=32){if(Im&&"function"==typeof Im.getRandomValues)return Im.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[Rm,_m,zm]=[[],[],[]],Lm=BigInt(0),Wm=BigInt(1),qm=BigInt(2),Qm=BigInt(7),Hm=BigInt(256),Vm=BigInt(113);for(let NM=0,TM=Wm,MM=1,RM=0;NM<24;NM++){[MM,RM]=[RM,(2*MM+3*RM)%5],Rm.push(2*(5*RM+MM)),_m.push((NM+1)*(NM+2)/2%64);let e=Lm;for(let t=0;t<7;t++)TM=(TM<>Qm)*Vm)%Hm,TM&qm&&(e^=Wm<<(Wm<n>32?((e,t,n)=>t<>>64-n)(e,t,n):((e,t,n)=>e<>>32-n)(e,t,n),Jm=(e,t,n)=>n>32?((e,t,n)=>e<>>64-n)(e,t,n):((e,t,n)=>t<>>32-n)(e,t,n);class Ym extends Nm{constructor(e,t,n,r=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Cm(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var a;this.state=new Uint8Array(200),this.state32=(a=this.state,new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4)))}keccak(){!function(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,o=(r+2)%10,a=n[o],u=n[o+1],i=Km(a,u,1)^n[t],s=Jm(a,u,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=i,e[r+n+1]^=s}let t=e[2],o=e[3];for(let n=0;n<24;n++){const r=_m[n],a=Km(t,o,r),u=Jm(t,o,r),i=Rm[n];t=e[i],o=e[i+1],e[i]=a,e[i+1]=u}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=$m[r],e[1]^=Gm[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Bm(this);const{blockLen:t,state:n}=this,r=(e=Om(e)).length;for(let o=0;o=n&&this.keccak();const a=Math.min(n-this.posOut,o-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Cm(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Fm(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:o,enableXOF:a}=this;return e||(e=new Ym(t,n,r,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=r,e.enableXOF=a,e.destroyed=this.destroyed,e}}const Zm=((e,t,n)=>Tm((()=>new Ym(t,e,n))))(1,136,32);function Xm(e,t){const n=t||"hex",r=Zm(kp(e,{strict:!1})?Pp(e):e);return"bytes"===n?r:Wp(r)}const eg=new Am(8192);function tg(e,t){if(eg.has(`${e}.${t}`))return eg.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Xm(Tp(n),"bytes"),o=n.split("");for(let u=0;u<40;u+=2)r[u>>1]>>4>=8&&o[u]&&(o[u]=o[u].toUpperCase()),(15&r[u>>1])>=8&&o[u+1]&&(o[u+1]=o[u+1].toUpperCase());const a=`0x${o.join("")}`;return eg.set(`${e}.${t}`,a),a}function ng(e,t){if(!ag(e,{strict:!1}))throw new wm({address:e});return tg(e,t)}const rg=/^0x[a-fA-F0-9]{40}$/,og=new Am(8192);function ag(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(og.has(r))return og.get(r);const o=!(!rg.test(e)||e.toLowerCase()!==e&&n&&tg(e)!==e);return og.set(r,o),o}function ug(e,t,n,{strict:r}={}){return kp(e,{strict:!1})?cg(e,t,n,{strict:r}):lg(e,t,n,{strict:r})}function ig(e,t){if("number"==typeof t&&t>0&&t>jp(e)-1)throw new Ep({offset:t,position:"start",size:jp(e)})}function sg(e,t,n){if("number"==typeof t&&"number"==typeof n&&jp(e)!==n-t)throw new Ep({offset:n,position:"end",size:jp(e)})}function lg(e,t,n,{strict:r}={}){ig(e,t);const o=e.slice(t,n);return r&&sg(o,t,n),o}function cg(e,t,n,{strict:r}={}){ig(e,t);const o=`0x${e.replace("0x","").slice(2*(t??0),2*(n??e.length))}`;return r&&sg(o,t,n),o}function dg(e,t){if(e.length!==t.length)throw new nm({expectedLength:e.length,givenLength:t.length});const n=function({params:e,values:t}){const n=[];for(let r=0;r0?bm([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:bm(a.map((({encoded:e})=>e)))}}(t,{length:r,param:{...e,type:o}})}if("tuple"===e.type)return function(e,{param:t}){let n=!1;const r=[];for(let o=0;oe)))}}(t,{param:e});if("address"===e.type)return function(e){if(!ag(e))throw new wm({address:e});return{dynamic:!1,encoded:xp(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new bp(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xp(qp(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:Hp(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,n]=t.type.split("bytes"),r=jp(e);if(!n){let t=e;return r%32!=0&&(t=xp(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:bm([xp(Hp(r,{size:32})),t])}}if(r!==Number.parseInt(n))throw new tm({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:xp(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=$p(e),n=Math.ceil(jp(t)/32),r=[];for(let o=0;o"type"in e&&"constructor"===e.type));if(!o)throw new Jp({docsPath:mg});if(!("inputs"in o))throw new Yp({docsPath:mg});if(!o.inputs||0===o.inputs.length)throw new Yp({docsPath:mg});return vm([r,dg(o.inputs,n)])}function yg(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}class bg extends bp{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}class vg extends bp{constructor({blockNumber:e,chain:t,contract:n}){super(`Chain "${t.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...e&&n.blockCreated&&n.blockCreated>e?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${n.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}class wg extends bp{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}}class Ag extends bp{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}class Cg extends bp{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}class Eg extends bp{constructor({chainId:e}){super("number"==typeof e?`Chain ID "${e}" is invalid.`:"Chain ID is invalid."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}const Bg={gwei:9,wei:18},Fg={ether:-9,wei:9},Dg={ether:-18,gwei:-9};function xg(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,a]=[n.slice(0,n.length-t),n.slice(n.length-t)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${a?`.${a}`:""}`}function kg(e,t="wei"){return xg(e,Fg[t])}class jg extends bp{constructor({cause:e,message:t}={}){var n;const r=null==(n=null==t?void 0:t.replace("execution reverted: ",""))?void 0:n.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(jg,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(jg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Ig extends bp{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${kg(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}Object.defineProperty(Ig,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Sg extends bp{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${kg(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}Object.defineProperty(Sg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Pg extends bp{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(Pg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Ug extends bp{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(Ug,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Og extends bp{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(Og,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ng extends bp{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}Object.defineProperty(Ng,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class Tg extends bp{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}Object.defineProperty(Tg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Mg extends bp{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(Mg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Rg extends bp{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Rg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class _g extends bp{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${kg(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${kg(n)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(_g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class zg extends bp{constructor({cause:e}){super(`An error occurred while executing: ${null==e?void 0:e.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}function Lg(e,t="wei"){return xg(e,Bg[t])}function Wg(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),n=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(n+1)} ${t}`)).join("\n")}class qg extends bp{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class Qg extends bp{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}class Hg extends bp{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Wg(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class Vg extends bp{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}class $g extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d}){var f;const h=Wg({chain:r&&`${null==r?void 0:r.name} (id: ${null==r?void 0:r.id})`,from:null==t?void 0:t.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(f=null==r?void 0:r.nativeCurrency)?void 0:f.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=e}}class Gg extends bp{constructor({blockHash:e,blockNumber:t,blockTag:n,hash:r,index:o}){let a="Transaction";n&&void 0!==o&&(a=`Transaction at block time "${n}" at index "${o}"`),e&&void 0!==o&&(a=`Transaction at block hash "${e}" at index "${o}"`),t&&void 0!==o&&(a=`Transaction at block number "${t}" at index "${o}"`),r&&(a=`Transaction with hash "${r}"`),super(`${a} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class Kg extends bp{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}}class Jg extends bp{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}}const Yg=(e,t,n)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),n);class Zg extends bp{constructor({body:e,details:t,headers:n,status:r,url:o}){super("HTTP request failed.",{details:t,metaMessages:[r&&`Status: ${r}`,`URL: ${o}`,e&&`Request body: ${Yg(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=n,this.status=r,this.url=o}}class Xg extends bp{constructor({body:e,error:t,url:n}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${n}`,`Request body: ${Yg(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class ey extends bp{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${Yg(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}class ty extends bp{constructor(e,{code:t,docsPath:n,metaMessages:r,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:r||(null==e?void 0:e.metaMessages)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof Xg?e.code:t??-1}}class ny extends ty{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class ry extends ty{constructor(e){super(e,{code:ry.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(ry,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class oy extends ty{constructor(e){super(e,{code:oy.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(oy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ay extends ty{constructor(e){super(e,{code:ay.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(ay,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class uy extends ty{constructor(e){super(e,{code:uy.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(uy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class iy extends ty{constructor(e){super(e,{code:iy.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(iy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class sy extends ty{constructor(e){super(e,{code:sy.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(sy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ly extends ty{constructor(e){super(e,{code:ly.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ly,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class cy extends ty{constructor(e){super(e,{code:cy.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(cy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class dy extends ty{constructor(e){super(e,{code:dy.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(dy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class fy extends ty{constructor(e){super(e,{code:fy.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(fy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class hy extends ty{constructor(e){super(e,{code:hy.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(hy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class py extends ty{constructor(e){super(e,{code:py.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(py,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class my extends ny{constructor(e){super(e,{code:my.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(my,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class gy extends ny{constructor(e){super(e,{code:gy.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(gy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class yy extends ny{constructor(e){super(e,{code:yy.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(yy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class by extends ny{constructor(e){super(e,{code:by.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(by,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class vy extends ny{constructor(e){super(e,{code:vy.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(vy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class wy extends ny{constructor(e){super(e,{code:wy.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(wy,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Ay extends ty{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}function Cy(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof bp?e.walk((e=>e.code===jg.code)):e;return r instanceof bp?new jg({cause:e,message:r.details}):jg.nodeMessage.test(n)?new jg({cause:e,message:e.details}):Ig.nodeMessage.test(n)?new Ig({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas}):Sg.nodeMessage.test(n)?new Sg({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas}):Pg.nodeMessage.test(n)?new Pg({cause:e,nonce:null==t?void 0:t.nonce}):Ug.nodeMessage.test(n)?new Ug({cause:e,nonce:null==t?void 0:t.nonce}):Og.nodeMessage.test(n)?new Og({cause:e,nonce:null==t?void 0:t.nonce}):Ng.nodeMessage.test(n)?new Ng({cause:e}):Tg.nodeMessage.test(n)?new Tg({cause:e,gas:null==t?void 0:t.gas}):Mg.nodeMessage.test(n)?new Mg({cause:e,gas:null==t?void 0:t.gas}):Rg.nodeMessage.test(n)?new Rg({cause:e}):_g.nodeMessage.test(n)?new _g({cause:e,maxFeePerGas:null==t?void 0:t.maxFeePerGas,maxPriorityFeePerGas:null==t?void 0:t.maxPriorityFeePerGas}):new zg({cause:e})}function Ey(e,{format:t}){if(!t)return{};const n={};return function t(r){const o=Object.keys(r);for(const a of o)a in e&&(n[a]=e[a]),r[a]&&"object"==typeof r[a]&&!Array.isArray(r[a])&&t(r[a])}(t(e||{})),n}function By(e,t){return({exclude:n,format:r})=>({exclude:n,format:e=>{const o=t(e);if(n)for(const t of n)delete o[t];return{...o,...r(e)}},type:e})}const Fy={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function Dy(e){const t={};return void 0!==e.accessList&&(t.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?t.blobs=e.blobs.map((e=>Qp(e))):t.blobs=e.blobs),void 0!==e.data&&(t.data=e.data),void 0!==e.from&&(t.from=e.from),void 0!==e.gas&&(t.gas=Hp(e.gas)),void 0!==e.gasPrice&&(t.gasPrice=Hp(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=Hp(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=Hp(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=Hp(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(t.nonce=Hp(e.nonce)),void 0!==e.to&&(t.to=e.to),void 0!==e.type&&(t.type=Fy[e.type]),void 0!==e.value&&(t.value=Hp(e.value)),t}function xy(e,t,n){const r=e[t.name];if("function"==typeof r)return r;const o=e[n];return"function"==typeof o?o:n=>t(e,n)}function ky(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:a}=e,u=t?yg(t):void 0;if(u&&!ag(u.address))throw new wm({address:u.address});if(a&&!ag(a))throw new wm({address:a});if(void 0!==n&&(void 0!==r||void 0!==o))throw new qg;if(r&&r>2n**256n-1n)throw new Ig({maxFeePerGas:r});if(o&&r&&o>r)throw new _g({maxFeePerGas:r,maxPriorityFeePerGas:o})}async function jy(e){return _p(await e.request({method:"eth_chainId"},{dedupe:!0}))}class Iy extends bp{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class Sy extends bp{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class Py extends bp{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${kg(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class Uy extends bp{constructor({blockHash:e,blockNumber:t}){let n="Block";e&&(n=`Block at hash "${e}"`),t&&(n=`Block at number "${t}"`),super(`${n} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}const Oy={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function Ny(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?_p(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?_p(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Oy[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}const Ty=By("transaction",Ny);function My(e){var t;const n=null==(t=e.transactions)?void 0:t.map((e=>"string"==typeof e?e:Ny(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Ry=By("block",My);async function _y(e,{blockHash:t,blockNumber:n,blockTag:r,includeTransactions:o}={}){var a,u,i;const s=r??"latest",l=o??!1,c=void 0!==n?Hp(n):void 0;let d=null;if(d=t?await e.request({method:"eth_getBlockByHash",params:[t,l]},{dedupe:!0}):await e.request({method:"eth_getBlockByNumber",params:[c||s,l]},{dedupe:Boolean(c)}),!d)throw new Uy({blockHash:t,blockNumber:n});return((null==(i=null==(u=null==(a=e.chain)?void 0:a.formatters)?void 0:u.block)?void 0:i.format)||My)(d)}async function zy(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Ly(e,t){var n,r,o;const{block:a,chain:u=e.chain,request:i}=t||{};if("function"==typeof(null==(n=null==u?void 0:u.fees)?void 0:n.defaultPriorityFee)){const t=a||await xy(e,_y,"getBlock")({});return u.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==(null==(r=null==u?void 0:u.fees)?void 0:r.defaultPriorityFee))return null==(o=null==u?void 0:u.fees)?void 0:o.defaultPriorityFee;try{return Rp(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([a?Promise.resolve(a):xy(e,_y,"getBlock")({}),xy(e,zy,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new Sy;const r=n-t.baseFeePerGas;return r<0n?0n:r}}async function Wy(e,t){var n,r;const{block:o,chain:a=e.chain,request:u,type:i="eip1559"}=t||{},s=await(async()=>{var t,n;return"function"==typeof(null==(t=null==a?void 0:a.fees)?void 0:t.baseFeeMultiplier)?a.fees.baseFeeMultiplier({block:o,client:e,request:u}):(null==(n=null==a?void 0:a.fees)?void 0:n.baseFeeMultiplier)??1.2})();if(s<1)throw new Iy;const l=10**((null==(n=s.toString().split(".")[1])?void 0:n.length)??0),c=e=>e*BigInt(Math.ceil(s*l))/BigInt(l),d=o||await xy(e,_y,"getBlock")({});if("function"==typeof(null==(r=null==a?void 0:a.fees)?void 0:r.estimateFeesPerGas)){const t=await a.fees.estimateFeesPerGas({block:o,client:e,multiply:c,request:u,type:i});if(null!==t)return t}if("eip1559"===i){if("bigint"!=typeof d.baseFeePerGas)throw new Sy;const t="bigint"==typeof(null==u?void 0:u.maxPriorityFeePerGas)?u.maxPriorityFeePerGas:await Ly(e,{block:d,chain:a,request:u}),n=c(d.baseFeePerGas);return{maxFeePerGas:(null==u?void 0:u.maxFeePerGas)??n+t,maxPriorityFeePerGas:t}}return{gasPrice:(null==u?void 0:u.gasPrice)??c(await xy(e,zy,"getGasPrice")({}))}}class qy extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d}){var f;const h=Wg({from:null==t?void 0:t.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(f=null==r?void 0:r.nativeCurrency)?void 0:f.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}class Qy extends bp{constructor({address:e}){super(`State for account "${e}" is set multiple times.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountStateConflictError"})}}class Hy extends bp{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function Vy(e){return e.reduce(((e,{slot:t,value:n})=>`${e} ${t}: ${n}\n`),"")}function $y(e){if(e&&0!==e.length)return e.reduce(((e,{slot:t,value:n})=>{if(66!==t.length)throw new Fp({size:t.length,targetSize:66,type:"hex"});if(66!==n.length)throw new Fp({size:n.length,targetSize:66,type:"hex"});return e[t]=n,e}),{})}function Gy(e){const{balance:t,nonce:n,state:r,stateDiff:o,code:a}=e,u={};if(void 0!==a&&(u.code=a),void 0!==t&&(u.balance=Hp(t)),void 0!==n&&(u.nonce=Hp(n)),void 0!==r&&(u.state=$y(r)),void 0!==o){if(u.state)throw new Hy;u.stateDiff=$y(o)}return u}function Ky(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ag(n,{strict:!1}))throw new wm({address:n});if(t[n])throw new Qy({address:n});t[n]=Gy(r)}return t}async function Jy(e,t){var n,r,o;const a=t.account??e.account,u=a?yg(a):void 0;try{const{accessList:a,blobs:i,blobVersionedHashes:s,blockNumber:l,blockTag:c,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:g,nonce:y,to:b,value:v,stateOverride:w,...A}=await kb(e,{...t,parameters:"local"===(null==u?void 0:u.type)?void 0:["blobVersionedHashes"]}),C=(l?Hp(l):void 0)||c,E=Ky(w);ky(t);const B=null==(o=null==(r=null==(n=e.chain)?void 0:n.formatters)?void 0:r.transactionRequest)?void 0:o.format,F=(B||Dy)({...Ey(A,{format:B}),from:null==u?void 0:u.address,accessList:a,blobs:i,blobVersionedHashes:s,data:d,gas:f,gasPrice:h,maxFeePerBlobGas:p,maxFeePerGas:m,maxPriorityFeePerGas:g,nonce:y,to:b,value:v}),D=await e.request({method:"eth_estimateGas",params:E?[F,C??"latest",E]:C?[F,C]:[F]});return BigInt(D)}catch(i){throw function(e,{docsPath:t,...n}){const r=(()=>{const t=Cy(e,n);return t instanceof zg?e:t})();return new qy(r,{docsPath:t,...n})}(i,{...t,account:u,chain:e.chain})}}async function Yy(e,{address:t,blockTag:n="latest",blockNumber:r}){return _p(await e.request({method:"eth_getTransactionCount",params:[t,r?Hp(r):n]},{dedupe:Boolean(r)}))}function Zy(e){const{kzg:t}=e,n=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),r="string"==typeof e.blobs[0]?e.blobs.map((e=>Np(e))):e.blobs,o=[];for(const a of r)o.push(Uint8Array.from(t.blobToKzgCommitment(a)));return"bytes"===n?o:o.map((e=>Qp(e)))}function Xy(e){const{kzg:t}=e,n=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),r="string"==typeof e.blobs[0]?e.blobs.map((e=>Np(e))):e.blobs,o="string"==typeof e.commitments[0]?e.commitments.map((e=>Np(e))):e.commitments,a=[];for(let u=0;uQp(e)))}class eb extends Nm{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Pm(this.buffer)}update(e){Bm(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=Om(e)).length;for(let a=0;ar-a&&(this.process(n,0),a=0);for(let c=a;c>o&a),i=Number(n&a),s=r?4:0,l=r?0:4;e.setUint32(t+s,u,r),e.setUint32(t+l,i,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const u=Pm(e),i=this.outputLen;if(i%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const s=i/4,l=this.get();if(s>l.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;ce&t^~e&n,nb=(e,t,n)=>e&t^e&n^t&n,rb=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ob=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ab=new Uint32Array(64);class ub extends eb{constructor(){super(64,32,8,!1),this.A=0|ob[0],this.B=0|ob[1],this.C=0|ob[2],this.D=0|ob[3],this.E=0|ob[4],this.F=0|ob[5],this.G=0|ob[6],this.H=0|ob[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:a,G:u,H:i}=this;return[e,t,n,r,o,a,u,i]}set(e,t,n,r,o,a,u,i){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|a,this.G=0|u,this.H=0|i}process(e,t){for(let c=0;c<16;c++,t+=4)ab[c]=e.getUint32(t,!1);for(let c=16;c<64;c++){const e=ab[c-15],t=ab[c-2],n=Um(e,7)^Um(e,18)^e>>>3,r=Um(t,17)^Um(t,19)^t>>>10;ab[c]=r+ab[c-7]+n+ab[c-16]|0}let{A:n,B:r,C:o,D:a,E:u,F:i,G:s,H:l}=this;for(let c=0;c<64;c++){const e=l+(Um(u,6)^Um(u,11)^Um(u,25))+tb(u,i,s)+rb[c]+ab[c]|0,t=(Um(n,2)^Um(n,13)^Um(n,22))+nb(n,r,o)|0;l=s,s=i,i=u,u=a+e|0,a=o,o=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,a=a+this.D|0,u=u+this.E|0,i=i+this.F|0,s=s+this.G|0,l=l+this.H|0,this.set(n,r,o,a,u,i,s,l)}roundClean(){ab.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ib=Tm((()=>new ub));function sb(e,t){const n=t||"hex",r=ib(kp(e,{strict:!1})?Pp(e):e);return"bytes"===n?r:Wp(r)}function lb(e){const{commitment:t,version:n=1}=e,r=e.to??("string"==typeof t?"hex":"bytes"),o=sb(t,"bytes");return o.set([n],0),"bytes"===r?o:Qp(o)}function cb(e){const{commitments:t,version:n}=e,r=e.to??("string"==typeof t[0]?"hex":"bytes"),o=[];for(const a of t)o.push(lb({commitment:a,to:r,version:n}));return o}const db=32,fb=4096,hb=db*fb,pb=6*hb-1-1*fb*6,mb=1;class gb extends bp{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class yb extends bp{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}class bb extends bp{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashSizeError"})}}class vb extends bp{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${mb}`,`Received: ${t}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidVersionedHashVersionError"})}}class wb extends bp{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class Ab extends bp{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class Cb extends bp{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const Eb={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Cb({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Ab({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new wb({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new wb({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Bb(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Eb);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function Fb(e){const{data:t,kzg:n,to:r}=e,o=e.blobs??function(e){const t=e.to??("string"==typeof e.data?"hex":"bytes"),n="string"==typeof e.data?Np(e.data):e.data,r=jp(n);if(!r)throw new yb;if(r>pb)throw new gb({maxSize:pb,size:r});const o=[];let a=!0,u=0;for(;a;){const e=Bb(new Uint8Array(hb));let t=0;for(;te.bytes)):o.map((e=>Qp(e.bytes)))}({data:t,to:r}),a=e.commitments??Zy({blobs:o,kzg:n,to:r}),u=e.proofs??Xy({blobs:o,commitments:a,kzg:n,to:r}),i=[];for(let s=0;s{const t=Cy(e,n);return t instanceof zg?e:t})();return new $g(r,{docsPath:t,...n})}(A,{...t,account:w,chain:t.chain||void 0})}}const Sb=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Pb=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Ub=[...Pb,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Ob=[...Pb,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Nb=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Tb=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],Mb=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}];function Rb(e,t={}){void 0!==t.size&&Mp(e,{size:t.size});return Rp(Qp(e,t),t)}function _b(e,t={}){let n=e;if(void 0!==t.size&&(Mp(n,{size:t.size}),n=Ip(n)),n.length>1||n[0]>1)throw new Ap(n);return Boolean(n[0])}function zb(e,t={}){void 0!==t.size&&Mp(e,{size:t.size});return _p(Qp(e,t),t)}function Lb(e,t){const n="string"==typeof t?Np(t):t,r=Bb(n);if(0===jp(n)&&e.length>0)throw new Xp;if(jp(t)&&jp(t)<32)throw new Zp({data:"string"==typeof t?t:Qp(t),params:e,size:jp(t)});let o=0;const a=[];for(let u=0;u!e)),o=r?[]:{};let a=0;if(Hb(t)){const u=n+zb(e.readBytes(Qb));for(let n=0;n48?Rb(o,{signed:n}):zb(o,{signed:n}),32]}(e,t);if("string"===t.type)return function(e,{staticPosition:t}){const n=zb(e.readBytes(32)),r=t+n;e.setPosition(r);const o=zb(e.readBytes(32));if(0===o)return e.setPosition(t+32),["",32];const a=e.readBytes(o,32),u=function(e,t={}){let n=e;return void 0!==t.size&&(Mp(n,{size:t.size}),n=Ip(n,{dir:"right"})),(new TextDecoder).decode(n)}(Ip(a));return e.setPosition(t+32),[u,32]}(e,{staticPosition:n});throw new pm(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const qb=32,Qb=32;function Hb(e){var t;const{type:n}=e;if("string"===n)return!0;if("bytes"===n)return!0;if(n.endsWith("[]"))return!0;if("tuple"===n)return null==(t=e.components)?void 0:t.some(Hb);const r=pg(e.type);return!(!r||!Hb({...e,type:r[1]}))}const Vb=e=>Xm(Pp(e));let $b=class e extends Error{constructor(t,n={}){var r;const o=n.cause instanceof e?n.cause.details:(null==(r=n.cause)?void 0:r.message)?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath;super([t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: https://abitype.dev${a}`]:[],...o?[`Details: ${o}`]:[],"Version: abitype@1.0.4"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=o,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Gb(e,t){const n=e.exec(t);return null==n?void 0:n.groups}const Kb=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Jb=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Yb=/^\(.+?\).*?$/,Zb=/^tuple(?(\[(\d*)\])*)$/;function Xb(e){let t=e.type;if(Zb.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let o=0;o[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const nv=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const rv=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;const ov=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function av(e){return ov.test(e)}function uv(e){return Gb(ov,e)}const iv=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;const sv=/^fallback\(\) external(?:\s(?payable{1}))?$/;const lv=/^receive\(\) external payable$/;const cv=new Set(["indexed"]),dv=new Set(["calldata","memory","storage"]);class fv extends $b{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class hv extends $b{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class pv extends $b{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class mv extends $b{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class gv extends $b{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class yv extends $b{constructor({param:e,type:t,modifier:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${n}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class bv extends $b{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class vv extends $b{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class wv extends $b{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Av extends $b{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Cv extends $b{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Ev extends $b{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}const Bv=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Fv(e,t={}){if(function(e){return rv.test(e)}(e)){const n=function(e){return Gb(rv,e)}(e);if(!n)throw new vv({signature:e,type:"function"});const r=Iv(n.parameters),o=[],a=r.length;for(let e=0;e[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,xv=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,kv=/^u?int$/;function jv(e,t){var n,r;const o=function(e,t){return t?`${t}:${e}`:e}(e,null==t?void 0:t.type);if(Bv.has(o))return Bv.get(o);const a=Yb.test(e),u=Gb(a?xv:Dv,e);if(!u)throw new pv({param:e});if(u.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||Kb.test(e)||Jb.test(e)||Pv.test(e)}(u.name))throw new mv({param:e,name:u.name});const i=u.name?{name:u.name}:{},s="indexed"===u.modifier?{indexed:!0}:{},l=(null==t?void 0:t.structs)??{};let c,d={};if(a){c="tuple";const e=Iv(u.type),t=[],n=e.length;for(let r=0;r[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function Ov(e,t,n=new Set){const r=[],o=e.length;for(let a=0;a{var t;return function(e){let t=!0,n="",r=0,o="",a=!1;for(let u=0;uug(Mv(e),0,4);function zv(e){const{abi:t,args:n=[],name:r}=e,o=kp(r,{strict:!1}),a=t.filter((e=>o?"function"===e.type?_v(e)===r:"event"===e.type&&Rv(e)===r:"name"in e&&e.name===r));if(0===a.length)return;if(1===a.length)return a[0];let u;for(const i of a){if(!("inputs"in i))continue;if(!n||0===n.length){if(!i.inputs||0===i.inputs.length)return i;continue}if(!i.inputs)continue;if(0===i.inputs.length)continue;if(i.inputs.length!==n.length)continue;if(n.every(((e,t)=>{const n="inputs"in i&&i.inputs[t];return!!n&&Lv(e,n)}))){if(u&&"inputs"in u&&u.inputs){const e=Wv(i.inputs,u.inputs,n);if(e)throw new lm({abiItem:i,type:e[0]},{abiItem:u,type:e[1]})}u=i}}return u||a[0]}function Lv(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ag(e,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:return"tuple"===r&&"components"in t?Object.values(t.components).every(((t,n)=>Lv(Object.values(e)[n],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?"number"===n||"bigint"===n:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?"string"===n||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)&&(Array.isArray(e)&&e.every((e=>Lv(e,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function Wv(e,t,n){for(const r in e){const o=e[r],a=t[r];if("tuple"===o.type&&"tuple"===a.type&&"components"in o&&"components"in a)return Wv(o.components,a.components,n[r]);const u=[o.type,a.type];if(!(!u.includes("address")||!u.includes("bytes20"))||(u.includes("address")&&u.includes("string")||!(!u.includes("address")||!u.includes("bytes")))&&ag(n[r],{strict:!1}))return u}}const qv="/docs/contract/decodeFunctionResult";function Qv(e){const{abi:t,args:n,functionName:r,data:o}=e;let a=t[0];if(r){const e=zv({abi:t,args:n,name:r});if(!e)throw new im(r,{docsPath:qv});a=e}if("function"!==a.type)throw new im(void 0,{docsPath:qv});if(!a.outputs)throw new sm(a.name,{docsPath:qv});const u=Lb(a.outputs,o);return u&&u.length>1?u:u&&1===u.length?u[0]:void 0}const Hv="/docs/contract/encodeFunctionData";function Vv(e){const{args:t}=e,{abi:n,functionName:r}=1===e.abi.length&&(null==(o=e.functionName)?void 0:o.startsWith("0x"))?e:function(e){const{abi:t,args:n,functionName:r}=e;let o=t[0];if(r){const e=zv({abi:t,args:n,name:r});if(!e)throw new im(r,{docsPath:Hv});o=e}if("function"!==o.type)throw new im(void 0,{docsPath:Hv});return{abi:[o],functionName:_v(Gp(o))}}(e);var o;const a=n[0];return vm([r,("inputs"in a&&a.inputs?dg(a.inputs,t??[]):void 0)??"0x"])}function $v({blockNumber:e,chain:t,contract:n}){var r;const o=null==(r=null==t?void 0:t.contracts)?void 0:r[n];if(!o)throw new vg({chain:t,contract:{name:n}});if(e&&o.blockCreated&&o.blockCreated>e)throw new vg({blockNumber:e,chain:t,contract:{name:n,blockCreated:o.blockCreated}});return o.address}const Gv={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Kv={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Jv={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Yv(e){const{abi:t,data:n}=e,r=ug(n,0,4);if("0x"===r)throw new Xp;const o=[...t||[],Kv,Jv].find((e=>"error"===e.type&&r===_v(Gp(e))));if(!o)throw new rm(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Lb(o.inputs,ug(n,4)):void 0,errorName:o.name}}function Zv({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map(((e,n)=>`${r&&e.name?`${e.name}: `:""}${"object"==typeof t[n]?Yg(t[n]):t[n]}`)).join(", ")})`}class Xv extends bp{constructor(e,{account:t,docsPath:n,chain:r,data:o,gas:a,gasPrice:u,maxFeePerGas:i,maxPriorityFeePerGas:s,nonce:l,to:c,value:d,stateOverride:f}){var h;const p=t?yg(t):void 0;let m=Wg({from:null==p?void 0:p.address,to:c,value:void 0!==d&&`${Lg(d)} ${(null==(h=null==r?void 0:r.nativeCurrency)?void 0:h.symbol)||"ETH"}`,data:o,gas:a,gasPrice:void 0!==u&&`${kg(u)} gwei`,maxFeePerGas:void 0!==i&&`${kg(i)} gwei`,maxPriorityFeePerGas:void 0!==s&&`${kg(s)} gwei`,nonce:l});f&&(m+=`\n${function(e){return e.reduce(((e,{address:t,...n})=>{let r=`${e} ${t}:\n`;return n.nonce&&(r+=` nonce: ${n.nonce}\n`),n.balance&&(r+=` balance: ${n.balance}\n`),n.code&&(r+=` code: ${n.code}\n`),n.state&&(r+=" state:\n",r+=Vy(n.state)),n.stateDiff&&(r+=" stateDiff:\n",r+=Vy(n.stateDiff)),r})," State Override:\n").slice(0,-1)}(f)}`),super(e.shortMessage,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}}class ew extends bp{constructor(e,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:a,sender:u}){const i=zv({abi:t,args:n,name:a}),s=i?Zv({abiItem:i,args:n,includeFunctionName:!1,includeName:!1}):void 0,l=Wg({address:r&&r,function:i?Gp(i,{includeName:!0}):void 0,args:s&&"()"!==s&&`${[...Array((null==a?void 0:a.length)??0).keys()].map((()=>" ")).join("")}${s}`,sender:u});super(e.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:e,docsPath:o,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",l].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=n,this.cause=e,this.contractAddress=r,this.functionName=a,this.sender=u}}class tw extends bp{constructor({abi:e,data:t,functionName:n,message:r}){let o,a,u,i,s;if(t&&"0x"!==t)try{a=Yv({abi:e,data:t});const{abiItem:n,errorName:r,args:o}=a;if("Error"===r)i=o[0];else if("Panic"===r){const[e]=o;i=Gv[e]}else{const e=n?Gp(n,{includeName:!0}):void 0,t=n&&o?Zv({abiItem:n,args:o,includeFunctionName:!1,includeName:!1}):void 0;u=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array((null==r?void 0:r.length)??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(l){o=l}else r&&(i=r);o instanceof rm&&(s=o.signature,u=[`Unable to decode signature "${s}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${s}.`]),super(i&&"execution reverted"!==i||s?[`The contract function "${n}" reverted with the following ${s?"signature":"reason"}:`,i||s].join("\n"):`The contract function "${n}" reverted.`,{cause:o,metaMessages:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.reason=i,this.signature=s}}class nw extends bp{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}}class rw extends bp{constructor({factory:e}){super("Deployment for counterfactual contract call failed"+(e?` for factory "${e}".`:""),{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CounterfactualDeploymentFailedError"})}}class ow extends bp{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}function aw(e,t){var n,r,o,a,u,i;if(!(e instanceof bp))return!1;const s=e.walk((e=>e instanceof tw));return s instanceof tw&&("ResolverNotFound"===(null==(n=s.data)?void 0:n.errorName)||("ResolverWildcardNotSupported"===(null==(r=s.data)?void 0:r.errorName)||("ResolverNotContract"===(null==(o=s.data)?void 0:o.errorName)||("ResolverError"===(null==(a=s.data)?void 0:a.errorName)||("HttpError"===(null==(u=s.data)?void 0:u.errorName)||(!!(null==(i=s.reason)?void 0:i.includes("Wildcard on non-extended resolvers is not supported"))||"reverse"===t&&s.reason===Gv[50]))))))}function uw(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return kp(t)?t:null}function iw(e){let t=new Uint8Array(32).fill(0);if(!e)return Qp(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const e=uw(n[r]),o=e?Pp(e):Xm(Tp(n[r]),"bytes");t=Xm(bm([t,o]),"bytes")}return Qp(t)}function sw(e){const t=new Uint8Array(32).fill(0);return e?uw(e)||Xm(Tp(e)):Qp(t)}function lw(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const n=new Uint8Array(Tp(t).byteLength+2);let r=0;const o=t.split(".");for(let a=0;a255&&(e=Tp(`[${sw(o[a]).slice(2)}]`)),n[r]=e.length,n.set(e,r+1),r+=e.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}const cw=3;function dw(e,{abi:t,address:n,args:r,docsPath:o,functionName:a,sender:u}){const{code:i,data:s,message:l,shortMessage:c}=e instanceof ow?e:e instanceof bp?e.walk((e=>"data"in e))||e.walk():{},d=e instanceof Xp?new nw({functionName:a}):[cw,iy.code].includes(i)&&(s||l||c)?new tw({abi:t,data:"object"==typeof s?s.data:s,functionName:a,message:c??l}):e;return new ew(d,{abi:t,args:r,contractAddress:n,docsPath:o,functionName:a,sender:u})}const fw="0x82ad56cb",hw="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",pw="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",mw="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";const gw=new Map;function yw({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){const a=async()=>{const t=i();u();const n=t.map((({args:e})=>e));0!==n.length&&e(n).then((e=>{var n;o&&Array.isArray(e)&&e.sort(o);for(let r=0;r{var n;for(let r=0;rgw.delete(t),i=()=>gw.get(t)||[],s=e=>gw.set(t,[...i(),e]);return{flush:u,async schedule(e){const t={},o=new Promise(((e,n)=>{t.resolve=e,t.reject=n}));(null==n?void 0:n([...i().map((({args:e})=>e)),e]))&&a();return i().length>0?(s({args:e,pendingPromise:t}),o):(s({args:e,pendingPromise:t}),setTimeout(a,r),o)}}}async function bw(e,t){var n,r,o,a;const{account:u=e.account,batch:i=Boolean(null==(n=e.batch)?void 0:n.multicall),blockNumber:s,blockTag:l="latest",accessList:c,blobs:d,code:f,data:h,factory:p,factoryData:m,gas:g,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:v,maxPriorityFeePerGas:w,nonce:A,to:C,value:E,stateOverride:B,...F}=t,D=u?yg(u):void 0;if(f&&(p||m))throw new bp("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(f&&C)throw new bp("Cannot provide both `code` & `to` as parameters.");const x=f&&h,k=p&&m&&C&&h,j=x||k,I=x?function(e){const{code:t,data:n}=e;return gg({abi:Nv(["constructor(bytes, bytes)"]),bytecode:hw,args:[t,n]})}({code:f,data:h}):k?function(e){const{data:t,factory:n,factoryData:r,to:o}=e;return gg({abi:Nv(["constructor(address, bytes, address, bytes)"]),bytecode:pw,args:[o,t,n,r]})}({data:h,factory:p,factoryData:m,to:C}):h;try{ky(t);const n=(s?Hp(s):void 0)||l,u=Ky(B),f=null==(a=null==(o=null==(r=e.chain)?void 0:r.formatters)?void 0:o.transactionRequest)?void 0:a.format,h=(f||Dy)({...Ey(F,{format:f}),from:null==D?void 0:D.address,accessList:c,blobs:d,data:I,gas:g,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:v,maxPriorityFeePerGas:w,nonce:A,to:j?void 0:C,value:E});if(i&&function({request:e}){const{data:t,to:n,...r}=e;return!!t&&(!t.startsWith(fw)&&(!!n&&!(Object.values(r).filter((e=>void 0!==e)).length>0)))}({request:h})&&!u)try{return await async function(e,t){var n;const{batchSize:r=1024,wait:o=0}="object"==typeof(null==(n=e.batch)?void 0:n.multicall)?e.batch.multicall:{},{blockNumber:a,blockTag:u="latest",data:i,multicallAddress:s,to:l}=t;let c=s;if(!c){if(!e.chain)throw new Cg;c=$v({blockNumber:a,chain:e.chain,contract:"multicall3"})}const d=a?Hp(a):void 0,f=d||u,{schedule:h}=yw({id:`${e.uid}.${f}`,wait:o,shouldSplitBatch:e=>e.reduce(((e,{data:t})=>e+(t.length-2)),0)>2*r,fn:async t=>{const n=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),r=Vv({abi:Sb,args:[n],functionName:"aggregate3"}),o=await e.request({method:"eth_call",params:[{data:r,to:c},f]});return Qv({abi:Sb,args:[n],functionName:"aggregate3",data:o||"0x"})}}),[{returnData:p,success:m}]=await h({data:i,to:l});if(!m)throw new ow({data:p});return"0x"===p?{data:void 0}:{data:p}}(e,{...h,blockNumber:s,blockTag:l})}catch(S){if(!(S instanceof Cg||S instanceof vg))throw S}const p=await e.request({method:"eth_call",params:u?[h,n,u]:[h,n]});return"0x"===p?{data:void 0}:{data:p}}catch(S){const n=function(e){var t;if(!(e instanceof bp))return;const n=e.walk();return"object"==typeof(null==n?void 0:n.data)?null==(t=n.data)?void 0:t.data:n.data}(S),{offchainLookup:r,offchainLookupSignature:o}=await ep((async()=>{const{offchainLookup:e,offchainLookupSignature:t}=await import("./ccip-DV9665T2.js");return{offchainLookup:e,offchainLookupSignature:t}}),[]);if(!1!==e.ccipRead&&(null==n?void 0:n.slice(0,10))===o&&C)return{data:await r(e,{data:n,to:C})};if(j&&"0x101bb98d"===(null==n?void 0:n.slice(0,10)))throw new rw({factory:p});throw function(e,{docsPath:t,...n}){const r=(()=>{const t=Cy(e,n);return t instanceof zg?e:t})();return new Xv(r,{docsPath:t,...n})}(S,{...t,account:D,chain:e.chain})}}async function vw(e,t){const{abi:n,address:r,args:o,functionName:a,...u}=t,i=Vv({abi:n,args:o,functionName:a});try{const{data:t}=await xy(e,bw,"call")({...u,data:i,to:r});return Qv({abi:n,args:o,functionName:a,data:t||"0x"})}catch(s){throw dw(s,{abi:n,address:r,args:o,docsPath:"/docs/contract/readContract",functionName:a})}}class ww extends bp{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class Aw extends bp{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class Cw extends bp{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Ew extends bp{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const Bw=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,Fw=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,Dw=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,xw=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function kw(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function jw({uri:e,gatewayUrls:t}){const n=Dw.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=kw(null==t?void 0:t.ipfs,"https://ipfs.io"),o=kw(null==t?void 0:t.arweave,"https://arweave.net"),a=e.match(Bw),{protocol:u,subpath:i,target:s,subtarget:l=""}=(null==a?void 0:a.groups)||{},c="ipns:/"===u||"ipns/"===i,d="ipfs:/"===u||"ipfs/"===i||Fw.test(e);if(e.startsWith("http")&&!c&&!d){let n=e;return(null==t?void 0:t.arweave)&&(n=e.replace(/https:\/\/arweave.net/g,null==t?void 0:t.arweave)),{uri:n,isOnChain:!1,isEncoded:!1}}if((c||d)&&s)return{uri:`${r}/${c?"ipns":"ipfs"}/${s}${l}`,isOnChain:!1,isEncoded:!1};if("ar:/"===u&&s)return{uri:`${o}/${s}${l||""}`,isOnChain:!1,isEncoded:!1};let f=e.replace(xw,"");if(f.startsWith("{const n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=e}))}}(n);if(o)return n;throw new Cw({uri:t})}async function Pw(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?async function(e,{gatewayUrls:t,record:n}){const r=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,o]=t.split("/"),[a,u]=n.split(":"),[i,s]=r.split(":");if(!a||"eip155"!==a.toLowerCase())throw new Aw({reason:"Only EIP-155 supported"});if(!u)throw new Aw({reason:"Chain ID not found"});if(!s)throw new Aw({reason:"Contract address not found"});if(!o)throw new Aw({reason:"Token ID not found"});if(!i)throw new Aw({reason:"ERC namespace not found"});return{chainID:Number.parseInt(u),namespace:i.toLowerCase(),contractAddress:s,tokenID:o}}(n),o=await async function(e,{nft:t}){if("erc721"===t.namespace)return vw(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return vw(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Ew({namespace:t.namespace})}(e,{nft:r}),{uri:a,isOnChain:u,isEncoded:i}=jw({uri:o,gatewayUrls:t});if(u&&(a.includes("data:application/json;base64,")||a.startsWith("{"))){const e=i?atob(a.replace("data:application/json;base64,","")):a;return Sw({uri:Iw(JSON.parse(e)),gatewayUrls:t})}let s=r.tokenID;"erc1155"===r.namespace&&(s=s.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then((e=>e.json()));return await Sw({gatewayUrls:e,uri:Iw(n)})}catch{throw new Cw({uri:t})}}({gatewayUrls:t,uri:a.replace(/(?:0x)?{id}/,s)})}(e,{gatewayUrls:t,record:n}):Sw({uri:n,gatewayUrls:t})}async function Uw(e,{blockNumber:t,blockTag:n,name:r,key:o,gatewayUrls:a,strict:u,universalResolverAddress:i}){let s=i;if(!s){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=$v({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const u={address:s,abi:Ub,functionName:"resolve",args:[Wp(lw(r)),Vv({abi:Nb,functionName:"text",args:[iw(r),o]})],blockNumber:t,blockTag:n},i=xy(e,vw,"readContract"),l=a?await i({...u,args:[...u.args,a]}):await i(u);if("0x"===l[0])return null;const c=Qv({abi:Nb,functionName:"text",data:l[0]});return""===c?null:c}catch(l){if(u)throw l;if(aw(l,"resolve"))return null;throw l}}async function Ow(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:a,strict:u,universalResolverAddress:i}){const s=await xy(e,Uw,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:i,gatewayUrls:a,strict:u});if(!s)return null;try{return await Pw(e,{record:s,gatewayUrls:r})}catch{return null}}async function Nw(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:o,strict:a,universalResolverAddress:u}){let i=u;if(!i){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");i=$v({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const s=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const a={address:i,abi:Ob,functionName:"reverse",args:[Wp(lw(s))],blockNumber:n,blockTag:r},u=xy(e,vw,"readContract"),[l,c]=o?await u({...a,args:[...a.args,o]}):await u(a);return t.toLowerCase()!==c.toLowerCase()?null:l}catch(l){if(a)throw l;if(aw(l,"reverse"))return null;throw l}}function Tw(e,{method:t}){var n,r;const o={};return"fallback"===e.transport.type&&(null==(r=(n=e.transport).onResponse)||r.call(n,(({method:e,response:n,status:r,transport:a})=>{"success"===r&&t===e&&(o[n]=a.request)}))),t=>o[t]||e.request}class Mw extends bp{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}const Rw="/docs/contract/encodeEventTopics";function _w(e){var t;const{abi:n,eventName:r,args:o}=e;let a=n[0];if(r){const e=zv({abi:n,name:r});if(!e)throw new um(r,{docsPath:Rw});a=e}if("event"!==a.type)throw new um(void 0,{docsPath:Rw});const u=Gp(a),i=Rv(u);let s=[];if(o&&"inputs"in a){const e=null==(t=a.inputs)?void 0:t.filter((e=>"indexed"in e&&e.indexed)),n=Array.isArray(o)?o:Object.values(o).length>0?(null==e?void 0:e.map((e=>o[e.name])))??[]:[];n.length>0&&(s=(null==e?void 0:e.map(((e,t)=>Array.isArray(n[t])?n[t].map(((r,o)=>zw({param:e,value:n[t][o]}))):n[t]?zw({param:e,value:n[t]}):null)))??[])}return[i,...s]}function zw({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return Xm(Pp(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Mw(e.type);return dg([e],[t])}async function Lw(e,t){const{address:n,abi:r,args:o,eventName:a,fromBlock:u,strict:i,toBlock:s}=t,l=Tw(e,{method:"eth_newFilter"}),c=a?_w({abi:r,args:o,eventName:a}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:"bigint"==typeof u?Hp(u):u,toBlock:"bigint"==typeof s?Hp(s):s,topics:c}]});return{abi:r,args:o,eventName:a,id:d,request:l(d),strict:Boolean(i),type:"event"}}async function Ww(e,{address:t,args:n,event:r,events:o,fromBlock:a,strict:u,toBlock:i}={}){const s=o??(r?[r]:void 0),l=Tw(e,{method:"eth_newFilter"});let c=[];if(s){c=[s.flatMap((e=>_w({abi:[e],eventName:e.name,args:n})))],r&&(c=c[0])}const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof a?Hp(a):a,toBlock:"bigint"==typeof i?Hp(i):i,...c.length?{topics:c}:{}}]});return{abi:s,args:n,eventName:r?r.name:void 0,fromBlock:a,id:d,request:l(d),strict:Boolean(u),toBlock:i,type:"event"}}async function qw(e){const t=Tw(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function Qw(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=n?Hp(n):void 0,a=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(a)}const Hw=new Map,Vw=new Map;async function $w(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:n=>t.set(e,n)}),n=t(e,Hw),r=t(e,Vw);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}(t),o=r.response.get();if(o&&n>0){if((new Date).getTime()-o.created.getTime()`blockNumber.${e}`;async function Kw(e,{cacheTime:t=e.cacheTime}={}){const n=await $w((()=>e.request({method:"eth_blockNumber"})),{cacheKey:Gw(e.uid),cacheTime:t});return BigInt(n)}async function Jw(e,{address:t,blockNumber:n,blockTag:r="latest"}){const o=void 0!==n?Hp(n):void 0,a=await e.request({method:"eth_getCode",params:[t,o||r]},{dedupe:Boolean(o)});if("0x"!==a)return a}const Yw="/docs/contract/decodeEventLog";function Zw(e){const{abi:t,data:n,strict:r,topics:o}=e,a=r??!0,[u,...i]=o;if(!u)throw new om({docsPath:Yw});const s=t.find((e=>"event"===e.type&&u===Rv(Gp(e))));if(!s||!("name"in s)||"event"!==s.type)throw new am(u,{docsPath:Yw});const{name:l,inputs:c}=s,d=null==c?void 0:c.some((e=>!("name"in e&&e.name)));let f=d?[]:{};const h=c.filter((e=>"indexed"in e&&e.indexed));for(let g=0;g!("indexed"in e&&e.indexed)));if(p.length>0)if(n&&"0x"!==n)try{const e=Lb(p,n);if(e)if(d)f=[...f,...e];else for(let t=0;t0?f:void 0}}function Xw({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(Lb([e],t)||[])[0]}function eA({abi:e,eventName:t,logs:n,strict:r=!0}){return n.map((n=>{var o;try{const o=Zw({...n,abi:e,strict:r});return t&&!t.includes(o.eventName)?null:{...o,...n}}catch(a){let e,t;if(a instanceof am)return null;if(a instanceof dm||a instanceof fm){if(r)return null;e=a.abiItem.name,t=null==(o=a.abiItem.inputs)?void 0:o.some((e=>!("name"in e&&e.name)))}return{...n,args:t?[]:{},eventName:e}}})).filter(Boolean)}function tA(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function nA(e,{address:t,blockHash:n,fromBlock:r,toBlock:o,event:a,events:u,args:i,strict:s}={}){const l=s??!1,c=u??(a?[a]:void 0);let d,f=[];if(c){f=[c.flatMap((e=>_w({abi:[e],eventName:e.name,args:i})))],a&&(f=f[0])}d=n?await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:n}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:"bigint"==typeof r?Hp(r):r,toBlock:"bigint"==typeof o?Hp(o):o}]});const h=d.map((e=>tA(e)));return c?eA({abi:c,logs:h,strict:l}):h}async function rA(e,t){const{abi:n,address:r,args:o,blockHash:a,eventName:u,fromBlock:i,toBlock:s,strict:l}=t,c=u?zv({abi:n,name:u}):void 0,d=c?void 0:n.filter((e=>"event"===e.type));return xy(e,nA,"getLogs")({address:r,args:o,blockHash:a,event:c,events:d,fromBlock:i,toBlock:s,strict:l})}class oA extends bp{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip712DomainNotFoundError"})}}const aA=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function uA(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:o}){const a=n?Hp(n):void 0;return function(e){var t;return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:null==(t=e.reward)?void 0:t.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[Hp(t),a||r,o]},{dedupe:Boolean(a)}))}async function iA(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof r[0])return r;const o=r.map((e=>tA(e)));return"abi"in t&&t.abi?eA({abi:t.abi,logs:o,strict:n}):o}async function sA(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:a}){var u,i,s;const l=r||"latest",c=void 0!==n?Hp(n):void 0;let d=null;if(o?d=await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Hp(a)]},{dedupe:!0}):(c||l)&&(d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[c||l,Hp(a)]},{dedupe:Boolean(c)})),!d)throw new Gg({blockHash:t,blockNumber:n,blockTag:l,hash:o,index:a});return((null==(s=null==(i=null==(u=e.chain)?void 0:u.formatters)?void 0:i.transaction)?void 0:s.format)||Ny)(d)}const lA={"0x0":"reverted","0x1":"success"};function cA(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>tA(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?_p(e.transactionIndex):null,status:e.status?lA[e.status]:null,type:e.type?Oy[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const dA=By("transactionReceipt",cA);async function fA(e,{hash:t}){var n,r,o;const a=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!a)throw new Kg({hash:t});return((null==(o=null==(r=null==(n=e.chain)?void 0:n.formatters)?void 0:r.transactionReceipt)?void 0:o.format)||cA)(a)}async function hA(e,t){var n;const{allowFailure:r=!0,batchSize:o,blockNumber:a,blockTag:u,multicallAddress:i,stateOverride:s}=t,l=t.contracts,c=o??("object"==typeof(null==(n=e.batch)?void 0:n.multicall)&&e.batch.multicall.batchSize||1024);let d=i;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=$v({blockNumber:a,chain:e.chain,contract:"multicall3"})}const f=[[]];let h=0,p=0;for(let b=0;b0&&p>c&&f[h].length>0&&(h++,p=(r.length-2)/2,f[h]=[]),f[h]=[...f[h],{allowFailure:!0,callData:r,target:t}]}catch(y){const a=dw(y,{abi:e,address:t,args:n,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;f[h]=[...f[h],{allowFailure:!0,callData:"0x",target:t}]}}const m=await Promise.allSettled(f.map((t=>xy(e,vw,"readContract")({abi:Sb,address:d,args:[t],blockNumber:a,blockTag:u,functionName:"aggregate3",stateOverride:s})))),g=[];for(let b=0;bpA.get(e)||[],a=()=>{const t=mA.get(e);1===o().length&&t&&t(),(()=>{const t=o();pA.set(e,t.filter((e=>e.id!==r)))})()},u=o();if(pA.set(e,[...u,{id:r,fns:t}]),u&&u.length>0)return a;const i={};for(const l in t)i[l]=(...e)=>{var t,n;const r=o();if(0!==r.length)for(const o of r)null==(n=(t=o.fns)[l])||n.call(t,...e)};const s=n(i);return"function"==typeof s&&mA.set(e,s),a}async function bA(e){return new Promise((t=>setTimeout(t,e)))}function vA(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let o=!0;const a=()=>o=!1;return(async()=>{let u;t&&(u=await e({unpoll:a}));const i=await(null==n?void 0:n(u))??r;await bA(i);const s=async()=>{o&&(await e({unpoll:a}),await bA(r),s())};s()})(),a}function wA(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:a,pollingInterval:u=e.pollingInterval}){let i;return(void 0!==a?a:"webSocket"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type))?yA(Yg(["watchBlockNumber",e.uid,t,n,u]),{onBlockNumber:r,onError:o},(r=>vA((async()=>{var t;try{const t=await xy(e,Kw,"getBlockNumber")({cacheTime:0});if(i){if(t===i)return;if(t-i>1&&n)for(let e=i+1n;ei)&&(r.onBlockNumber(t,i),i=t)}catch(o){null==(t=r.onError)||t.call(r,o)}}),{emitOnBegin:t,interval:u}))):yA(Yg(["watchBlockNumber",e.uid,t,n]),{onBlockNumber:r,onError:o},(t=>{let n=!0,r=()=>n=!1;return(async()=>{try{const o=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find((e=>"webSocket"===e.config.type));return t?t.value:e.transport}return e.transport})(),{unsubscribe:a}=await o.subscribe({params:["newHeads"],onData(e){var r;if(!n)return;const o=Rp(null==(r=e.result)?void 0:r.number);t.onBlockNumber(o,i),i=o},onError(e){var n;null==(n=t.onError)||n.call(t,e)}});r=a,n||r()}catch(a){null==o||o(a)}})(),()=>r()}))}async function AA(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const CA=new Am(8192);function EA(e,{delay:t=100,retryCount:n=2,shouldRetry:r=(()=>!0)}={}){return new Promise(((o,a)=>{const u=async({count:i=0}={})=>{try{const t=await e();o(t)}catch(s){if(i{const n="function"==typeof t?t({count:i,error:e}):t;n&&await bA(n),u({count:i+1})})({error:s});a(s)}};u()}))}function BA(e,t={}){return async(n,r={})=>{const{dedupe:o=!1,retryDelay:a=150,retryCount:u=3,uid:i}={...t,...r};return function(e,{enabled:t=!0,id:n}){if(!t||!n)return e();if(CA.get(n))return CA.get(n);const r=e().finally((()=>CA.delete(n)));return CA.set(n,r),r}((()=>EA((async()=>{try{return await e(n)}catch(t){const e=t;switch(e.code){case ry.code:throw new ry(e);case oy.code:throw new oy(e);case ay.code:throw new ay(e);case uy.code:throw new uy(e);case iy.code:throw new iy(e);case sy.code:throw new sy(e);case ly.code:throw new ly(e);case cy.code:throw new cy(e);case dy.code:throw new dy(e);case fy.code:throw new fy(e);case hy.code:throw new hy(e);case py.code:throw new py(e);case my.code:throw new my(e);case gy.code:throw new gy(e);case yy.code:throw new yy(e);case by.code:throw new by(e);case vy.code:throw new vy(e);case wy.code:throw new wy(e);case 5e3:throw new my(e);default:if(t instanceof bp)throw t;throw new Ay(e)}}}),{delay:({count:e,error:t})=>{var n;if(t&&t instanceof Zg){const e=null==(n=null==t?void 0:t.headers)?void 0:n.get("Retry-After");if(null==e?void 0:e.match(/\d/))return 1e3*Number.parseInt(e)}return(1<function(e){if("code"in e&&"number"==typeof e.code)return-1===e.code||(e.code===hy.code||e.code===iy.code);if(e instanceof Zg&&e.status)return 403===e.status||(408===e.status||(413===e.status||(429===e.status||(500===e.status||(502===e.status||(503===e.status||504===e.status))))));return!0}(e)})),{enabled:o,id:o?Xm($p(`${i}.${Yg(n)}`)):void 0})}}function FA(e,t){if(!ag(e,{strict:!1}))throw new wm({address:e});if(!ag(t,{strict:!1}))throw new wm({address:t});return e.toLowerCase()===t.toLowerCase()}function DA(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const xA=/^(.*)\[([0-9]*)\]$/,kA=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,jA=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function IA(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise(((o,a)=>{(async()=>{let u;try{const i=new AbortController;n>0&&(u=setTimeout((()=>{r?i.abort():a(t)}),n)),o(await e({signal:(null==i?void 0:i.signal)||null}))}catch(i){"AbortError"===(null==i?void 0:i.name)&&a(t),a(i)}finally{clearTimeout(u)}})()}))}function SA(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const PA=SA();function UA(e){const{domain:t={},message:n,primaryType:r}=e,o={EIP712Domain:zA({domain:t}),...e.types};_A({domain:t,message:n,primaryType:r,types:o});const a=["0x1901"];return t&&a.push(function({domain:e,types:t}){return OA({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:o})),"EIP712Domain"!==r&&a.push(OA({data:n,primaryType:r,types:o})),Xm(bm(a))}function OA({data:e,primaryType:t,types:n}){return Xm(NA({data:e,primaryType:t,types:n}))}function NA({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],o=[TA({primaryType:t,types:n})];for(const a of n[t]){const[t,u]=RA({types:n,name:a.name,type:a.type,value:e[a.name]});r.push(t),o.push(u)}return dg(r,o)}function TA({primaryType:e,types:t}){const n=Wp(function({primaryType:e,types:t}){let n="";const r=MA({primaryType:e,types:t});r.delete(e);const o=[e,...Array.from(r).sort()];for(const a of o)n+=`${a}(${t[a].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return n}({primaryType:e,types:t}));return Xm(n)}function MA({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),o=null==r?void 0:r[0];if(n.has(o)||void 0===t[o])return n;n.add(o);for(const a of t[o])MA({primaryType:a.type,types:t},n);return n}function RA({types:e,name:t,type:n,value:r}){if(void 0!==e[n])return[{type:"bytes32"},Xm(NA({data:r,primaryType:n,types:e}))];if("bytes"===n){return[{type:"bytes32"},Xm(r=`0x${(r.length%2?"0":"")+r.slice(2)}`)]}if("string"===n)return[{type:"bytes32"},Xm(Wp(r))];if(n.lastIndexOf("]")===n.length-1){const o=n.slice(0,n.lastIndexOf("[")),a=r.map((n=>RA({name:t,type:o,types:e,value:n})));return[{type:"bytes32"},Xm(dg(a.map((([e])=>e)),a.map((([,e])=>e))))]}return[{type:n},r]}function _A(e){const{domain:t,message:n,primaryType:r,types:o}=e,a=(e,t)=>{for(const n of e){const{name:e,type:r}=n,u=t[e],i=r.match(jA);if(i&&("number"==typeof u||"bigint"==typeof u)){const[e,t,n]=i;Hp(u,{signed:"int"===t,size:Number.parseInt(n)/8})}if("address"===r&&"string"==typeof u&&!ag(u))throw new wm({address:u});const s=r.match(kA);if(s){const[e,t]=s;if(t&&jp(u)!==Number.parseInt(t))throw new cm({expectedSize:Number.parseInt(t),givenSize:jp(u)})}const l=o[r];l&&a(l,u)}};o.EIP712Domain&&t&&a(o.EIP712Domain,t),"EIP712Domain"!==r&&a(o[r],n)}function zA({domain:e}){return["string"==typeof(null==e?void 0:e.name)&&{name:"name",type:"string"},(null==e?void 0:e.version)&&{name:"version",type:"string"},"number"==typeof(null==e?void 0:e.chainId)&&{name:"chainId",type:"uint256"},(null==e?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(null==e?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function LA(e,t){if(e.length!==t.length)throw new nm({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;re+t.length),0),n=HA(t);return{length:t<=55?1+t:1+n+t,encode(r){t<=55?r.pushByte(192+t):(r.pushByte(247+n),1===n?r.pushUint8(t):2===n?r.pushUint16(t):3===n?r.pushUint24(t):r.pushUint32(t));for(const{encode:t}of e)t(r)}}}(e.map((e=>QA(e)))):function(e){const t="string"==typeof e?Np(e):e,n=HA(t.length),r=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length;return{length:r,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+n),1===n?e.pushUint8(t.length):2===n?e.pushUint16(t.length):3===n?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function HA(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new bp("Length is too large.")}const VA="Ethereum Signed Message:\n";function $A(e,t){return Xm(function(e){const t="string"==typeof e?$p(e):"string"==typeof e.raw?e.raw:Qp(e.raw);return bm([$p(`${VA}${jp(t)}`),t])}(e),t)}const GA="0x6492649264926492649264926492649264926492649264926492649264926492";function KA(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:o}=e;if(t<=0)throw new Eg({chainId:t});if(o&&!ag(o))throw new wm({address:o});if(r&&r>2n**256n-1n)throw new Ig({maxFeePerGas:r});if(n&&r&&n>r)throw new _g({maxFeePerGas:r,maxPriorityFeePerGas:n})}function JA(e){if(!e||0===e.length)return[];const t=[];for(let n=0;n2n**256n-1n)throw new Ig({maxFeePerGas:r})}(e);const c=JA(s),d=[Wp(n),a?Wp(a):"0x",l?Wp(l):"0x",r?Wp(r):"0x",u??"0x",i?Wp(i):"0x",o??"0x",c,...ZA(e,t)];return vm(["0x01",qA(d)])}(e,t):"eip4844"===n?function(e,t){const{chainId:n,gas:r,nonce:o,to:a,value:u,maxFeePerBlobGas:i,maxFeePerGas:s,maxPriorityFeePerGas:l,accessList:c,data:d}=e;!function(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new yb;for(const e of t){const t=jp(e),n=_p(ug(e,0,1));if(32!==t)throw new bb({hash:e,size:t});if(n!==mb)throw new vb({hash:e,version:n})}}KA(e)}(e);let f=e.blobVersionedHashes,h=e.sidecars;if(e.blobs&&(void 0===f||void 0===h)){const t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map((e=>Qp(e))),n=e.kzg,r=Zy({blobs:t,kzg:n});if(void 0===f&&(f=cb({commitments:r})),void 0===h){h=Fb({blobs:t,commitments:r,proofs:Xy({blobs:t,commitments:r,kzg:n})})}}const p=JA(c),m=[Wp(n),o?Wp(o):"0x",l?Wp(l):"0x",s?Wp(s):"0x",r?Wp(r):"0x",a??"0x",u?Wp(u):"0x",d??"0x",p,i?Wp(i):"0x",f??[],...ZA(e,t)],g=[],y=[],b=[];if(h)for(let v=0;v2n**256n-1n)throw new Ig({maxFeePerGas:r});if(u)throw new bp("`accessList` is not a valid Legacy Transaction attribute.")}(e);let l=[a?Wp(a):"0x",s?Wp(s):"0x",r?Wp(r):"0x",u??"0x",i?Wp(i):"0x",o??"0x"];if(t){const e=(()=>{if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}if(n>0)return BigInt(2*n)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new Qg({v:t.v});return e})();l=[...l,Wp(e),t.r,t.s]}else n>0&&(l=[...l,Wp(n),"0x","0x"]);return qA(l)}(e,t)}function ZA(e,t){const n=t??e,{v:r,yParity:o}=n;if(void 0===n.r)return[];if(void 0===n.s)return[];if(void 0===r&&void 0===o)return[];const a=Ip(n.r),u=Ip(n.s);return["number"==typeof o?o?Wp(1):"0x":0n===r?"0x":1n===r?Wp(1):27n===r?"0x":Wp(1),"0x00"===a?"0x":a,"0x00"===u?"0x":u]}async function XA(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const a=r??"latest",u=void 0!==n?Hp(n):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?_p(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,o,u||a]}))}async function eC(e,{confirmations:t=1,hash:n,onReplaced:r,pollingInterval:o=e.pollingInterval,retryCount:a=6,retryDelay:u=(({count:e})=>200*(1<{i&&setTimeout((()=>m(new Jg({hash:n}))),i);const g=yA(s,{onReplaced:r,resolve:p,reject:m},(r=>{const i=xy(e,wA,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:o,async onBlockNumber(o){const s=e=>{i(),e(),g()};let p=o;if(!h){f>a&&s((()=>r.reject(new Jg({hash:n}))));try{if(d){if(t>1&&(!d.blockNumber||p-d.blockNumber+1nr.resolve(d)))}if(l||(h=!0,await EA((async()=>{l=await xy(e,sA,"getTransaction")({hash:n}),l.blockNumber&&(p=l.blockNumber)}),{delay:u,retryCount:a}),h=!1),d=await xy(e,fA,"getTransactionReceipt")({hash:n}),t>1&&(!d.blockNumber||p-d.blockNumber+1nr.resolve(d)))}catch(m){if(m instanceof Gg||m instanceof Kg){if(!l)return void(h=!1);try{c=l,h=!0;const n=await EA((()=>xy(e,_y,"getBlock")({blockNumber:p,includeTransactions:!0})),{delay:u,retryCount:a,shouldRetry:({error:e})=>e instanceof Uy});h=!1;const o=n.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!o)return;if(d=await xy(e,fA,"getTransactionReceipt")({hash:o.hash}),t>1&&(!d.blockNumber||p-d.blockNumber+1n{var e;null==(e=r.onReplaced)||e.call(r,{reason:i,replacedTransaction:c,transaction:o,transactionReceipt:d}),r.resolve(d)}))}catch(y){s((()=>r.reject(y)))}}else s((()=>r.reject(m)))}finally{f++}}}})}))}))}async function tC(e,{account:t=e.account,message:n}){if(!t)throw new bg({docsPath:"/docs/actions/wallet/signMessage"});const r=yg(t);if("local"===r.type)return r.signMessage({message:n});const o="string"==typeof n?$p(n):n.raw instanceof Uint8Array?Wp(n.raw):n.raw;return e.request({method:"personal_sign",params:[o,r.address]},{retryCount:0})}async function nC(e,t){const{account:n=e.account,domain:r,message:o,primaryType:a}=t;if(!n)throw new bg({docsPath:"/docs/actions/wallet/signTypedData"});const u=yg(n),i={EIP712Domain:zA({domain:r}),...t.types};if(_A({domain:r,message:o,primaryType:a,types:i}),"local"===u.type)return u.signTypedData({domain:r,message:o,primaryType:a,types:i});const s=function(e){const{domain:t,message:n,primaryType:r,types:o}=e,a=(e,t)=>{const n={...t};for(const r of e){const{name:e,type:t}=r;"address"===t&&(n[e]=n[e].toLowerCase())}return n},u=o.EIP712Domain&&t?a(o.EIP712Domain,t):{},i=(()=>{if("EIP712Domain"!==r)return a(o[r],n)})();return Yg({domain:u,message:i,primaryType:r,types:o})}({domain:r,message:o,primaryType:a,types:i});return e.request({method:"eth_signTypedData_v4",params:[u.address,s]},{retryCount:0})}async function rC(e,t){const{abi:n,address:r,args:o,dataSuffix:a,functionName:u,...i}=t,s=i.account?yg(i.account):e.account,l=Vv({abi:n,args:o,functionName:u});try{const{data:c}=await xy(e,bw,"call")({batch:!1,data:`${l}${a?a.replace("0x",""):""}`,to:r,...i,account:s}),d=Qv({abi:n,args:o,functionName:u,data:c||"0x"});return{result:d,request:{abi:n.filter((e=>"name"in e&&e.name===t.functionName)),address:r,args:o,dataSuffix:a,functionName:u,...i,account:s}}}catch(c){throw dw(c,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:u,sender:null==s?void 0:s.address})}} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oC=BigInt(0),aC=BigInt(1),uC=BigInt(2),iC=e=>e instanceof Uint8Array,sC=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function lC(e){if(!iC(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne+t.length),0));let n=0;return e.forEach((e=>{if(!iC(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length})),t}function vC(e,t){if(e.length!==t.length)return!1;for(let n=0;n(uC<new Uint8Array(e),CC=e=>Uint8Array.from(e);function EC(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=AC(e),o=AC(e),a=0;const u=()=>{r.fill(1),o.fill(0),a=0},i=(...e)=>n(o,r,...e),s=(e=AC())=>{o=i(CC([0]),e),r=i(),0!==e.length&&(o=i(CC([1]),e),r=i())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(u(),s(e);!(n=t(l()));)s();return u(),n}}const BC={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function FC(e,t,n={}){const r=(t,n,r)=>{const o=BC[n];if("function"!=typeof o)throw new Error(`Invalid validator "${n}", expected function`);const a=e[t];if(!(r&&void 0===a||o(a,e)))throw new Error(`Invalid param ${String(t)}=${a} (${typeof a}), expected ${n}`)};for(const[o,a]of Object.entries(t))r(o,a,!1);for(const[o,a]of Object.entries(n))r(o,a,!0);return e}const DC=Object.freeze(Object.defineProperty({__proto__:null,bitGet:function(e,t){return e>>BigInt(t)&aC},bitLen:function(e){let t;for(t=0;e>oC;e>>=aC,t+=1);return t},bitMask:wC,bitSet:(e,t,n)=>e|(n?aC:oC)<=xC?n:t+n}function NC(e,t,n){if(n<=xC||t 0");if(n===kC)return xC;let r=kC;for(;t>xC;)t&kC&&(r=r*e%n),e=e*e%n,t>>=kC;return r}function TC(e,t,n){let r=e;for(;t-- >xC;)r*=r,r%=n;return r}function MC(e,t){if(e===xC||t<=xC)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=OC(e,t),r=t,o=xC,a=kC;for(;n!==xC;){const e=r%n,t=o-a*(r/n);r=n,n=e,o=a,a=t}if(r!==kC)throw new Error("invert: does not exist");return OC(o,t)}function RC(e){if(e%SC===IC){const t=(e+kC)/SC;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%UC===PC){const t=(e-PC)/UC;return function(e,n){const r=e.mul(n,jC),o=e.pow(r,t),a=e.mul(n,o),u=e.mul(e.mul(a,jC),o),i=e.mul(a,e.sub(u,e.ONE));if(!e.eql(e.sqr(i),n))throw new Error("Cannot find square root");return i}}return function(e){const t=(e-kC)/jC;let n,r,o;for(n=e-kC,r=0;n%jC===xC;n/=jC,r++);for(o=jC;o"object"==typeof e&&!Array.isArray(e);function nF(e={}){const t=PB(e);return function(e,t,n=t,r=LE){const o=ft.useRef([]),a=eF.useSyncExternalStoreWithSelector(e,t,n,(e=>e),((e,t)=>{if(tF(e)&&tF(t)&&o.current.length){for(const n of o.current)if(!r(e[n],t[n]))return!1;return!0}return r(e,t)}));if(tF(a)){const e={...a};let t={};for(const[n,r]of Object.entries(e))t={...t,[n]:{configurable:!1,enumerable:!0,get:()=>(o.current.includes(n)||o.current.push(n),r)}};return Object.defineProperties(e,t),e}return a}((e=>ZE(t,{onChange:e})),(()=>ME(t)))}function rF(e={}){const{onConnect:t,onDisconnect:n}=e,r=PB(e);ft.useEffect((()=>ZE(r,{onChange(e,r){if(("reconnecting"===r.status||"connecting"===r.status&&void 0===r.address)&&"connected"===e.status){const{address:n,addresses:o,chain:a,chainId:u,connector:i}=e,s="reconnecting"===r.status||void 0===r.status;null==t||t({address:n,addresses:o,chain:a,chainId:u,connector:i,isReconnected:s})}else"connected"===r.status&&"disconnected"===e.status&&(null==n||n())}})),[r,t,n])}var oF=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},aF="undefined"==typeof window||"Deno"in globalThis;function uF(){}function iF(e){return"number"==typeof e&&e>=0&&e!==1/0}function sF(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lF(e,t){return"function"==typeof e?e(t):e}function cF(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:a,queryKey:u,stale:i}=e;if(u)if(r){if(t.queryHash!==fF(u,t.options))return!1}else if(!pF(t.queryKey,u))return!1;if("all"!==n){const e=t.isActive();if("active"===n&&!e)return!1;if("inactive"===n&&e)return!1}return("boolean"!=typeof i||t.isStale()===i)&&((!o||o===t.state.fetchStatus)&&!(a&&!a(t)))}function dF(e,t){const{exact:n,status:r,predicate:o,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(hF(t.options.mutationKey)!==hF(a))return!1}else if(!pF(t.options.mutationKey,a))return!1}return(!r||t.state.status===r)&&!(o&&!o(t))}function fF(e,t){return((null==t?void 0:t.queryKeyHashFn)||hF)(e)}function hF(e){return JSON.stringify(e,((e,t)=>bF(t)?Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}):t))}function pF(e,t){return e===t||typeof e==typeof t&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&!Object.keys(t).some((n=>!pF(e[n],t[n]))))}function mF(e,t){if(e===t)return e;const n=yF(e)&&yF(t);if(n||bF(e)&&bF(t)){const r=n?e:Object.keys(e),o=r.length,a=n?t:Object.keys(t),u=a.length,i=n?[]:{};let s=0;for(let l=0;ln?r.slice(1):r}function CF(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var EF=Symbol(),BF=(e,t)=>!e.queryFn&&(null==t?void 0:t.initialPromise)?()=>t.initialPromise:e.queryFn&&e.queryFn!==EF?e.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)),FF=new(r=class extends oF{constructor(){super(),Ae(this,e),Ae(this,t),Ae(this,n),Ce(this,n,(e=>{if(!aF&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}))}onSubscribe(){we(this,t)||this.setEventListener(we(this,n))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=we(this,t))||e.call(this),Ce(this,t,void 0))}setEventListener(e){var r;Ce(this,n,e),null==(r=we(this,t))||r.call(this),Ce(this,t,e((e=>{"boolean"==typeof e?this.setFocused(e):this.onFocus()})))}setFocused(t){we(this,e)!==t&&(Ce(this,e,t),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach((t=>{t(e)}))}isFocused(){var t;return"boolean"==typeof we(this,e)?we(this,e):"hidden"!==(null==(t=globalThis.document)?void 0:t.visibilityState)}},e=new WeakMap,t=new WeakMap,n=new WeakMap,r),DF=new(i=class extends oF{constructor(){super(),Ae(this,o,!0),Ae(this,a),Ae(this,u),Ce(this,u,(e=>{if(!aF&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}))}onSubscribe(){we(this,a)||this.setEventListener(we(this,u))}onUnsubscribe(){var e;this.hasListeners()||(null==(e=we(this,a))||e.call(this),Ce(this,a,void 0))}setEventListener(e){var t;Ce(this,u,e),null==(t=we(this,a))||t.call(this),Ce(this,a,e(this.setOnline.bind(this)))}setOnline(e){we(this,o)!==e&&(Ce(this,o,e),this.listeners.forEach((t=>{t(e)})))}isOnline(){return we(this,o)}},o=new WeakMap,a=new WeakMap,u=new WeakMap,i);function xF(e){return Math.min(1e3*2**e,3e4)}function kF(e){return"online"!==(e??"online")||DF.isOnline()}var jF=class{constructor(e){this.revert=null==e?void 0:e.revert,this.silent=null==e?void 0:e.silent}};function IF(e){return e instanceof jF}function SF(e){let t,n,r,o=!1,a=0,u=!1;const i=new Promise(((e,t)=>{n=e,r=t})),s=()=>FF.isFocused()&&("always"===e.networkMode||DF.isOnline())&&e.canRun(),l=()=>kF(e.networkMode)&&e.canRun(),c=r=>{var o;u||(u=!0,null==(o=e.onSuccess)||o.call(e,r),null==t||t(),n(r))},d=n=>{var o;u||(u=!0,null==(o=e.onError)||o.call(e,n),null==t||t(),r(n))},f=()=>new Promise((n=>{var r;t=e=>{(u||s())&&n(e)},null==(r=e.onPause)||r.call(e)})).then((()=>{var n;t=void 0,u||null==(n=e.onContinue)||n.call(e)})),h=()=>{if(u)return;let t;const n=0===a?e.initialPromise:void 0;try{t=n??e.fn()}catch(r){t=Promise.reject(r)}Promise.resolve(t).then(c).catch((t=>{var n;if(u)return;const r=e.retry??(aF?0:3),i=e.retryDelay??xF,l="function"==typeof i?i(a,t):i,c=!0===r||"number"==typeof r&&a{setTimeout(e,p)}))).then((()=>s()?void 0:f())).then((()=>{o?d(t):h()}))):d(t)}))};return{promise:i,cancel:t=>{var n;u||(d(new jF(t)),null==(n=e.abort)||n.call(e))},continue:()=>(null==t||t(),i),cancelRetry:()=>{o=!0},continueRetry:()=>{o=!1},canStart:l,start:()=>(l()?h():f().then(h),i)}}var PF=function(){let e=[],t=0,n=e=>{e()},r=e=>{e()},o=e=>setTimeout(e,0);const a=r=>{t?e.push(r):o((()=>{n(r)}))},u=()=>{const t=e;e=[],t.length&&o((()=>{r((()=>{t.forEach((e=>{n(e)}))}))}))};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||u()}return n},batchCalls:e=>(...t)=>{a((()=>{e(...t)}))},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{o=e}}}(),UF=(l=class{constructor(){Ae(this,s)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),iF(this.gcTime)&&Ce(this,s,setTimeout((()=>{this.optionalRemove()}),this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(aF?1/0:3e5))}clearGcTimeout(){we(this,s)&&(clearTimeout(we(this,s)),Ce(this,s,void 0))}},s=new WeakMap,l),OF=(b=class extends UF{constructor(e){super(),Ae(this,g),Ae(this,c),Ae(this,d),Ae(this,f),Ae(this,h),Ae(this,p),Ae(this,m),Ce(this,m,!1),Ce(this,p,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ce(this,f,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ce(this,c,e.state||function(e){const t="function"==typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,r=n?"function"==typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options)),this.state=we(this,c),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return null==(e=we(this,h))?void 0:e.promise}setOptions(e){this.options={...we(this,p),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||we(this,f).remove(this)}setData(e,t){const n=wF(this.state.data,e,this.options);return Ee(this,g,y).call(this,{data:n,type:"success",dataUpdatedAt:null==t?void 0:t.updatedAt,manual:null==t?void 0:t.manual}),n}setState(e,t){Ee(this,g,y).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var t,n;const r=null==(t=we(this,h))?void 0:t.promise;return null==(n=we(this,h))||n.cancel(e),r?r.then(uF).catch(uF):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(we(this,c))}isActive(){return this.observers.some((e=>!1!==e.options.enabled))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some((e=>e.getCurrentResult().isStale)):void 0===this.state.data)}isStaleByTime(e=0){return this.state.isInvalidated||void 0===this.state.data||!sF(this.state.dataUpdatedAt,e)}onFocus(){var e;const t=this.observers.find((e=>e.shouldFetchOnWindowFocus()));null==t||t.refetch({cancelRefetch:!1}),null==(e=we(this,h))||e.continue()}onOnline(){var e;const t=this.observers.find((e=>e.shouldFetchOnReconnect()));null==t||t.refetch({cancelRefetch:!1}),null==(e=we(this,h))||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),we(this,f).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter((t=>t!==e)),this.observers.length||(we(this,h)&&(we(this,m)?we(this,h).cancel({revert:!0}):we(this,h).cancelRetry()),this.scheduleGc()),we(this,f).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ee(this,g,y).call(this,{type:"invalidate"})}fetch(e,t){var n,r,o;if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&(null==t?void 0:t.cancelRefetch))this.cancel({silent:!0});else if(we(this,h))return we(this,h).continueRetry(),we(this,h).promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find((e=>e.options.queryFn));e&&this.setOptions(e.options)}const a=new AbortController,u=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(Ce(this,m,!0),a.signal)})},i={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{const e=BF(this.options,t),n={queryKey:this.queryKey,meta:this.meta};return u(n),Ce(this,m,!1),this.options.persister?this.options.persister(e,n,this):e(n)}};u(i),null==(n=this.options.behavior)||n.onFetch(i,this),Ce(this,d,this.state),"idle"!==this.state.fetchStatus&&this.state.fetchMeta===(null==(r=i.fetchOptions)?void 0:r.meta)||Ee(this,g,y).call(this,{type:"fetch",meta:null==(o=i.fetchOptions)?void 0:o.meta});const s=e=>{var t,n,r,o;IF(e)&&e.silent||Ee(this,g,y).call(this,{type:"error",error:e}),IF(e)||(null==(n=(t=we(this,f).config).onError)||n.call(t,e,this),null==(o=(r=we(this,f).config).onSettled)||o.call(r,this.state.data,e,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ce(this,h,SF({initialPromise:null==t?void 0:t.initialPromise,fn:i.fetchFn,abort:a.abort.bind(a),onSuccess:e=>{var t,n,r,o;void 0!==e?(this.setData(e),null==(n=(t=we(this,f).config).onSuccess)||n.call(t,e,this),null==(o=(r=we(this,f).config).onSettled)||o.call(r,e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1):s(new Error(`${this.queryHash} data is undefined`))},onError:s,onFail:(e,t)=>{Ee(this,g,y).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{Ee(this,g,y).call(this,{type:"pause"})},onContinue:()=>{Ee(this,g,y).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),we(this,h).start()}},c=new WeakMap,d=new WeakMap,f=new WeakMap,h=new WeakMap,p=new WeakMap,m=new WeakMap,g=new WeakSet,y=function(e){this.state=(t=>{switch(e.type){case"failed":return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...t,fetchStatus:"paused"};case"continue":return{...t,fetchStatus:"fetching"};case"fetch":return{...t,...NF(t.data,this.options),fetchMeta:e.meta??null};case"success":return{...t,data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=e.error;return IF(n)&&n.revert&&we(this,d)?{...we(this,d),fetchStatus:"idle"}:{...t,error:n,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...t,isInvalidated:!0};case"setState":return{...t,...e.state}}})(this.state),PF.batch((()=>{this.observers.forEach((e=>{e.onQueryUpdate()})),we(this,f).notify({query:this,type:"updated",action:e})}))},b);function NF(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kF(t.networkMode)?"fetching":"paused",...void 0===e&&{error:null,status:"pending"}}}var TF=(w=class extends oF{constructor(e={}){super(),Ae(this,v),this.config=e,Ce(this,v,new Map)}build(e,t,n){const r=t.queryKey,o=t.queryHash??fF(r,t);let a=this.get(o);return a||(a=new OF({cache:this,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){we(this,v).has(e.queryHash)||(we(this,v).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=we(this,v).get(e.queryHash);t&&(e.destroy(),t===e&&we(this,v).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){PF.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}get(e){return we(this,v).get(e)}getAll(){return[...we(this,v).values()]}find(e){const t={exact:!0,...e};return this.getAll().find((e=>cF(t,e)))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter((t=>cF(e,t))):t}notify(e){PF.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}onFocus(){PF.batch((()=>{this.getAll().forEach((e=>{e.onFocus()}))}))}onOnline(){PF.batch((()=>{this.getAll().forEach((e=>{e.onOnline()}))}))}},v=new WeakMap,w),MF=(D=class extends UF{constructor(e){super(),Ae(this,B),Ae(this,A),Ae(this,C),Ae(this,E),this.mutationId=e.mutationId,Ce(this,C,e.mutationCache),Ce(this,A,[]),this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){we(this,A).includes(e)||(we(this,A).push(e),this.clearGcTimeout(),we(this,C).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ce(this,A,we(this,A).filter((t=>t!==e))),this.scheduleGc(),we(this,C).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){we(this,A).length||("pending"===this.state.status?this.scheduleGc():we(this,C).remove(this))}continue(){var e;return(null==(e=we(this,E))?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var t,n,r,o,a,u,i,s,l,c,d,f,h,p,m,g,y,b,v,w;Ce(this,E,SF({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{Ee(this,B,F).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{Ee(this,B,F).call(this,{type:"pause"})},onContinue:()=>{Ee(this,B,F).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>we(this,C).canRun(this)}));const A="pending"===this.state.status,D=!we(this,E).canStart();try{if(!A){Ee(this,B,F).call(this,{type:"pending",variables:e,isPaused:D}),await(null==(n=(t=we(this,C).config).onMutate)?void 0:n.call(t,e,this));const a=await(null==(o=(r=this.options).onMutate)?void 0:o.call(r,e));a!==this.state.context&&Ee(this,B,F).call(this,{type:"pending",context:a,variables:e,isPaused:D})}const h=await we(this,E).start();return await(null==(u=(a=we(this,C).config).onSuccess)?void 0:u.call(a,h,e,this.state.context,this)),await(null==(s=(i=this.options).onSuccess)?void 0:s.call(i,h,e,this.state.context)),await(null==(c=(l=we(this,C).config).onSettled)?void 0:c.call(l,h,null,this.state.variables,this.state.context,this)),await(null==(f=(d=this.options).onSettled)?void 0:f.call(d,h,null,e,this.state.context)),Ee(this,B,F).call(this,{type:"success",data:h}),h}catch(x){try{throw await(null==(p=(h=we(this,C).config).onError)?void 0:p.call(h,x,e,this.state.context,this)),await(null==(g=(m=this.options).onError)?void 0:g.call(m,x,e,this.state.context)),await(null==(b=(y=we(this,C).config).onSettled)?void 0:b.call(y,void 0,x,this.state.variables,this.state.context,this)),await(null==(w=(v=this.options).onSettled)?void 0:w.call(v,void 0,x,e,this.state.context)),x}finally{Ee(this,B,F).call(this,{type:"error",error:x})}}finally{we(this,C).runNext(this)}}},A=new WeakMap,C=new WeakMap,E=new WeakMap,B=new WeakSet,F=function(e){this.state=(t=>{switch(e.type){case"failed":return{...t,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...t,isPaused:!0};case"continue":return{...t,isPaused:!1};case"pending":return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}})(this.state),PF.batch((()=>{we(this,A).forEach((t=>{t.onMutationUpdate(e)})),we(this,C).notify({mutation:this,type:"updated",action:e})}))},D);var RF=(j=class extends oF{constructor(e={}){super(),Ae(this,x),Ae(this,k),this.config=e,Ce(this,x,new Map),Ce(this,k,Date.now())}build(e,t,n){const r=new MF({mutationCache:this,mutationId:++Be(this,k)._,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){const t=_F(e),n=we(this,x).get(t)??[];n.push(e),we(this,x).set(t,n),this.notify({type:"added",mutation:e})}remove(e){var t;const n=_F(e);if(we(this,x).has(n)){const r=null==(t=we(this,x).get(n))?void 0:t.filter((t=>t!==e));r&&(0===r.length?we(this,x).delete(n):we(this,x).set(n,r))}this.notify({type:"removed",mutation:e})}canRun(e){var t;const n=null==(t=we(this,x).get(_F(e)))?void 0:t.find((e=>"pending"===e.state.status));return!n||n===e}runNext(e){var t;const n=null==(t=we(this,x).get(_F(e)))?void 0:t.find((t=>t!==e&&t.state.isPaused));return(null==n?void 0:n.continue())??Promise.resolve()}clear(){PF.batch((()=>{this.getAll().forEach((e=>{this.remove(e)}))}))}getAll(){return[...we(this,x).values()].flat()}find(e){const t={exact:!0,...e};return this.getAll().find((e=>dF(t,e)))}findAll(e={}){return this.getAll().filter((t=>dF(e,t)))}notify(e){PF.batch((()=>{this.listeners.forEach((t=>{t(e)}))}))}resumePausedMutations(){const e=this.getAll().filter((e=>e.state.isPaused));return PF.batch((()=>Promise.all(e.map((e=>e.continue().catch(uF))))))}},x=new WeakMap,k=new WeakMap,j);function _F(e){var t;return(null==(t=e.options.scope)?void 0:t.id)??String(e.mutationId)}function zF(e){return{onFetch:(t,n)=>{const r=async()=>{var n,r,o,a,u;const i=t.options,s=null==(o=null==(r=null==(n=t.fetchOptions)?void 0:n.meta)?void 0:r.fetchMore)?void 0:o.direction,l=(null==(a=t.state.data)?void 0:a.pages)||[],c=(null==(u=t.state.data)?void 0:u.pageParams)||[],d={pages:[],pageParams:[]};let f=!1;const h=BF(t.options,t.fetchOptions),p=async(e,n,r)=>{if(f)return Promise.reject();if(null==n&&e.pages.length)return Promise.resolve(e);const o={queryKey:t.queryKey,pageParam:n,direction:r?"backward":"forward",meta:t.options.meta};var a;a=o,Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(t.signal.aborted?f=!0:t.signal.addEventListener("abort",(()=>{f=!0})),t.signal)});const u=await h(o),{maxPages:i}=t.options,s=r?CF:AF;return{pages:s(e.pages,u,i),pageParams:s(e.pageParams,n,i)}};let m;if(s&&l.length){const e="backward"===s,t={pages:l,pageParams:c},n=(e?WF:LF)(i,t);m=await p(t,n,e)}else{m=await p(d,c[0]??i.initialPageParam);const t=e??l.length;for(let e=1;e{var e,o;return null==(o=(e=t.options).persister)?void 0:o.call(e,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function LF(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function WF(e,{pages:t,pageParams:n}){var r;return null==(r=e.getPreviousPageParam)?void 0:r.call(e,t[0],t,n[0],n)}var qF=(R=class{constructor(e={}){Ae(this,I),Ae(this,S),Ae(this,P),Ae(this,U),Ae(this,O),Ae(this,N),Ae(this,T),Ae(this,M),Ce(this,I,e.queryCache||new TF),Ce(this,S,e.mutationCache||new RF),Ce(this,P,e.defaultOptions||{}),Ce(this,U,new Map),Ce(this,O,new Map),Ce(this,N,0)}mount(){Be(this,N)._++,1===we(this,N)&&(Ce(this,T,FF.subscribe((async e=>{e&&(await this.resumePausedMutations(),we(this,I).onFocus())}))),Ce(this,M,DF.subscribe((async e=>{e&&(await this.resumePausedMutations(),we(this,I).onOnline())}))))}unmount(){var e,t;Be(this,N)._--,0===we(this,N)&&(null==(e=we(this,T))||e.call(this),Ce(this,T,void 0),null==(t=we(this,M))||t.call(this),Ce(this,M,void 0))}isFetching(e){return we(this,I).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return we(this,S).findAll({...e,status:"pending"}).length}getQueryData(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null==(t=we(this,I).get(n.queryHash))?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(void 0===t)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=we(this,I).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(lF(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return we(this,I).findAll(e).map((({queryKey:e,state:t})=>[e,t.data]))}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=we(this,I).get(r.queryHash),a=function(e,t){return"function"==typeof e?e(t):e}(t,null==o?void 0:o.state.data);if(void 0!==a)return we(this,I).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return PF.batch((()=>we(this,I).findAll(e).map((({queryKey:e})=>[e,this.setQueryData(e,t,n)]))))}getQueryState(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null==(t=we(this,I).get(n.queryHash))?void 0:t.state}removeQueries(e){const t=we(this,I);PF.batch((()=>{t.findAll(e).forEach((e=>{t.remove(e)}))}))}resetQueries(e,t){const n=we(this,I),r={type:"active",...e};return PF.batch((()=>(n.findAll(e).forEach((e=>{e.reset()})),this.refetchQueries(r,t))))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=PF.batch((()=>we(this,I).findAll(e).map((e=>e.cancel(n)))));return Promise.all(r).then(uF).catch(uF)}invalidateQueries(e={},t={}){return PF.batch((()=>{if(we(this,I).findAll(e).forEach((e=>{e.invalidate()})),"none"===e.refetchType)return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)}))}refetchQueries(e={},t){const n={...t,cancelRefetch:(null==t?void 0:t.cancelRefetch)??!0},r=PF.batch((()=>we(this,I).findAll(e).filter((e=>!e.isDisabled())).map((e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(uF)),"paused"===e.state.fetchStatus?Promise.resolve():t}))));return Promise.all(r).then(uF)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=we(this,I).build(this,t);return n.isStaleByTime(lF(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(uF).catch(uF)}fetchInfiniteQuery(e){return e.behavior=zF(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(uF).catch(uF)}resumePausedMutations(){return DF.isOnline()?we(this,S).resumePausedMutations():Promise.resolve()}getQueryCache(){return we(this,I)}getMutationCache(){return we(this,S)}getDefaultOptions(){return we(this,P)}setDefaultOptions(e){Ce(this,P,e)}setQueryDefaults(e,t){we(this,U).set(hF(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...we(this,U).values()];let n={};return t.forEach((t=>{pF(e,t.queryKey)&&(n={...n,...t.defaultOptions})})),n}setMutationDefaults(e,t){we(this,O).set(hF(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...we(this,O).values()];let n={};return t.forEach((t=>{pF(e,t.mutationKey)&&(n={...n,...t.defaultOptions})})),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...we(this,P).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fF(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===EF&&(t.enabled=!1),t}defaultMutationOptions(e){return(null==e?void 0:e._defaulted)?e:{...we(this,P).mutations,...(null==e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){we(this,I).clear(),we(this,S).clear()}},I=new WeakMap,S=new WeakMap,P=new WeakMap,U=new WeakMap,O=new WeakMap,N=new WeakMap,T=new WeakMap,M=new WeakMap,R),QF=(le=class extends oF{constructor(e,t){super(),Ae(this,X),Ae(this,_),Ae(this,z),Ae(this,L),Ae(this,W),Ae(this,q),Ae(this,Q),Ae(this,H),Ae(this,V),Ae(this,$),Ae(this,G),Ae(this,K),Ae(this,J),Ae(this,Y),Ae(this,Z,new Set),this.options=t,Ce(this,_,e),Ce(this,H,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(we(this,z).addObserver(this),HF(we(this,z),this.options)?Ee(this,X,ee).call(this):this.updateResult(),Ee(this,X,oe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return VF(we(this,z),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return VF(we(this,z),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ee(this,X,ae).call(this),Ee(this,X,ue).call(this),we(this,z).removeObserver(this)}setOptions(e,t){const n=this.options,r=we(this,z);if(this.options=we(this,_).defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled)throw new Error("Expected enabled to be a boolean");Ee(this,X,ie).call(this),we(this,z).setOptions(this.options),n._defaulted&&!gF(this.options,n)&&we(this,_).getQueryCache().notify({type:"observerOptionsUpdated",query:we(this,z),observer:this});const o=this.hasListeners();o&&$F(we(this,z),r,this.options,n)&&Ee(this,X,ee).call(this),this.updateResult(t),!o||we(this,z)===r&&this.options.enabled===n.enabled&&lF(this.options.staleTime,we(this,z))===lF(n.staleTime,we(this,z))||Ee(this,X,te).call(this);const a=Ee(this,X,ne).call(this);!o||we(this,z)===r&&this.options.enabled===n.enabled&&a===we(this,Y)||Ee(this,X,re).call(this,a)}getOptimisticResult(e){const t=we(this,_).getQueryCache().build(we(this,_),e),n=this.createResult(t,e);return function(e,t){if(!gF(e.getCurrentResult(),t))return!0;return!1}(this,n)&&(Ce(this,W,n),Ce(this,Q,this.options),Ce(this,q,we(this,z).state)),n}getCurrentResult(){return we(this,W)}trackResult(e,t){const n={};return Object.keys(e).forEach((r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),null==t||t(r),e[r])})})),n}trackProp(e){we(this,Z).add(e)}getCurrentQuery(){return we(this,z)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=we(this,_).defaultQueryOptions(e),n=we(this,_).getQueryCache().build(we(this,_),t);return n.isFetchingOptimistic=!0,n.fetch().then((()=>this.createResult(n,t)))}fetch(e){return Ee(this,X,ee).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then((()=>(this.updateResult(),we(this,W))))}createResult(e,t){var n;const r=we(this,z),o=this.options,a=we(this,W),u=we(this,q),i=we(this,Q),s=e!==r?e.state:we(this,L),{state:l}=e;let c,d={...l},f=!1;if(t._optimisticResults){const n=this.hasListeners(),a=!n&&HF(e,t),u=n&&$F(e,r,t,o);(a||u)&&(d={...d,...NF(l.data,e.options)}),"isRestoring"===t._optimisticResults&&(d.fetchStatus="idle")}let{error:h,errorUpdatedAt:p,status:m}=d;if(t.select&&void 0!==d.data)if(a&&d.data===(null==u?void 0:u.data)&&t.select===we(this,V))c=we(this,$);else try{Ce(this,V,t.select),c=t.select(d.data),c=wF(null==a?void 0:a.data,c,t),Ce(this,$,c),Ce(this,H,null)}catch(A){Ce(this,H,A)}else c=d.data;if(void 0!==t.placeholderData&&void 0===c&&"pending"===m){let e;if((null==a?void 0:a.isPlaceholderData)&&t.placeholderData===(null==i?void 0:i.placeholderData))e=a.data;else if(e="function"==typeof t.placeholderData?t.placeholderData(null==(n=we(this,G))?void 0:n.state.data,we(this,G)):t.placeholderData,t.select&&void 0!==e)try{e=t.select(e),Ce(this,H,null)}catch(A){Ce(this,H,A)}void 0!==e&&(m="success",c=wF(null==a?void 0:a.data,e,t),f=!0)}we(this,H)&&(h=we(this,H),c=we(this,$),p=Date.now(),m="error");const g="fetching"===d.fetchStatus,y="pending"===m,b="error"===m,v=y&&g,w=void 0!==c;return{status:m,fetchStatus:d.fetchStatus,isPending:y,isSuccess:"success"===m,isError:b,isInitialLoading:v,isLoading:v,data:c,dataUpdatedAt:d.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>s.dataUpdateCount||d.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!y,isLoadingError:b&&!w,isPaused:"paused"===d.fetchStatus,isPlaceholderData:f,isRefetchError:b&&w,isStale:GF(e,t),refetch:this.refetch}}updateResult(e){const t=we(this,W),n=this.createResult(we(this,z),this.options);if(Ce(this,q,we(this,z).state),Ce(this,Q,this.options),void 0!==we(this,q).data&&Ce(this,G,we(this,z)),gF(n,t))return;Ce(this,W,n);const r={};!1!==(null==e?void 0:e.listeners)&&(()=>{if(!t)return!0;const{notifyOnChangeProps:e}=this.options,n="function"==typeof e?e():e;if("all"===n||!n&&!we(this,Z).size)return!0;const r=new Set(n??we(this,Z));return this.options.throwOnError&&r.add("error"),Object.keys(we(this,W)).some((e=>{const n=e;return we(this,W)[n]!==t[n]&&r.has(n)}))})()&&(r.listeners=!0),Ee(this,X,se).call(this,{...r,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ee(this,X,oe).call(this)}},_=new WeakMap,z=new WeakMap,L=new WeakMap,W=new WeakMap,q=new WeakMap,Q=new WeakMap,H=new WeakMap,V=new WeakMap,$=new WeakMap,G=new WeakMap,K=new WeakMap,J=new WeakMap,Y=new WeakMap,Z=new WeakMap,X=new WeakSet,ee=function(e){Ee(this,X,ie).call(this);let t=we(this,z).fetch(this.options,e);return(null==e?void 0:e.throwOnError)||(t=t.catch(uF)),t},te=function(){Ee(this,X,ae).call(this);const e=lF(this.options.staleTime,we(this,z));if(aF||we(this,W).isStale||!iF(e))return;const t=sF(we(this,W).dataUpdatedAt,e);Ce(this,K,setTimeout((()=>{we(this,W).isStale||this.updateResult()}),t+1))},ne=function(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(we(this,z)):this.options.refetchInterval)??!1},re=function(e){Ee(this,X,ue).call(this),Ce(this,Y,e),!aF&&!1!==this.options.enabled&&iF(we(this,Y))&&0!==we(this,Y)&&Ce(this,J,setInterval((()=>{(this.options.refetchIntervalInBackground||FF.isFocused())&&Ee(this,X,ee).call(this)}),we(this,Y)))},oe=function(){Ee(this,X,te).call(this),Ee(this,X,re).call(this,Ee(this,X,ne).call(this))},ae=function(){we(this,K)&&(clearTimeout(we(this,K)),Ce(this,K,void 0))},ue=function(){we(this,J)&&(clearInterval(we(this,J)),Ce(this,J,void 0))},ie=function(){const e=we(this,_).getQueryCache().build(we(this,_),this.options);if(e===we(this,z))return;const t=we(this,z);Ce(this,z,e),Ce(this,L,e.state),this.hasListeners()&&(null==t||t.removeObserver(this),e.addObserver(this))},se=function(e){PF.batch((()=>{e.listeners&&this.listeners.forEach((e=>{e(we(this,W))})),we(this,_).getQueryCache().notify({query:we(this,z),type:"observerResultsUpdated"})}))},le);function HF(e,t){return function(e,t){return!1!==t.enabled&&void 0===e.state.data&&!("error"===e.state.status&&!1===t.retryOnMount)}(e,t)||void 0!==e.state.data&&VF(e,t,t.refetchOnMount)}function VF(e,t,n){if(!1!==t.enabled){const r="function"==typeof n?n(e):n;return"always"===r||!1!==r&&GF(e,t)}return!1}function $F(e,t,n,r){return(e!==t||!1===r.enabled)&&(!n.suspense||"error"!==e.state.status)&&GF(e,n)}function GF(e,t){return!1!==t.enabled&&e.isStaleByTime(lF(t.staleTime,e))}var KF=(ye=class extends oF{constructor(e,t){super(),Ae(this,pe),Ae(this,ce),Ae(this,de),Ae(this,fe),Ae(this,he),Ce(this,ce,e),this.setOptions(t),this.bindMethods(),Ee(this,pe,me).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const n=this.options;this.options=we(this,ce).defaultMutationOptions(e),gF(this.options,n)||we(this,ce).getMutationCache().notify({type:"observerOptionsUpdated",mutation:we(this,fe),observer:this}),(null==n?void 0:n.mutationKey)&&this.options.mutationKey&&hF(n.mutationKey)!==hF(this.options.mutationKey)?this.reset():"pending"===(null==(t=we(this,fe))?void 0:t.state.status)&&we(this,fe).setOptions(this.options)}onUnsubscribe(){var e;this.hasListeners()||null==(e=we(this,fe))||e.removeObserver(this)}onMutationUpdate(e){Ee(this,pe,me).call(this),Ee(this,pe,ge).call(this,e)}getCurrentResult(){return we(this,de)}reset(){var e;null==(e=we(this,fe))||e.removeObserver(this),Ce(this,fe,void 0),Ee(this,pe,me).call(this),Ee(this,pe,ge).call(this)}mutate(e,t){var n;return Ce(this,he,t),null==(n=we(this,fe))||n.removeObserver(this),Ce(this,fe,we(this,ce).getMutationCache().build(we(this,ce),this.options)),we(this,fe).addObserver(this),we(this,fe).execute(e)}},ce=new WeakMap,de=new WeakMap,fe=new WeakMap,he=new WeakMap,pe=new WeakSet,me=function(){var e;const t=(null==(e=we(this,fe))?void 0:e.state)??{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0};Ce(this,de,{...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset})},ge=function(e){PF.batch((()=>{var t,n,r,o,a,u,i,s;if(we(this,he)&&this.hasListeners()){const l=we(this,de).variables,c=we(this,de).context;"success"===(null==e?void 0:e.type)?(null==(n=(t=we(this,he)).onSuccess)||n.call(t,e.data,l,c),null==(o=(r=we(this,he)).onSettled)||o.call(r,e.data,null,l,c)):"error"===(null==e?void 0:e.type)&&(null==(u=(a=we(this,he)).onError)||u.call(a,e.error,l,c),null==(s=(i=we(this,he)).onSettled)||s.call(i,void 0,e.error,l,c))}this.listeners.forEach((e=>{e(we(this,de))}))}))},ye);function JF(e){return JSON.stringify(e,((e,t)=>function(e){if(!YF(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!!YF(n)&&!!n.hasOwnProperty("isPrototypeOf")}(t)?Object.keys(t).sort().reduce(((e,n)=>(e[n]=t[n],e)),{}):"bigint"==typeof t?t.toString():t))}function YF(e){return"[object Object]"===Object.prototype.toString.call(e)}function ZF(e){const{_defaulted:t,behavior:n,gcTime:r,initialData:o,initialDataUpdatedAt:a,maxPages:u,meta:i,networkMode:s,queryFn:l,queryHash:c,queryKey:d,queryKeyHashFn:f,retry:h,retryDelay:p,structuralSharing:m,getPreviousPageParam:g,getNextPageParam:y,initialPageParam:b,_optimisticResults:v,enabled:w,notifyOnChangeProps:A,placeholderData:C,refetchInterval:E,refetchIntervalInBackground:B,refetchOnMount:F,refetchOnReconnect:D,refetchOnWindowFocus:x,retryOnMount:k,select:j,staleTime:I,suspense:S,throwOnError:P,config:U,connector:O,query:N,...T}=e;return T}function XF(e){return{mutationFn:t=>async function(e,t){var n;let r;if(r="function"==typeof t.connector?e._internal.connectors.setup(t.connector):t.connector,r.uid===e.state.current)throw new vE;try{e.setState((e=>({...e,status:"connecting"}))),r.emitter.emit("message",{type:"connecting"});const o=await r.connect({chainId:t.chainId}),a=o.accounts;return r.emitter.off("connect",e._internal.events.connect),r.emitter.on("change",e._internal.events.change),r.emitter.on("disconnect",e._internal.events.disconnect),await(null==(n=e.storage)?void 0:n.setItem("recentConnectorId",r.id)),e.setState((e=>({...e,connections:new Map(e.connections).set(r.uid,{accounts:a,chainId:o.chainId,connector:r}),current:r.uid,status:"connected"}))),{accounts:a,chainId:o.chainId}}catch(o){throw e.setState((e=>({...e,status:e.current?"connected":"disconnected"}))),o}}(e,t),mutationKey:["connect"]}}function eD(e){return{mutationFn:t=>async function(e,t={}){var n,r;let o;if(t.connector)o=t.connector;else{const{connections:t,current:n}=e.state,r=t.get(n);o=null==r?void 0:r.connector}const a=e.state.connections;o&&(await o.disconnect(),o.emitter.off("change",e._internal.events.change),o.emitter.off("disconnect",e._internal.events.disconnect),o.emitter.on("connect",e._internal.events.connect),a.delete(o.uid)),e.setState((e=>{if(0===a.size)return{...e,connections:new Map,current:null,status:"disconnected"};const t=a.values().next().value;return{...e,connections:new Map(a),current:t.connector.uid}}));{const t=e.state.current;if(!t)return;const o=null==(n=e.state.connections.get(t))?void 0:n.connector;if(!o)return;await(null==(r=e.storage)?void 0:r.setItem("recentConnectorId",o.id))}}(e,t),mutationKey:["disconnect"]}}function tD(e,t={}){return{async queryFn({queryKey:t}){const{address:n,scopeKey:r,...o}=t[1];if(!n)throw new Error("address is required");const a=await async function(e,t){const{address:n,blockNumber:r,blockTag:o,chainId:a,token:u,unit:i="ether"}=t;if(u)try{return _E(e,{balanceAddress:n,chainId:a,symbolType:"string",tokenAddress:u})}catch(f){if(f instanceof ew){const t=await _E(e,{balanceAddress:n,chainId:a,symbolType:"bytes32",tokenAddress:u}),r=zp(Ip(t.symbol,{dir:"right"}));return{...t,symbol:r}}throw f}const s=e.getClient({chainId:a}),l=fE(s,Qw,"getBalance"),c=await l(r?{address:n,blockNumber:r}:{address:n,blockTag:o}),d=e.chains.find((e=>e.id===a))??s.chain;return{decimals:d.nativeCurrency.decimals,formatted:xg(c,TE(i)),symbol:d.nativeCurrency.symbol,value:c}}(e,{...o,address:n});return a??null},queryKey:nD(t)}}function nD(e={}){return["balance",ZF(e)]}function rD(e,t={}){return{async queryFn({queryKey:t}){const{name:n,scopeKey:r,...o}=t[1];if(!n)throw new Error("name is required");return function(e,t){const{chainId:n,...r}=t;return fE(e.getClient({chainId:n}),Ow,"getEnsAvatar")(r)}(e,{...o,name:n})},queryKey:oD(t)}}function oD(e={}){return["ensAvatar",ZF(e)]}function aD(e,t={}){return{async queryFn({queryKey:t}){const{address:n,scopeKey:r,...o}=t[1];if(!n)throw new Error("address is required");return function(e,t){const{chainId:n,...r}=t;return fE(e.getClient({chainId:n}),Nw,"getEnsName")(r)}(e,{...o,address:n})},queryKey:uD(t)}}function uD(e={}){return["ensName",ZF(e)]}function iD(e){return{mutationFn:t=>async function(e,t){const{account:n,connector:r,...o}=t;let a;return a="object"==typeof n&&"local"===n.type?e.getClient():await NE(e,{account:n,connector:r}),fE(a,tC,"signMessage")({...o,...n?{account:n}:{}})}(e,t),mutationKey:["signMessage"]}}function sD(e){return{mutationFn:t=>async function(e,t){const{account:n,connector:r,...o}=t;let a;return a="object"==typeof n&&"local"===n.type?e.getClient():await NE(e,{account:n,connector:r}),fE(a,nC,"signTypedData")({...o,...n?{account:n}:{}})}(e,t),mutationKey:["signTypedData"]}}function lD(e){return{mutationFn:t=>async function(e,t){var n;const{addEthereumChainParameter:r,chainId:o}=t,a=e.state.connections.get((null==(n=t.connector)?void 0:n.uid)??e.state.current);if(a){const e=a.connector;if(!e.switchChain)throw new YE({connector:e});return await e.switchChain({addEthereumChainParameter:r,chainId:o})}const u=e.chains.find((e=>e.id===o));if(!u)throw new bE;return e.setState((e=>({...e,chainId:o}))),u}(e,t),mutationKey:["switchChain"]}}function cD(e,t={}){return{async queryFn({queryKey:n}){const{hash:r,...o}=n[1];if(!r)throw new Error("hash is required");return async function(e,t){const{chainId:n,timeout:r=0,...o}=t,a=e.getClient({chainId:n}),u=fE(a,eC,"waitForTransactionReceipt"),i=await u({...o,timeout:r});if("reverted"===i.status){const e=fE(a,sA,"getTransaction"),t=await e({hash:i.transactionHash}),n=fE(a,bw,"call"),r=await n({...t,gasPrice:"eip1559"!==t.type?t.gasPrice:void 0,maxFeePerGas:"eip1559"===t.type?t.maxFeePerGas:void 0,maxPriorityFeePerGas:"eip1559"===t.type?t.maxPriorityFeePerGas:void 0}),o=(null==r?void 0:r.data)?zp(`0x${r.data.substring(138)}`):"unknown reason";throw new Error(o)}return{...i,chainId:a.chain.id}}(e,{...o,onReplaced:t.onReplaced,hash:r})},queryKey:dD(t)}}function dD(e={}){const{onReplaced:t,...n}=e;return["waitForTransactionReceipt",ZF(n)]}var fD=ft.createContext(void 0),hD=e=>{const t=ft.useContext(fD);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},pD=({client:e,children:t})=>(ft.useEffect((()=>(e.mount(),()=>{e.unmount()})),[e]),Ct.jsx(fD.Provider,{value:e,children:t})),mD=ft.createContext(!1),gD=()=>ft.useContext(mD);mD.Provider;var yD=ft.createContext(function(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}()),bD=()=>ft.useContext(yD);function vD(e,t){return"function"==typeof e?e(...t):!!e}function wD(){}var AD=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},CD=e=>{ft.useEffect((()=>{e.clearReset()}),[e])},ED=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&vD(n,[e.error,r]),BD=e=>{e.suspense&&"number"!=typeof e.staleTime&&(e.staleTime=1e3)},FD=(e,t)=>(null==e?void 0:e.suspense)&&t.isPending,DD=(e,t,n)=>t.fetchOptimistic(e).catch((()=>{n.clearReset()}));function xD(e,t){return function(e,t,n){const r=hD(),o=gD(),a=bD(),u=r.defaultQueryOptions(e);u._optimisticResults=o?"isRestoring":"optimistic",BD(u),AD(u,a),CD(a);const[i]=ft.useState((()=>new t(r,u))),s=i.getOptimisticResult(u);if(ft.useSyncExternalStore(ft.useCallback((e=>{const t=o?()=>{}:i.subscribe(PF.batchCalls(e));return i.updateResult(),t}),[i,o]),(()=>i.getCurrentResult()),(()=>i.getCurrentResult())),ft.useEffect((()=>{i.setOptions(u,{listeners:!1})}),[u,i]),FD(u,s))throw DD(u,i,a);if(ED({result:s,errorResetBoundary:a,throwOnError:u.throwOnError,query:r.getQueryCache().get(u.queryHash)}))throw s.error;return u.notifyOnChangeProps?s:i.trackResult(s)}(e,QF)}function kD(e,t){const n=hD(),[r]=ft.useState((()=>new KF(n,e)));ft.useEffect((()=>{r.setOptions(e)}),[r,e]);const o=ft.useSyncExternalStore(ft.useCallback((e=>r.subscribe(PF.batchCalls(e))),[r]),(()=>r.getCurrentResult()),(()=>r.getCurrentResult())),a=ft.useCallback(((e,t)=>{r.mutate(e,t).catch(wD)}),[r]);if(o.error&&vD(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:a,mutateAsync:o.mutate}}function jD(e){const t=xD({...e,queryKeyHashFn:JF});return t.queryKey=e.queryKey,t}function ID(e={}){const t=PB(e);return ft.useSyncExternalStore((e=>function(e,t){const{onChange:n}=t;return e.subscribe((e=>e.chainId),n)}(t,{onChange:e})),(()=>zE(t)),(()=>zE(t)))}function SD(e={}){const{address:t,query:n={}}=e,r=PB(e),o=ID({config:r}),a=tD(r,{...e,chainId:e.chainId??o}),u=Boolean(t&&(n.enabled??!0));return jD({...n,...a,enabled:u})}function PD(e={}){const t=PB(e);return ft.useSyncExternalStore((e=>function(e,t){const{onChange:n}=t;return e._internal.chains.subscribe(((e,t)=>{n(e,t)}))}(t,{onChange:e})),(()=>qE(t)),(()=>qE(t)))}function UD(e={}){const t=PB(e);return ft.useSyncExternalStore((e=>function(e,t){const{onChange:n}=t;return e._internal.connectors.subscribe(((e,t)=>{n(Object.values(e),t)}))}(t,{onChange:e})),(()=>$E(t)),(()=>$E(t)))}function OD(e={}){const t=PB(e);return ft.useSyncExternalStore((e=>function(e,t){const{onChange:n}=t;return e.subscribe((()=>HE(e)),n,{equalityFn:LE})}(t,{onChange:e})),(()=>HE(t)),(()=>HE(t)))}function ND(e={}){const{mutation:t}=e,n=PB(e),r=eD(n),{mutate:o,mutateAsync:a,...u}=kD({...t,...r});return{...u,connectors:OD({config:n}).map((e=>e.connector)),disconnect:o,disconnectAsync:a}}function TD(e={}){const t=PB(e);return eF.useSyncExternalStoreWithSelector((e=>function(e,t){const{onChange:n}=t;return e.subscribe((()=>GE(e)),n,{equalityFn:(e,t)=>(null==e?void 0:e.uid)===(null==t?void 0:t.uid)})}(t,{onChange:e})),(()=>GE(t,e)),(()=>GE(t,e)),(e=>e),((e,t)=>(null==e?void 0:e.uid)===(null==t?void 0:t.uid)))}function MD(e={}){const{mutation:t}=e,n=iD(PB(e)),{mutate:r,mutateAsync:o,...a}=kD({...t,...n});return{...a,signMessage:r,signMessageAsync:o}}function RD(e={}){const{hash:t,query:n={}}=e,r=PB(e),o=ID({config:r}),a=cD(r,{...e,chainId:e.chainId??o}),u=Boolean(t&&(n.enabled??!0));return jD({...n,...a,enabled:u})}function _D(e={}){const{mutation:t}=e,n=function(e){return{mutationFn:t=>XE(e,t),mutationKey:["writeContract"]}}(PB(e)),{mutate:r,mutateAsync:o,...a}=kD({...t,...n});return{...a,writeContract:r,writeContractAsync:o}}function zD(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;te[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),o=1,a=[0,1];for(let w=1;w>--s&1}const d=2**31,f=d>>>1,h=f>>1,p=d-1;let m=0;for(let w=0;w<31;w++)m=m<<1|c();let g=[],y=0,b=d;for(;;){let e=Math.floor(((m-y+1)*o-1)/b),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e>>1|c(),u=u<<1^f,i=(i^f)<<1|f|1;y=u,b=1+i-u}let v=r-4;return g.map((t=>{switch(t-v){case 3:return v+65792+(e[i++]<<16|e[i++]<<8|e[i++]);case 2:return v+256+(e[i++]<<8|e[i++]);case 1:return v+e[i++];default:return t-1}}))}(function(e){let t=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach(((e,n)=>t[e.charCodeAt(0)]=n));let n=e.length,r=new Uint8Array(6*n>>3);for(let o=0,a=0,u=0,i=0;o=8&&(r[a++]=i>>(u-=8));return r}(e)))}function VD(e){return 1&e?~e>>1:e>>1}function $D(e,t){let n=Array(e);for(let r=0,o=0;r{let t=GD(e);if(t.length)return t}))}function JD(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(XD(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(ex(n,e))}return t.flat()}function YD(e){let t=[];for(;;){let n=e(t.length);if(!n)break;t.push(n)}return t}function ZD(e,t,n){let r=Array(e).fill().map((()=>[]));for(let o=0;or[t].push(e)));return r}function XD(e,t){let n=1+t(),r=t(),o=YD(t);return ZD(o.length,1+e,t).flatMap(((e,t)=>{let[a,...u]=e;return Array(o[t]).fill().map(((e,t)=>{let o=t*r;return[a+t*n,u.map((e=>e+o))]}))}))}function ex(e,t){return ZD(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}function tx(e){return`{${function(e){return e.toString(16).toUpperCase().padStart(2,"0")}(e)}}`}function nx(e){let t=e.length;if(t<4096)return String.fromCodePoint(...e);let n=[];for(let r=0;r>24&255}function gx(e){return 16777215&e}let yx,bx,vx,wx;function Ax(e){return e>=ax&&e=ux&&e=ix&&tsx&&te.map((e=>[e,t+1<<24]))))),bx=new Set(GD(e)),vx=new Map,wx=new Map;for(let[t,n]of JD(e)){if(!bx.has(t)&&2==n.length){let[e,r]=n,o=wx.get(e);o||(o=new Map,wx.set(e,o)),o.set(r,t)}vx.set(t,n.reverse())}}();let t=[],n=[],r=!1;function o(e){let n=yx.get(e);n&&(r=!0,e|=n),t.push(e)}for(let a of e)for(;;){if(a<128)t.push(a);else if(Ax(a)){let e=a-ax,t=e%cx/lx|0,n=e%lx;o(ux+(e/cx|0)),o(ix+t),n>0&&o(sx+n)}else{let e=vx.get(a);e?n.push(...e):o(a)}if(!n.length)break;a=n.pop()}if(r&&t.length>1){let e=mx(t[0]);for(let n=1;n0&&o>=e)0==e?(t.push(r,...n),n.length=0,r=u):n.push(u),o=e;else{let a=Cx(r,u);a>=0?r=a:0==o&&0==e?(t.push(r),r=u):(n.push(u),o=e)}}return r>=0&&t.push(r,...n),t}(Ex(e))}const Dx=45,xx=".",kx=65039,jx=1,Ix=e=>Array.from(e);function Sx(e,t){return e.P.has(t)||e.Q.has(t)}class Px extends Array{get is_emoji(){return!0}}let Ux,Ox,Nx,Tx,Mx,Rx,_x,zx,Lx,Wx,qx;function Qx(){if(Ux)return;let e=HD(WD);const t=()=>GD(e),n=()=>new Set(t());Ux=new Map(JD(e)),Ox=n(),Nx=t(),Tx=new Set(t().map((e=>Nx[e]))),Nx=new Set(Nx),Mx=n(),n();let r=KD(e),o=e();const a=()=>new Set(t().flatMap((e=>r[e])).concat(t()));Rx=YD((t=>{let n=YD(e).map((e=>e+96));if(n.length){let r=t>=o;return n[0]-=32,n=nx(n),r&&(n=`Restricted[${n}]`),{N:n,P:a(),Q:a(),M:!e(),R:r}}})),_x=n(),zx=new Map;let u=t().concat(Ix(_x)).sort(((e,t)=>e-t));u.forEach(((t,n)=>{let r=e(),o=u[n]=r?u[n-r]:{V:[],M:new Map};o.V.push(t),_x.has(t)||zx.set(t,o)}));for(let{V:c,M:d}of new Set(zx.values())){let e=[];for(let n of c){let t=Rx.filter((e=>Sx(e,n))),r=e.find((({G:e})=>t.some((t=>e.has(t)))));r||(r={G:new Set,V:[]},e.push(r)),r.V.push(n),t.forEach((e=>r.G.add(e)))}let t=e.flatMap((e=>Ix(e.G)));for(let{G:n,V:r}of e){let e=new Set(t.filter((e=>!n.has(e))));for(let t of r)d.set(t,e)}}let i=new Set,s=new Set;const l=e=>i.has(e)?s.add(e):i.add(e);for(let c of Rx){for(let e of c.P)l(e);for(let e of c.Q)l(e)}for(let c of i)zx.has(c)||s.has(c)||zx.set(c,jx);Lx=new Set(Ix(i).concat(Ix(Bx(i)))),Wx=function(e){let t=[],n=GD(e);return function e({S:n,B:r},o,a){if(!(4&n&&a===o[o.length-1])){2&n&&(a=o[o.length-1]),1&n&&t.push(o);for(let t of r)for(let n of t.Q)e(t,[...o,n],a)}}(function t(r){let o=e(),a=YD((()=>{let r=GD(e).map((e=>n[e]));if(r.length)return t(r)}));return{S:o,B:a,Q:r}}([]),[]),t}(e).map((e=>Px.from(e))).sort(rx),qx=new Map;for(let c of Wx){let e=[qx];for(let t of c){let n=e.map((e=>{let n=e.get(t);return n||(n=new Map,e.set(t,n)),n}));t===kx?e.push(...n):e=n}for(let t of e)t.V=c}}function Hx(e){return(Gx(e)?"":`${Vx($x([e]))} `)+tx(e)}function Vx(e){return`"${e}"‎`}function $x(e,t=tx){let n=[];var r;r=e[0],Qx(),Nx.has(r)&&n.push("◌");let o=0,a=e.length;for(let u=0;u{let o=function(e){let t=[];for(let n=0,r=e.length;n0;)if(95!==e[--t])throw new Error("underscore allowed only at start")}(i),!(a.emoji=u>1||r[0].is_emoji)&&i.every((e=>e<128)))!function(e){if(e.length>=4&&e[2]==Dx&&e[3]==Dx)throw new Error(`invalid label extension: "${nx(e.slice(0,4))}"`)}(i),e="ASCII";else{let t=r.flatMap((e=>e.is_emoji?[]:e));if(t.length){if(Nx.has(i[0]))throw Zx("leading combining mark");for(let e=1;eSx(e,n)));if(!e.length)throw Rx.some((e=>Sx(e,n)))?Yx(t[0],n):Jx(n);if(t=e,1==e.length)break}return t}(n);!function(e,t){for(let n of t)if(!Sx(e,n))throw Yx(e,n);if(e.M){let e=Bx(t);for(let t=1,n=e.length;tQD)throw new Error(`excessive non-spacing marks: ${Vx($x(e.slice(t-1,r)))} (${r-t}/${QD})`);t=r}}}(o,t),function(e,t){let n,r=[];for(let o of t){let e=zx.get(o);if(e===jx)return;if(e){let t=e.M.get(o);if(n=n?n.filter((e=>t.has(e))):Ix(t),!n.length)return}else r.push(o)}if(n)for(let o of n)if(r.every((e=>Sx(o,e))))throw new Error(`whole-script confusable: ${e.N}/${o.N}`)}(o,n),e=o.N}else e="Emoji"}a.type=e}catch(u){a.error=u}return a}))}(e,Fx,Xx),t.map((({input:e,error:n,output:r})=>{if(n){let r=n.message;throw new Error(1==t.length?r:`Invalid label ${Vx($x(e))}: ${r}`)}return nx(r)})).join(xx);var t}function Jx(e){return new Error(`disallowed character: ${Hx(e)}`)}function Yx(e,t){let n=Hx(t),r=Rx.find((e=>e.P.has(t)));return r&&(n=`${r.N} ${n}`),new Error(`illegal mixture: ${e.N} + ${n}`)}function Zx(e){return new Error(`illegal placement: ${e}`)}function Xx(e){return e.filter((e=>e!=kx))}function ek(e,t){let n,r=qx,o=e.length;for(;o&&(r=r.get(e[--o]),r);){let{V:t}=r;t&&(n=t,e.length=o)}return n}const tk={contracts:{gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters:{block:Ry({format(e){var t;return{transactions:null==(t=e.transactions)?void 0:t.map((e=>{if("string"==typeof e)return e;const t=Ny(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?Rp(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t})),stateRoot:e.stateRoot}}}),transaction:Ty({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?Rp(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:dA({format:e=>({l1GasPrice:e.l1GasPrice?Rp(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?Rp(e.l1GasUsed):null,l1Fee:e.l1Fee?Rp(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})},serializers:{transaction:function(e,t){return function(e){return"deposit"===e.type||void 0!==e.sourceHash}(e)?function(e){!function(e){const{from:t,to:n}=e;if(t&&!ag(t))throw new wm({address:t});if(n&&!ag(n))throw new wm({address:n})}(e);const{sourceHash:t,data:n,from:r,gas:o,isSystemTx:a,mint:u,to:i,value:s}=e;return vm(["0x7e",qA([t,r,i??"0x",u?Wp(u):"0x",s?Wp(s):"0x",o?Wp(o):"0x",a?"0x1":"0x",n??"0x"])])}(e):YA(e,t)}}},nk=DA({id:31337,name:"Anvil",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),rk=DA({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),ok=1,ak=DA({...tk,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...tk.contracts,disputeGameFactory:{[ok]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[ok]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[ok]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[ok]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:1});var uk=function(){return uk=Object.assign||function(e){for(var t,n=1,r=arguments.length;n