From d4686f6381299f31a86bad92e0570e071200c54c Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Tue, 29 Oct 2024 10:52:22 +0000 Subject: [PATCH] Updates --- buddybook/.vite/manifest.json | 123 ++++++++++++++++++ buddybook/_redirects | 1 + .../{ccip-DHJq9nI9.js => ccip-ColseNtL.js} | 2 +- ...{events-BzDGR98G.js => events-0WpuQ3DP.js} | 2 +- ...e-D7M4pAco.js => hooks.module-ClmD75_J.js} | 2 +- .../{index-D2uqR4Ry.js => index-BNMaGkP5.js} | 2 +- .../{index-FH8NN1-S.js => index-BSVGFq6n.js} | 2 +- .../{index-B-6Lwopd.js => index-CP6_TFKv.js} | 12 +- buddybook/assets/index-CtjScd1r.js | 2 + .../{index-wat9_83N.js => index-D03YFe01.js} | 2 +- .../{index-Dz_NkDRB.js => index-D0eaAjbe.js} | 2 +- buddybook/assets/index-DY1ObU95.js | 2 - .../{index-Rg7xls9w.js => index-i9SwLR_n.js} | 2 +- ...ex.es-KLKTVizS.js => index.es-DaAD1bdq.js} | 6 +- ...Z6FBWK.js => inherits_browser-C53US4G5.js} | 2 +- buddybook/index.html | 5 +- flush-notes/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 flush-notes/index.html | 2 +- flush-notes/index.txt | 2 +- flush-notes/view.html | 2 +- flush-notes/view.txt | 2 +- 23 files changed, 152 insertions(+), 27 deletions(-) create mode 100644 buddybook/.vite/manifest.json create mode 100644 buddybook/_redirects rename buddybook/assets/{ccip-DHJq9nI9.js => ccip-ColseNtL.js} (97%) rename buddybook/assets/{events-BzDGR98G.js => events-0WpuQ3DP.js} (98%) rename buddybook/assets/{hooks.module-D7M4pAco.js => hooks.module-ClmD75_J.js} (99%) rename buddybook/assets/{index-D2uqR4Ry.js => index-BNMaGkP5.js} (99%) rename buddybook/assets/{index-FH8NN1-S.js => index-BSVGFq6n.js} (99%) rename buddybook/assets/{index-B-6Lwopd.js => index-CP6_TFKv.js} (95%) create mode 100644 buddybook/assets/index-CtjScd1r.js rename buddybook/assets/{index-wat9_83N.js => index-D03YFe01.js} (99%) rename buddybook/assets/{index-Dz_NkDRB.js => index-D0eaAjbe.js} (98%) delete mode 100644 buddybook/assets/index-DY1ObU95.js rename buddybook/assets/{index-Rg7xls9w.js => index-i9SwLR_n.js} (99%) rename buddybook/assets/{index.es-KLKTVizS.js => index.es-DaAD1bdq.js} (99%) rename buddybook/assets/{inherits_browser-BwZ6FBWK.js => inherits_browser-C53US4G5.js} (85%) rename flush-notes/_next/static/{LjnGb4udbolWt3VRqlRMf => BpzOJTpugZrem2iDkT7wR}/_buildManifest.js (100%) rename flush-notes/_next/static/{LjnGb4udbolWt3VRqlRMf => BpzOJTpugZrem2iDkT7wR}/_ssgManifest.js (100%) diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json new file mode 100644 index 0000000..289bacd --- /dev/null +++ b/buddybook/.vite/manifest.json @@ -0,0 +1,123 @@ +{ + "_events-0WpuQ3DP.js": { + "file": "assets/events-0WpuQ3DP.js", + "name": "events", + "imports": [ + "index.html" + ] + }, + "_hooks.module-ClmD75_J.js": { + "file": "assets/hooks.module-ClmD75_J.js", + "name": "hooks.module", + "imports": [ + "index.html", + "_events-0WpuQ3DP.js", + "_inherits_browser-C53US4G5.js" + ] + }, + "_index-BNMaGkP5.js": { + "file": "assets/index-BNMaGkP5.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_hooks.module-ClmD75_J.js" + ] + }, + "_index-BSVGFq6n.js": { + "file": "assets/index-BSVGFq6n.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_inherits_browser-C53US4G5.js", + "_hooks.module-ClmD75_J.js", + "_events-0WpuQ3DP.js" + ] + }, + "_index-CtjScd1r.js": { + "file": "assets/index-CtjScd1r.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html" + ], + "dynamicImports": [ + "node_modules/@walletconnect/modal-ui/dist/index.js" + ] + }, + "_index-D0eaAjbe.js": { + "file": "assets/index-D0eaAjbe.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "_events-0WpuQ3DP.js" + ] + }, + "_inherits_browser-C53US4G5.js": { + "file": "assets/inherits_browser-C53US4G5.js", + "name": "inherits_browser", + "imports": [ + "index.html" + ] + }, + "index.html": { + "file": "assets/index-CP6_TFKv.js", + "name": "index", + "src": "index.html", + "isEntry": true, + "dynamicImports": [ + "node_modules/viem/_esm/utils/ccip.js", + "_index-BNMaGkP5.js", + "_index-BSVGFq6n.js", + "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", + "_index-D0eaAjbe.js", + "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" + ], + "css": [ + "assets/index-Dt_CGZqf.css" + ] + }, + "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js": { + "file": "assets/index-i9SwLR_n.js", + "name": "index", + "src": "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", + "isDynamicEntry": true, + "imports": [ + "index.html" + ] + }, + "node_modules/@walletconnect/ethereum-provider/dist/index.es.js": { + "file": "assets/index.es-DaAD1bdq.js", + "name": "index.es", + "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_events-0WpuQ3DP.js", + "_inherits_browser-C53US4G5.js" + ], + "dynamicImports": [ + "_index-CtjScd1r.js" + ] + }, + "node_modules/@walletconnect/modal-ui/dist/index.js": { + "file": "assets/index-D03YFe01.js", + "name": "index", + "src": "node_modules/@walletconnect/modal-ui/dist/index.js", + "isDynamicEntry": true, + "imports": [ + "_index-CtjScd1r.js", + "index.html" + ] + }, + "node_modules/viem/_esm/utils/ccip.js": { + "file": "assets/ccip-ColseNtL.js", + "name": "ccip", + "src": "node_modules/viem/_esm/utils/ccip.js", + "isDynamicEntry": true, + "imports": [ + "index.html" + ] + } +} \ No newline at end of file diff --git a/buddybook/_redirects b/buddybook/_redirects new file mode 100644 index 0000000..d4a8960 --- /dev/null +++ b/buddybook/_redirects @@ -0,0 +1 @@ +/* /index.html 200 \ No newline at end of file diff --git a/buddybook/assets/ccip-DHJq9nI9.js b/buddybook/assets/ccip-ColseNtL.js similarity index 97% rename from buddybook/assets/ccip-DHJq9nI9.js rename to buddybook/assets/ccip-ColseNtL.js index 69a8aaf..8f1e5ab 100644 --- a/buddybook/assets/ccip-DHJq9nI9.js +++ b/buddybook/assets/ccip-ColseNtL.js @@ -1 +1 @@ -import{i as h,I as m,v as p,w,x as g,y as E,z as x,c as O,e as b,H as y,A as M}from"./index-B-6Lwopd.js";function R(s,e){if(!h(s,{strict:!1}))throw new m({address:s});if(!h(e,{strict:!1}))throw new m({address:e});return s.toLowerCase()===e.toLowerCase()}class $ extends p{constructor({callbackSelector:e,cause:a,data:n,extraData:c,sender:d,urls:t}){var i;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(i=a.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",t&&[" Gateway URL(s):",...t.map(f=>` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat(),name:"OffchainLookupError"})}}class A extends p{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${g(e)}`],name:"OffchainLookupResponseMalformedError"})}}class S extends p{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}const T="0x556f1830",q={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 v(s,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=E({data:n,abi:[q]}),[t,i,f,r,o]=d,{ccipRead:u}=s,k=u&&typeof(u==null?void 0:u.request)=="function"?u.request:C;try{if(!R(c,t))throw new S({sender:t,to:c});const l=await k({data:f,sender:t,urls:i}),{data:L}=await x(s,{blockNumber:e,blockTag:a,data:O([r,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return L}catch(l){throw new $({callbackSelector:r,cause:l,data:n,extraData:o,sender:t,urls:i})}}async function C({data:s,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat(),name:"OffchainLookupError"})}}class A extends p{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${g(e)}`],name:"OffchainLookupResponseMalformedError"})}}class S extends p{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}const T="0x556f1830",q={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 v(s,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=E({data:n,abi:[q]}),[t,i,f,r,o]=d,{ccipRead:u}=s,k=u&&typeof(u==null?void 0:u.request)=="function"?u.request:C;try{if(!R(c,t))throw new S({sender:t,to:c});const l=await k({data:f,sender:t,urls:i}),{data:L}=await x(s,{blockNumber:e,blockTag:a,data:O([r,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:c});return L}catch(l){throw new $({callbackSelector:r,cause:l,data:n,extraData:o,sender:t,urls:i})}}async function C({data:s,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(w){var s={data:w,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var s=this.head,p=""+s.data;s=s.next;)p+=w+s.data;return p}},{key:"concat",value:function(w){if(this.length===0)return b.alloc(0);for(var s=b.allocUnsafe(w>>>0),p=this.head,y=0;p;)v(p.data,s,y),y+=p.data.length,p=p.next;return s}},{key:"consume",value:function(w,s){var p;return wS.length?S.length:w;if(T===S.length?y+=S:y+=S.slice(0,w),w-=T,w===0){T===S.length?(++p,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=S.slice(T));break}++p}return this.length-=p,y}},{key:"_getBuffer",value:function(w){var s=b.allocUnsafe(w),p=this.head,y=1;for(p.data.copy(s),w-=p.data.length;p=p.next;){var S=p.data,T=w>S.length?S.length:w;if(S.copy(s,s.length-w,0,T),w-=T,w===0){T===S.length?(++y,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=S.slice(T));break}++y}return this.length-=y,s}},{key:m,value:function(w,s){return u(this,t(t({},s),{},{depth:0,customInspect:!1}))}}]),R}(),Yt}function Gn(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(or,this,e)):process.nextTick(or,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(f){!t&&f?r._writableState?r._writableState.errorEmitted?process.nextTick(We,r):(r._writableState.errorEmitted=!0,process.nextTick(mr,r,f)):process.nextTick(mr,r,f):t?(process.nextTick(We,r),t(f)):process.nextTick(We,r)}),this)}function mr(e,t){or(e,t),We(e)}function We(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Vn(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function or(e,t){e.emit("error",t)}function Kn(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var nn={destroy:Gn,undestroy:Vn,errorOrDestroy:Kn},pe={};function Yn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var an={};function X(e,t,r){r||(r=Error);function n(f,l,c){return typeof t=="string"?t:t(f,l,c)}var i=function(f){Yn(l,f);function l(c,d,b){return f.call(this,n(c,d,b))||this}return l}(r);i.prototype.name=r.name,i.prototype.code=e,an[e]=i}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Xn(e,t,r){return e.substr(0,t.length)===t}function Jn(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Qn(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}X("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);X("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Xn(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Jn(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Sr(t,"type"));else{var f=Qn(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(f," ").concat(n," ").concat(Sr(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);X("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");X("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});X("ERR_STREAM_PREMATURE_CLOSE","Premature close");X("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});X("ERR_MULTIPLE_CALLBACK","Callback called multiple times");X("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");X("ERR_STREAM_WRITE_AFTER_END","write after end");X("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);X("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);X("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");pe.codes=an;var Zn=pe.codes.ERR_INVALID_OPT_VALUE;function ei(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ti(e,t,r,n){var i=ei(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var f=n?r:"highWaterMark";throw new Zn(f,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var on={getHighWaterMark:ti},ri=ni;function ni(e,t){if(Xt("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Xt("throwDeprecation"))throw new Error(t);Xt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Xt(e){try{if(!Ee.localStorage)return!1}catch{return!1}var t=Ee.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Jt,Rr;function fn(){if(Rr)return Jt;Rr=1,Jt=D;function e(_){var h=this;this.next=null,this.entry=null,this.finish=function(){ne(h,_)}}var t;D.WritableState=B;var r={deprecate:ri},n=rn,i=Le.Buffer,f=(typeof Ee<"u"?Ee:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(_){return i.from(_)}function c(_){return i.isBuffer(_)||_ instanceof f}var d=nn,b=on,E=b.getHighWaterMark,u=pe.codes,m=u.ERR_INVALID_ARG_TYPE,v=u.ERR_METHOD_NOT_IMPLEMENTED,R=u.ERR_MULTIPLE_CALLBACK,A=u.ERR_STREAM_CANNOT_PIPE,w=u.ERR_STREAM_DESTROYED,s=u.ERR_STREAM_NULL_VALUES,p=u.ERR_STREAM_WRITE_AFTER_END,y=u.ERR_UNKNOWN_ENCODING,S=d.errorOrDestroy;J(D,n);function T(){}function B(_,h,x){t=t||me(),_=_||{},typeof x!="boolean"&&(x=h instanceof t),this.objectMode=!!_.objectMode,x&&(this.objectMode=this.objectMode||!!_.writableObjectMode),this.highWaterMark=E(this,_,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var k=_.decodeStrings===!1;this.decodeStrings=!k,this.defaultEncoding=_.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(L){le(h,L)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=_.emitClose!==!1,this.autoDestroy=!!_.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}B.prototype.getBuffer=function(){for(var h=this.bufferedRequest,x=[];h;)x.push(h),h=h.next;return x},function(){try{Object.defineProperty(B.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(h){return O.call(this,h)?!0:this!==D?!1:h&&h._writableState instanceof B}})):O=function(h){return h instanceof this};function D(_){t=t||me();var h=this instanceof t;if(!h&&!O.call(D,this))return new D(_);this._writableState=new B(_,this,h),this.writable=!0,_&&(typeof _.write=="function"&&(this._write=_.write),typeof _.writev=="function"&&(this._writev=_.writev),typeof _.destroy=="function"&&(this._destroy=_.destroy),typeof _.final=="function"&&(this._final=_.final)),n.call(this)}D.prototype.pipe=function(){S(this,new A)};function M(_,h){var x=new p;S(_,x),process.nextTick(h,x)}function F(_,h,x,k){var L;return x===null?L=new s:typeof x!="string"&&!h.objectMode&&(L=new m("chunk",["string","Buffer"],x)),L?(S(_,L),process.nextTick(k,L),!1):!0}D.prototype.write=function(_,h,x){var k=this._writableState,L=!1,a=!k.objectMode&&c(_);return a&&!i.isBuffer(_)&&(_=l(_)),typeof h=="function"&&(x=h,h=null),a?h="buffer":h||(h=k.defaultEncoding),typeof x!="function"&&(x=T),k.ending?M(this,x):(a||F(this,k,_,x))&&(k.pendingcb++,L=Z(this,k,a,_,h,x)),L},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var _=this._writableState;_.corked&&(_.corked--,!_.writing&&!_.corked&&!_.bufferProcessing&&_.bufferedRequest&&Y(this,_))},D.prototype.setDefaultEncoding=function(h){if(typeof h=="string"&&(h=h.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((h+"").toLowerCase())>-1))throw new y(h);return this._writableState.defaultEncoding=h,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function W(_,h,x){return!_.objectMode&&_.decodeStrings!==!1&&typeof h=="string"&&(h=i.from(h,x)),h}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(_,h,x,k,L,a){if(!x){var o=W(h,k,L);k!==o&&(x=!0,L="buffer",k=o)}var g=h.objectMode?1:k.length;h.length+=g;var C=h.length */var Ar;function ii(){return Ar||(Ar=1,function(e,t){var r=Le,n=r.Buffer;function i(l,c){for(var d in l)c[d]=l[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=f);function f(l,c,d){return n(l,c,d)}f.prototype=Object.create(n.prototype),i(n,f),f.from=function(l,c,d){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,c,d)},f.alloc=function(l,c,d){if(typeof l!="number")throw new TypeError("Argument must be a number");var b=n(l);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}}(qe,qe.exports)),qe.exports}var Cr;function Br(){if(Cr)return Zt;Cr=1;var e=ii().Buffer,t=e.isEncoding||function(s){switch(s=""+s,s&&s.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(s){if(!s)return"utf8";for(var p;;)switch(s){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 s;default:if(p)return;s=(""+s).toLowerCase(),p=!0}}function n(s){var p=r(s);if(typeof p!="string"&&(e.isEncoding===t||!t(s)))throw new Error("Unknown encoding: "+s);return p||s}Zt.StringDecoder=i;function i(s){this.encoding=n(s);var p;switch(this.encoding){case"utf16le":this.text=u,this.end=m,p=4;break;case"utf8":this.fillLast=d,p=4;break;case"base64":this.text=v,this.end=R,p=3;break;default:this.write=A,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}i.prototype.write=function(s){if(s.length===0)return"";var p,y;if(this.lastNeed){if(p=this.fillLast(s),p===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y>5===6?2:s>>4===14?3:s>>3===30?4:s>>6===2?-1:-2}function l(s,p,y){var S=p.length-1;if(S=0?(T>0&&(s.lastNeed=T-1),T):--S=0?(T>0&&(s.lastNeed=T-2),T):--S=0?(T>0&&(T===2?T=0:s.lastNeed=T-3),T):0))}function c(s,p,y){if((p[0]&192)!==128)return s.lastNeed=0,"�";if(s.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return s.lastNeed=1,"�";if(s.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return s.lastNeed=2,"�"}}function d(s){var p=this.lastTotal-this.lastNeed,y=c(this,s);if(y!==void 0)return y;if(this.lastNeed<=s.length)return s.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);s.copy(this.lastChar,p,0,s.length),this.lastNeed-=s.length}function b(s,p){var y=l(this,s,p);if(!this.lastNeed)return s.toString("utf8",p);this.lastTotal=y;var S=s.length-(y-this.lastNeed);return s.copy(this.lastChar,0,S),s.toString("utf8",p,S)}function E(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+"�":p}function u(s,p){if((s.length-p)%2===0){var y=s.toString("utf16le",p);if(y){var S=y.charCodeAt(y.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=s[s.length-1],s.toString("utf16le",p,s.length-1)}function m(s){var p=s&&s.length?this.write(s):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,y)}return p}function v(s,p){var y=(s.length-p)%3;return y===0?s.toString("base64",p):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=s[s.length-1]:(this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1]),s.toString("base64",p,s.length-y))}function R(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function A(s){return s.toString(this.encoding)}function w(s){return s&&s.length?this.write(s):""}return Zt}var kr=pe.codes.ERR_STREAM_PREMATURE_CLOSE;function ai(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof o!="string"&&!N.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=f(o)),C)N.endEmitted?T(a,new s):W(a,N,o,!0);else if(N.ended)T(a,new A);else{if(N.destroyed)return!1;N.reading=!1,N.decoder&&!g?(o=N.decoder.write(o),N.objectMode||o.length!==0?W(a,N,o,!1):Y(a,N)):W(a,N,o,!1)}else C||(N.reading=!1,Y(a,N))}return!N.ended&&(N.length=q?a=q:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function G(a,o){return a<=0||o.length===0&&o.ended?0:o.objectMode?1:a!==a?o.flowing&&o.length?o.buffer.head.data.length:o.length:(a>o.highWaterMark&&(o.highWaterMark=z(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}M.prototype.read=function(a){d("read",a),a=parseInt(a,10);var o=this._readableState,g=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return d("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=G(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var C=o.needReadable;d("need readable",C),(o.length===0||o.length-a0?U=h(a,o):U=null,U===null?(o.needReadable=o.length<=o.highWaterMark,a=0):(o.length-=a,o.awaitDrain=0),o.length===0&&(o.ended||(o.needReadable=!0),g!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function le(a,o){if(d("onEofChunk"),!o.ended){if(o.decoder){var g=o.decoder.end();g&&g.length&&(o.buffer.push(g),o.length+=o.objectMode?1:g.length)}o.ended=!0,o.sync?K(a):(o.needReadable=!1,o.emittedReadable||(o.emittedReadable=!0,ee(a)))}}function K(a){var o=a._readableState;d("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(d("emitReadable",o.flowing),o.emittedReadable=!0,process.nextTick(ee,a))}function ee(a){var o=a._readableState;d("emitReadable_",o.destroyed,o.length,o.ended),!o.destroyed&&(o.length||o.ended)&&(a.emit("readable"),o.emittedReadable=!1),o.needReadable=!o.flowing&&!o.ended&&o.length<=o.highWaterMark,_(a)}function Y(a,o){o.readingMore||(o.readingMore=!0,process.nextTick(te,a,o))}function te(a,o){for(;!o.reading&&!o.ended&&(o.length1&&L(C.pipes,a)!==-1)&&!Ce&&(d("false write response, pause",C.awaitDrain),C.awaitDrain++),g.pause())}function ye(ae){d("onerror",ae),_e(),a.removeListener("error",ye),t(a,"error")===0&&T(a,ae)}O(a,"error",ye);function we(){a.removeListener("finish",xe),_e()}a.once("close",we);function xe(){d("onfinish"),a.removeListener("close",we),_e()}a.once("finish",xe);function _e(){d("unpipe"),g.unpipe(a)}return a.emit("pipe",g),C.flowing||(d("pipe resume"),g.resume()),a};function ue(a){return function(){var g=a._readableState;d("pipeOnDrain",g.awaitDrain),g.awaitDrain&&g.awaitDrain--,g.awaitDrain===0&&t(a,"data")&&(g.flowing=!0,_(a))}}M.prototype.unpipe=function(a){var o=this._readableState,g={hasUnpiped:!1};if(o.pipesCount===0)return this;if(o.pipesCount===1)return a&&a!==o.pipes?this:(a||(a=o.pipes),o.pipes=null,o.pipesCount=0,o.flowing=!1,a&&a.emit("unpipe",this,g),this);if(!a){var C=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var N=0;N0,C.flowing!==!1&&this.resume()):a==="readable"&&!C.endEmitted&&!C.readableListening&&(C.readableListening=C.needReadable=!0,C.flowing=!1,C.emittedReadable=!1,d("on readable",C.length,C.reading),C.length?K(this):C.reading||process.nextTick(V,this)),g},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(a,o){var g=r.prototype.removeListener.call(this,a,o);return a==="readable"&&process.nextTick(re,this),g},M.prototype.removeAllListeners=function(a){var o=r.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&process.nextTick(re,this),o};function re(a){var o=a._readableState;o.readableListening=a.listenerCount("readable")>0,o.resumeScheduled&&!o.paused?o.flowing=!0:a.listenerCount("data")>0&&a.resume()}function V(a){d("readable nexttick read 0"),a.read(0)}M.prototype.resume=function(){var a=this._readableState;return a.flowing||(d("resume"),a.flowing=!a.readableListening,he(this,a)),a.paused=!1,this};function he(a,o){o.resumeScheduled||(o.resumeScheduled=!0,process.nextTick(ne,a,o))}function ne(a,o){d("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),_(a),o.flowing&&!o.reading&&a.read(0)}M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function _(a){var o=a._readableState;for(d("flow",o.flowing);o.flowing&&a.read()!==null;);}M.prototype.wrap=function(a){var o=this,g=this._readableState,C=!1;a.on("end",function(){if(d("wrapped end"),g.decoder&&!g.ended){var P=g.decoder.end();P&&P.length&&o.push(P)}o.push(null)}),a.on("data",function(P){if(d("wrapped data"),g.decoder&&(P=g.decoder.write(P)),!(g.objectMode&&P==null)&&!(!g.objectMode&&(!P||!P.length))){var ie=o.push(P);ie||(C=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(ie){return function(){return a[ie].apply(a,arguments)}}(U));for(var N=0;N=o.length?(o.decoder?g=o.buffer.join(""):o.buffer.length===1?g=o.buffer.first():g=o.buffer.concat(o.length),o.buffer.clear()):g=o.buffer.consume(a,o.decoder),g}function x(a){var o=a._readableState;d("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,process.nextTick(k,o,a))}function k(a,o){if(d("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var g=o._writableState;(!g||g.autoDestroy&&g.finished)&&o.destroy()}}typeof Symbol=="function"&&(M.from=function(a,o){return S===void 0&&(S=li()),S(M,a,o)});function L(a,o){for(var g=0,C=a.length;g0;return xi(l,d,b,function(E){i||(i=E),E&&f.forEach(Or),!d&&(f.forEach(Or),n(i))})});return t.reduce(Ei)}var Ri=Si;(function(e,t){t=e.exports=ln(),t.Stream=t,t.Readable=t,t.Writable=fn(),t.Duplex=me(),t.Transform=un,t.PassThrough=bi,t.finished=pr,t.pipeline=Ri})(ar,ar.exports);var cn=ar.exports;const{Transform:Ti}=cn;var Ai=e=>class dn extends Ti{constructor(r,n,i,f,l){super(l),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=f,this._options=l,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(l){f=l}i(f)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new dn(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Ci}=cn;var Bi=e=>class pn extends Ci{constructor(r,n,i,f){super(f),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=f,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(l){f=l}i(f)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new pn(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const ki=Ai,Mi=Bi;var Di=function(e){const t=ki(e),r=Mi(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},bn={};const Ir=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];bn.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],f=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],b=e[7]^e[17]^e[27]^e[37]^e[47],E=e[8]^e[18]^e[28]^e[38]^e[48],u=e[9]^e[19]^e[29]^e[39]^e[49];let m=E^(i<<1|f>>>31),v=u^(f<<1|i>>>31);const R=e[0]^m,A=e[1]^v,w=e[10]^m,s=e[11]^v,p=e[20]^m,y=e[21]^v,S=e[30]^m,T=e[31]^v,B=e[40]^m,O=e[41]^v;m=r^(l<<1|c>>>31),v=n^(c<<1|l>>>31);const D=e[2]^m,M=e[3]^v,F=e[12]^m,W=e[13]^v,Z=e[22]^m,q=e[23]^v,z=e[32]^m,G=e[33]^v,le=e[42]^m,K=e[43]^v;m=i^(d<<1|b>>>31),v=f^(b<<1|d>>>31);const ee=e[4]^m,Y=e[5]^v,te=e[14]^m,ue=e[15]^v,re=e[24]^m,V=e[25]^v,he=e[34]^m,ne=e[35]^v,_=e[44]^m,h=e[45]^v;m=l^(E<<1|u>>>31),v=c^(u<<1|E>>>31);const x=e[6]^m,k=e[7]^v,L=e[16]^m,a=e[17]^v,o=e[26]^m,g=e[27]^v,C=e[36]^m,U=e[37]^v,N=e[46]^m,P=e[47]^v;m=d^(r<<1|n>>>31),v=b^(n<<1|r>>>31);const ie=e[8]^m,ce=e[9]^v,Ce=e[18]^m,He=e[19]^v,Be=e[28]^m,ye=e[29]^v,we=e[38]^m,xe=e[39]^v,_e=e[48]^m,ae=e[49]^v,Q=R,et=A,tt=s<<4|w>>>28,rt=w<<4|s>>>28,nt=p<<3|y>>>29,it=y<<3|p>>>29,at=T<<9|S>>>23,ot=S<<9|T>>>23,ft=B<<18|O>>>14,st=O<<18|B>>>14,lt=D<<1|M>>>31,ut=M<<1|D>>>31,ht=W<<12|F>>>20,_t=F<<12|W>>>20,ct=Z<<10|q>>>22,dt=q<<10|Z>>>22,pt=G<<13|z>>>19,bt=z<<13|G>>>19,vt=le<<2|K>>>30,gt=K<<2|le>>>30,yt=Y<<30|ee>>>2,wt=ee<<30|Y>>>2,xt=te<<6|ue>>>26,Et=ue<<6|te>>>26,mt=V<<11|re>>>21,St=re<<11|V>>>21,Rt=he<<15|ne>>>17,Tt=ne<<15|he>>>17,At=h<<29|_>>>3,Ct=_<<29|h>>>3,Bt=x<<28|k>>>4,kt=k<<28|x>>>4,Mt=a<<23|L>>>9,Dt=L<<23|a>>>9,Nt=o<<25|g>>>7,Lt=g<<25|o>>>7,Pt=C<<21|U>>>11,Ot=U<<21|C>>>11,It=P<<24|N>>>8,$t=N<<24|P>>>8,Ft=ie<<27|ce>>>5,Ut=ce<<27|ie>>>5,Ht=Ce<<20|He>>>12,qt=He<<20|Ce>>>12,jt=ye<<7|Be>>>25,Wt=Be<<7|ye>>>25,zt=we<<8|xe>>>24,Gt=xe<<8|we>>>24,Vt=_e<<14|ae>>>18,Kt=ae<<14|_e>>>18;e[0]=Q^~ht&mt,e[1]=et^~_t&St,e[10]=Bt^~Ht&nt,e[11]=kt^~qt&it,e[20]=lt^~xt&Nt,e[21]=ut^~Et&Lt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Dt&Wt,e[2]=ht^~mt&Pt,e[3]=_t^~St&Ot,e[12]=Ht^~nt&pt,e[13]=qt^~it&bt,e[22]=xt^~Nt&zt,e[23]=Et^~Lt&Gt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Dt^~Wt&ot,e[4]=mt^~Pt&Vt,e[5]=St^~Ot&Kt,e[14]=nt^~pt&At,e[15]=it^~bt&Ct,e[24]=Nt^~zt&ft,e[25]=Lt^~Gt&st,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Pt^~Vt&Q,e[7]=Ot^~Kt&et,e[16]=pt^~At&Bt,e[17]=bt^~Ct&kt,e[26]=zt^~ft<,e[27]=Gt^~st&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Vt^~Q&ht,e[9]=Kt^~et&_t,e[18]=At^~Bt&Ht,e[19]=Ct^~kt&qt,e[28]=ft^~lt&xt,e[29]=st^~ut&Et,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Dt,e[0]^=Ir[t*2],e[1]^=Ir[t*2+1]}};const Ge=bn;function Te(){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}Te.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Te.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Ge.p1600(this.state),this.count=0);return t};Te.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Ni=Te,Xa=Di(Ni),vn={exports:{}},fr={exports:{}};(function(e,t){var r=Le,n=r.Buffer;function i(l,c){for(var d in l)c[d]=l[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=f);function f(l,c,d){return n(l,c,d)}i(n,f),f.from=function(l,c,d){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,c,d)},f.alloc=function(l,c,d){if(typeof l!="number")throw new TypeError("Argument must be a number");var b=n(l);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}})(fr,fr.exports);var be=fr.exports,gn=be.Buffer;function Xe(e,t){this._block=gn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Xe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=gn.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,f=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var f=this._hash();return e?f.toString(e):f};Xe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ae=Xe,Li=J,yn=Ae,Pi=be.Buffer,Oi=[1518500249,1859775393,-1894007588,-899497514],Ii=new Array(80);function Pe(){this.init(),this._w=Ii,yn.call(this,64,56)}Li(Pe,yn);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $i(e){return e<<5|e>>>27}function Fi(e){return e<<30|e>>>2}function Ui(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var d=0;d<80;++d){var b=~~(d/20),E=$i(r)+Ui(b,n,i,f)+l+t[d]+Oi[b]|0;l=f,f=i,i=Fi(n),n=r,r=E}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Pe.prototype._hash=function(){var e=Pi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Hi=Pe,qi=J,wn=Ae,ji=be.Buffer,Wi=[1518500249,1859775393,-1894007588,-899497514],zi=new Array(80);function Oe(){this.init(),this._w=zi,wn.call(this,64,56)}qi(Oe,wn);Oe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Gi(e){return e<<1|e>>>31}function Vi(e){return e<<5|e>>>27}function Ki(e){return e<<30|e>>>2}function Yi(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Oe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=Gi(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var d=0;d<80;++d){var b=~~(d/20),E=Vi(r)+Yi(b,n,i,f)+l+t[d]+Wi[b]|0;l=f,f=i,i=Ki(n),n=r,r=E}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Oe.prototype._hash=function(){var e=ji.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Xi=Oe,Ji=J,xn=Ae,Qi=be.Buffer,Zi=[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],ea=new Array(64);function Ie(){this.init(),this._w=ea,xn.call(this,64,56)}Ji(Ie,xn);Ie.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ta(e,t,r){return r^e&(t^r)}function ra(e,t,r){return e&t|r&(e|t)}function na(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ia(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function aa(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function oa(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Ie.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=this._f|0,d=this._g|0,b=this._h|0,E=0;E<16;++E)t[E]=e.readInt32BE(E*4);for(;E<64;++E)t[E]=oa(t[E-2])+t[E-7]+aa(t[E-15])+t[E-16]|0;for(var u=0;u<64;++u){var m=b+ia(l)+ta(l,c,d)+Zi[u]+t[u]|0,v=na(r)+ra(r,n,i)|0;b=d,d=c,c=l,l=f+m|0,f=i,i=n,n=r,r=m+v|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0,this._f=c+this._f|0,this._g=d+this._g|0,this._h=b+this._h|0};Ie.prototype._hash=function(){var e=Qi.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var En=Ie,fa=J,sa=En,la=Ae,ua=be.Buffer,ha=new Array(64);function Je(){this.init(),this._w=ha,la.call(this,64,56)}fa(Je,sa);Je.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};Je.prototype._hash=function(){var e=ua.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _a=Je,ca=J,mn=Ae,da=be.Buffer,$r=[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],pa=new Array(160);function $e(){this.init(),this._w=pa,mn.call(this,128,112)}ca($e,mn);$e.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Fr(e,t,r){return r^e&(t^r)}function Ur(e,t,r){return e&t|r&(e|t)}function Hr(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function qr(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ba(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function va(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ga(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function ya(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function j(e,t){return e>>>0>>0?1:0}$e.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,f=this._dh|0,l=this._eh|0,c=this._fh|0,d=this._gh|0,b=this._hh|0,E=this._al|0,u=this._bl|0,m=this._cl|0,v=this._dl|0,R=this._el|0,A=this._fl|0,w=this._gl|0,s=this._hl|0,p=0;p<32;p+=2)t[p]=e.readInt32BE(p*4),t[p+1]=e.readInt32BE(p*4+4);for(;p<160;p+=2){var y=t[p-30],S=t[p-15*2+1],T=ba(y,S),B=va(S,y);y=t[p-2*2],S=t[p-2*2+1];var O=ga(y,S),D=ya(S,y),M=t[p-7*2],F=t[p-7*2+1],W=t[p-16*2],Z=t[p-16*2+1],q=B+F|0,z=T+M+j(q,B)|0;q=q+D|0,z=z+O+j(q,D)|0,q=q+Z|0,z=z+W+j(q,Z)|0,t[p]=z,t[p+1]=q}for(var G=0;G<160;G+=2){z=t[G],q=t[G+1];var le=Ur(r,n,i),K=Ur(E,u,m),ee=Hr(r,E),Y=Hr(E,r),te=qr(l,R),ue=qr(R,l),re=$r[G],V=$r[G+1],he=Fr(l,c,d),ne=Fr(R,A,w),_=s+ue|0,h=b+te+j(_,s)|0;_=_+ne|0,h=h+he+j(_,ne)|0,_=_+V|0,h=h+re+j(_,V)|0,_=_+q|0,h=h+z+j(_,q)|0;var x=Y+K|0,k=ee+le+j(x,Y)|0;b=d,s=w,d=c,w=A,c=l,A=R,R=v+_|0,l=f+h+j(R,v)|0,f=i,v=m,i=n,m=u,n=r,u=E,E=_+x|0,r=h+k+j(E,_)|0}this._al=this._al+E|0,this._bl=this._bl+u|0,this._cl=this._cl+m|0,this._dl=this._dl+v|0,this._el=this._el+R|0,this._fl=this._fl+A|0,this._gl=this._gl+w|0,this._hl=this._hl+s|0,this._ah=this._ah+r+j(this._al,E)|0,this._bh=this._bh+n+j(this._bl,u)|0,this._ch=this._ch+i+j(this._cl,m)|0,this._dh=this._dh+f+j(this._dl,v)|0,this._eh=this._eh+l+j(this._el,R)|0,this._fh=this._fh+c+j(this._fl,A)|0,this._gh=this._gh+d+j(this._gl,w)|0,this._hh=this._hh+b+j(this._hl,s)|0};$e.prototype._hash=function(){var e=da.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Sn=$e,wa=J,xa=Sn,Ea=Ae,ma=be.Buffer,Sa=new Array(160);function Qe(){this.init(),this._w=Sa,Ea.call(this,128,112)}wa(Qe,xa);Qe.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};Qe.prototype._hash=function(){var e=ma.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ra=Qe,ve=vn.exports=function(t){t=t.toLowerCase();var r=ve[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ve.sha=Hi;ve.sha1=Xi;ve.sha224=_a;ve.sha256=En;ve.sha384=Ra;ve.sha512=Sn;var Ja=vn.exports,Fe,$,Rn,Tn,de,jr,An,sr,br,lr,ur,Cn,Ne={},Bn=[],Ta=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ze=Array.isArray;function oe(e,t){for(var r in t)e[r]=t[r];return e}function kn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hr(e,t,r){var n,i,f,l={};for(f in t)f=="key"?n=t[f]:f=="ref"?i=t[f]:l[f]=t[f];if(arguments.length>2&&(l.children=arguments.length>3?Fe.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(f in e.defaultProps)l[f]===void 0&&(l[f]=e.defaultProps[f]);return ke(e,l,n,i,null)}function ke(e,t,r,n,i){var f={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Rn,__i:-1,__u:0};return i==null&&$.vnode!=null&&$.vnode(f),f}function Aa(){return{current:null}}function Ue(e){return e.children}function Me(e,t){this.props=e,this.context=t}function Se(e,t){if(t==null)return e.__?Se(e.__,e.__i+1):null;for(var r;tt&&de.sort(sr));Ve.__r=0}function Dn(e,t,r,n,i,f,l,c,d,b,E){var u,m,v,R,A,w=n&&n.__k||Bn,s=t.length;for(r.__d=d,Ca(r,t,w),d=r.__d,u=0;u0?ke(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,f=null,(c=i.__i=Ba(i,r,l,E))!==-1&&(E--,(f=r[c])&&(f.__u|=131072)),f==null||f.__v===null?(c==-1&&u--,typeof i.type!="function"&&(i.__u|=65536)):c!==l&&(c==l-1?u--:c==l+1?u++:(c>l?u--:u++,i.__u|=65536))):i=e.__k[n]=null;if(E)for(n=0;n(d!=null&&!(131072&d.__u)?1:0))for(;l>=0||c=0){if((d=t[l])&&!(131072&d.__u)&&i==d.key&&f===d.type)return l;l--}if(c2&&(c.children=arguments.length>3?Fe.call(arguments,2):r),ke(e.type,c,n||e.key,i||e.ref,null)}function Na(e,t){var r={__c:t="__cC"+Cn++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,f;return this.getChildContext||(i=new Set,(f={})[t]=this,this.getChildContext=function(){return f},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(l){this.props.value!==l.value&&i.forEach(function(c){c.__e=!0,_r(c)})},this.sub=function(l){i.add(l);var c=l.componentWillUnmount;l.componentWillUnmount=function(){i&&i.delete(l),c&&c.call(l)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}Fe=Bn.slice,$={__e:function(e,t,r,n){for(var i,f,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((f=i.constructor)&&f.getDerivedStateFromError!=null&&(i.setState(f.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),l=i.__d),l)return i.__E=i}catch(c){e=c}throw e}},Rn=0,Tn=function(e){return e!=null&&e.constructor==null},Me.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},r),this.props)),e&&oe(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Me.prototype.render=Ue,de=[],An=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sr=function(e,t){return e.__v.__b-t.__v.__b},Ve.__r=0,br=0,lr=zr(!1),ur=zr(!0),Cn=0;const La=Object.freeze(Object.defineProperty({__proto__:null,Component:Me,Fragment:Ue,cloneElement:Da,createContext:Na,createElement:hr,createRef:Aa,h:hr,hydrate:$n,get isValidElement(){return Tn},get options(){return $},render:In,toChildArray:Ln},Symbol.toStringTag,{value:"Module"})),Qa=dr(La);var se,I,ir,Gr,Re=0,Fn=[],H=$,Vr=H.__b,Kr=H.__r,Yr=H.diffed,Xr=H.__c,Jr=H.unmount,Qr=H.__;function ge(e,t){H.__h&&H.__h(I,e,Re||t),Re=0;var r=I.__H||(I.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Un(e){return Re=1,Hn(jn,e)}function Hn(e,t,r){var n=ge(se++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):jn(void 0,t),function(c){var d=n.__N?n.__N[0]:n.__[0],b=n.t(d,c);d!==b&&(n.__N=[b,n.__[1]],n.__c.setState({}))}],n.__c=I,!I.u)){var i=function(c,d,b){if(!n.__c.__H)return!0;var E=n.__c.__H.__.filter(function(m){return!!m.__c});if(E.every(function(m){return!m.__N}))return!f||f.call(this,c,d,b);var u=!1;return E.forEach(function(m){if(m.__N){var v=m.__[0];m.__=m.__N,m.__N=void 0,v!==m.__[0]&&(u=!0)}}),!(!u&&n.__c.props===c)&&(!f||f.call(this,c,d,b))};I.u=!0;var f=I.shouldComponentUpdate,l=I.componentWillUpdate;I.componentWillUpdate=function(c,d,b){if(this.__e){var E=f;f=void 0,i(c,d,b),f=E}l&&l.call(this,c,d,b)},I.shouldComponentUpdate=i}return n.__N||n.__}function Pa(e,t){var r=ge(se++,3);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,I.__H.__h.push(r))}function qn(e,t){var r=ge(se++,4);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,I.__h.push(r))}function Oa(e){return Re=5,yr(function(){return{current:e}},[])}function Ia(e,t,r){Re=6,qn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function yr(e,t){var r=ge(se++,7);return wr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Re=8,yr(function(){return e},t)}function Fa(e){var t=I.context[e.__c],r=ge(se++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(I)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=ge(se++,10),r=Un();return t.__=e,I.componentDidCatch||(I.componentDidCatch=function(n,i){t.__&&t.__(n,i),r[1](n)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=ge(se++,11);if(!e.__){for(var t=I.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function ja(){for(var e;e=Fn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ze),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){I=null,Vr&&Vr(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Qr&&Qr(e,t)},H.__r=function(e){Kr&&Kr(e),se=0;var t=(I=e.__c).__H;t&&(ir===I?(t.__h=[],I.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(ze),t.__h.forEach(cr),t.__h=[],se=0)),ir=I},H.diffed=function(e){Yr&&Yr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fn.push(t)!==1&&Gr===H.requestAnimationFrame||((Gr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ir=I=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ze),r.__h=r.__h.filter(function(n){return!n.__||cr(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],H.__e(n,r.__v)}}),Xr&&Xr(e,t)},H.unmount=function(e){Jr&&Jr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ze(n)}catch(i){t=i}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Zr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(n),Zr&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Zr&&(t=requestAnimationFrame(r))}function ze(e){var t=I,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),I=t}function cr(e){var t=I;e.__c=e.__(),I=t}function wr(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function jn(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:Pa,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:qn,useMemo:yr,useReducer:Hn,useRef:Oa,useState:Un},Symbol.toStringTag,{value:"Module"})),Za=dr(za);export{Za as a,Ya as b,Xa as j,Qa as r,Ja as s}; +import{E as xr,g as dr,m as Le,d as Ee}from"./index-CP6_TFKv.js";import{e as en}from"./events-0WpuQ3DP.js";import{r as tn,i as J}from"./inherits_browser-C53US4G5.js";const Wn=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xr,default:xr},Symbol.toStringTag,{value:"Module"})),Ya=dr(Wn);var ar={exports:{}},rn=en.EventEmitter,Yt,Er;function zn(){if(Er)return Yt;Er=1;function e(R,A){var w=Object.keys(R);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(R);A&&(s=s.filter(function(p){return Object.getOwnPropertyDescriptor(R,p).enumerable})),w.push.apply(w,s)}return w}function t(R){for(var A=1;A0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(w){var s={data:w,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var w=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,w}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(w){if(this.length===0)return"";for(var s=this.head,p=""+s.data;s=s.next;)p+=w+s.data;return p}},{key:"concat",value:function(w){if(this.length===0)return b.alloc(0);for(var s=b.allocUnsafe(w>>>0),p=this.head,y=0;p;)v(p.data,s,y),y+=p.data.length,p=p.next;return s}},{key:"consume",value:function(w,s){var p;return wS.length?S.length:w;if(T===S.length?y+=S:y+=S.slice(0,w),w-=T,w===0){T===S.length?(++p,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=S.slice(T));break}++p}return this.length-=p,y}},{key:"_getBuffer",value:function(w){var s=b.allocUnsafe(w),p=this.head,y=1;for(p.data.copy(s),w-=p.data.length;p=p.next;){var S=p.data,T=w>S.length?S.length:w;if(S.copy(s,s.length-w,0,T),w-=T,w===0){T===S.length?(++y,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=S.slice(T));break}++y}return this.length-=y,s}},{key:m,value:function(w,s){return u(this,t(t({},s),{},{depth:0,customInspect:!1}))}}]),R}(),Yt}function Gn(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(or,this,e)):process.nextTick(or,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(f){!t&&f?r._writableState?r._writableState.errorEmitted?process.nextTick(We,r):(r._writableState.errorEmitted=!0,process.nextTick(mr,r,f)):process.nextTick(mr,r,f):t?(process.nextTick(We,r),t(f)):process.nextTick(We,r)}),this)}function mr(e,t){or(e,t),We(e)}function We(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Vn(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function or(e,t){e.emit("error",t)}function Kn(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var nn={destroy:Gn,undestroy:Vn,errorOrDestroy:Kn},pe={};function Yn(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var an={};function X(e,t,r){r||(r=Error);function n(f,l,c){return typeof t=="string"?t:t(f,l,c)}var i=function(f){Yn(l,f);function l(c,d,b){return f.call(this,n(c,d,b))||this}return l}(r);i.prototype.name=r.name,i.prototype.code=e,an[e]=i}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Xn(e,t,r){return e.substr(0,t.length)===t}function Jn(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Qn(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}X("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);X("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Xn(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Jn(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Sr(t,"type"));else{var f=Qn(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(f," ").concat(n," ").concat(Sr(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);X("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");X("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});X("ERR_STREAM_PREMATURE_CLOSE","Premature close");X("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});X("ERR_MULTIPLE_CALLBACK","Callback called multiple times");X("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");X("ERR_STREAM_WRITE_AFTER_END","write after end");X("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);X("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);X("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");pe.codes=an;var Zn=pe.codes.ERR_INVALID_OPT_VALUE;function ei(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ti(e,t,r,n){var i=ei(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var f=n?r:"highWaterMark";throw new Zn(f,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var on={getHighWaterMark:ti},ri=ni;function ni(e,t){if(Xt("noDeprecation"))return e;var r=!1;function n(){if(!r){if(Xt("throwDeprecation"))throw new Error(t);Xt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function Xt(e){try{if(!Ee.localStorage)return!1}catch{return!1}var t=Ee.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Jt,Rr;function fn(){if(Rr)return Jt;Rr=1,Jt=D;function e(_){var h=this;this.next=null,this.entry=null,this.finish=function(){ne(h,_)}}var t;D.WritableState=B;var r={deprecate:ri},n=rn,i=Le.Buffer,f=(typeof Ee<"u"?Ee:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(_){return i.from(_)}function c(_){return i.isBuffer(_)||_ instanceof f}var d=nn,b=on,E=b.getHighWaterMark,u=pe.codes,m=u.ERR_INVALID_ARG_TYPE,v=u.ERR_METHOD_NOT_IMPLEMENTED,R=u.ERR_MULTIPLE_CALLBACK,A=u.ERR_STREAM_CANNOT_PIPE,w=u.ERR_STREAM_DESTROYED,s=u.ERR_STREAM_NULL_VALUES,p=u.ERR_STREAM_WRITE_AFTER_END,y=u.ERR_UNKNOWN_ENCODING,S=d.errorOrDestroy;J(D,n);function T(){}function B(_,h,x){t=t||me(),_=_||{},typeof x!="boolean"&&(x=h instanceof t),this.objectMode=!!_.objectMode,x&&(this.objectMode=this.objectMode||!!_.writableObjectMode),this.highWaterMark=E(this,_,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var k=_.decodeStrings===!1;this.decodeStrings=!k,this.defaultEncoding=_.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(L){le(h,L)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=_.emitClose!==!1,this.autoDestroy=!!_.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}B.prototype.getBuffer=function(){for(var h=this.bufferedRequest,x=[];h;)x.push(h),h=h.next;return x},function(){try{Object.defineProperty(B.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var O;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(O=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(h){return O.call(this,h)?!0:this!==D?!1:h&&h._writableState instanceof B}})):O=function(h){return h instanceof this};function D(_){t=t||me();var h=this instanceof t;if(!h&&!O.call(D,this))return new D(_);this._writableState=new B(_,this,h),this.writable=!0,_&&(typeof _.write=="function"&&(this._write=_.write),typeof _.writev=="function"&&(this._writev=_.writev),typeof _.destroy=="function"&&(this._destroy=_.destroy),typeof _.final=="function"&&(this._final=_.final)),n.call(this)}D.prototype.pipe=function(){S(this,new A)};function M(_,h){var x=new p;S(_,x),process.nextTick(h,x)}function F(_,h,x,k){var L;return x===null?L=new s:typeof x!="string"&&!h.objectMode&&(L=new m("chunk",["string","Buffer"],x)),L?(S(_,L),process.nextTick(k,L),!1):!0}D.prototype.write=function(_,h,x){var k=this._writableState,L=!1,a=!k.objectMode&&c(_);return a&&!i.isBuffer(_)&&(_=l(_)),typeof h=="function"&&(x=h,h=null),a?h="buffer":h||(h=k.defaultEncoding),typeof x!="function"&&(x=T),k.ending?M(this,x):(a||F(this,k,_,x))&&(k.pendingcb++,L=Z(this,k,a,_,h,x)),L},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var _=this._writableState;_.corked&&(_.corked--,!_.writing&&!_.corked&&!_.bufferProcessing&&_.bufferedRequest&&Y(this,_))},D.prototype.setDefaultEncoding=function(h){if(typeof h=="string"&&(h=h.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((h+"").toLowerCase())>-1))throw new y(h);return this._writableState.defaultEncoding=h,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function W(_,h,x){return!_.objectMode&&_.decodeStrings!==!1&&typeof h=="string"&&(h=i.from(h,x)),h}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(_,h,x,k,L,a){if(!x){var o=W(h,k,L);k!==o&&(x=!0,L="buffer",k=o)}var g=h.objectMode?1:k.length;h.length+=g;var C=h.length */var Ar;function ii(){return Ar||(Ar=1,function(e,t){var r=Le,n=r.Buffer;function i(l,c){for(var d in l)c[d]=l[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=f);function f(l,c,d){return n(l,c,d)}f.prototype=Object.create(n.prototype),i(n,f),f.from=function(l,c,d){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,c,d)},f.alloc=function(l,c,d){if(typeof l!="number")throw new TypeError("Argument must be a number");var b=n(l);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}}(qe,qe.exports)),qe.exports}var Cr;function Br(){if(Cr)return Zt;Cr=1;var e=ii().Buffer,t=e.isEncoding||function(s){switch(s=""+s,s&&s.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(s){if(!s)return"utf8";for(var p;;)switch(s){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 s;default:if(p)return;s=(""+s).toLowerCase(),p=!0}}function n(s){var p=r(s);if(typeof p!="string"&&(e.isEncoding===t||!t(s)))throw new Error("Unknown encoding: "+s);return p||s}Zt.StringDecoder=i;function i(s){this.encoding=n(s);var p;switch(this.encoding){case"utf16le":this.text=u,this.end=m,p=4;break;case"utf8":this.fillLast=d,p=4;break;case"base64":this.text=v,this.end=R,p=3;break;default:this.write=A,this.end=w;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}i.prototype.write=function(s){if(s.length===0)return"";var p,y;if(this.lastNeed){if(p=this.fillLast(s),p===void 0)return"";y=this.lastNeed,this.lastNeed=0}else y=0;return y>5===6?2:s>>4===14?3:s>>3===30?4:s>>6===2?-1:-2}function l(s,p,y){var S=p.length-1;if(S=0?(T>0&&(s.lastNeed=T-1),T):--S=0?(T>0&&(s.lastNeed=T-2),T):--S=0?(T>0&&(T===2?T=0:s.lastNeed=T-3),T):0))}function c(s,p,y){if((p[0]&192)!==128)return s.lastNeed=0,"�";if(s.lastNeed>1&&p.length>1){if((p[1]&192)!==128)return s.lastNeed=1,"�";if(s.lastNeed>2&&p.length>2&&(p[2]&192)!==128)return s.lastNeed=2,"�"}}function d(s){var p=this.lastTotal-this.lastNeed,y=c(this,s);if(y!==void 0)return y;if(this.lastNeed<=s.length)return s.copy(this.lastChar,p,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);s.copy(this.lastChar,p,0,s.length),this.lastNeed-=s.length}function b(s,p){var y=l(this,s,p);if(!this.lastNeed)return s.toString("utf8",p);this.lastTotal=y;var S=s.length-(y-this.lastNeed);return s.copy(this.lastChar,0,S),s.toString("utf8",p,S)}function E(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+"�":p}function u(s,p){if((s.length-p)%2===0){var y=s.toString("utf16le",p);if(y){var S=y.charCodeAt(y.length-1);if(S>=55296&&S<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1],y.slice(0,-1)}return y}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=s[s.length-1],s.toString("utf16le",p,s.length-1)}function m(s){var p=s&&s.length?this.write(s):"";if(this.lastNeed){var y=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,y)}return p}function v(s,p){var y=(s.length-p)%3;return y===0?s.toString("base64",p):(this.lastNeed=3-y,this.lastTotal=3,y===1?this.lastChar[0]=s[s.length-1]:(this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1]),s.toString("base64",p,s.length-y))}function R(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function A(s){return s.toString(this.encoding)}function w(s){return s&&s.length?this.write(s):""}return Zt}var kr=pe.codes.ERR_STREAM_PREMATURE_CLOSE;function ai(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof o!="string"&&!N.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=f(o)),C)N.endEmitted?T(a,new s):W(a,N,o,!0);else if(N.ended)T(a,new A);else{if(N.destroyed)return!1;N.reading=!1,N.decoder&&!g?(o=N.decoder.write(o),N.objectMode||o.length!==0?W(a,N,o,!1):Y(a,N)):W(a,N,o,!1)}else C||(N.reading=!1,Y(a,N))}return!N.ended&&(N.length=q?a=q:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function G(a,o){return a<=0||o.length===0&&o.ended?0:o.objectMode?1:a!==a?o.flowing&&o.length?o.buffer.head.data.length:o.length:(a>o.highWaterMark&&(o.highWaterMark=z(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}M.prototype.read=function(a){d("read",a),a=parseInt(a,10);var o=this._readableState,g=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return d("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=G(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var C=o.needReadable;d("need readable",C),(o.length===0||o.length-a0?U=h(a,o):U=null,U===null?(o.needReadable=o.length<=o.highWaterMark,a=0):(o.length-=a,o.awaitDrain=0),o.length===0&&(o.ended||(o.needReadable=!0),g!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function le(a,o){if(d("onEofChunk"),!o.ended){if(o.decoder){var g=o.decoder.end();g&&g.length&&(o.buffer.push(g),o.length+=o.objectMode?1:g.length)}o.ended=!0,o.sync?K(a):(o.needReadable=!1,o.emittedReadable||(o.emittedReadable=!0,ee(a)))}}function K(a){var o=a._readableState;d("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(d("emitReadable",o.flowing),o.emittedReadable=!0,process.nextTick(ee,a))}function ee(a){var o=a._readableState;d("emitReadable_",o.destroyed,o.length,o.ended),!o.destroyed&&(o.length||o.ended)&&(a.emit("readable"),o.emittedReadable=!1),o.needReadable=!o.flowing&&!o.ended&&o.length<=o.highWaterMark,_(a)}function Y(a,o){o.readingMore||(o.readingMore=!0,process.nextTick(te,a,o))}function te(a,o){for(;!o.reading&&!o.ended&&(o.length1&&L(C.pipes,a)!==-1)&&!Ce&&(d("false write response, pause",C.awaitDrain),C.awaitDrain++),g.pause())}function ye(ae){d("onerror",ae),_e(),a.removeListener("error",ye),t(a,"error")===0&&T(a,ae)}O(a,"error",ye);function we(){a.removeListener("finish",xe),_e()}a.once("close",we);function xe(){d("onfinish"),a.removeListener("close",we),_e()}a.once("finish",xe);function _e(){d("unpipe"),g.unpipe(a)}return a.emit("pipe",g),C.flowing||(d("pipe resume"),g.resume()),a};function ue(a){return function(){var g=a._readableState;d("pipeOnDrain",g.awaitDrain),g.awaitDrain&&g.awaitDrain--,g.awaitDrain===0&&t(a,"data")&&(g.flowing=!0,_(a))}}M.prototype.unpipe=function(a){var o=this._readableState,g={hasUnpiped:!1};if(o.pipesCount===0)return this;if(o.pipesCount===1)return a&&a!==o.pipes?this:(a||(a=o.pipes),o.pipes=null,o.pipesCount=0,o.flowing=!1,a&&a.emit("unpipe",this,g),this);if(!a){var C=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var N=0;N0,C.flowing!==!1&&this.resume()):a==="readable"&&!C.endEmitted&&!C.readableListening&&(C.readableListening=C.needReadable=!0,C.flowing=!1,C.emittedReadable=!1,d("on readable",C.length,C.reading),C.length?K(this):C.reading||process.nextTick(V,this)),g},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(a,o){var g=r.prototype.removeListener.call(this,a,o);return a==="readable"&&process.nextTick(re,this),g},M.prototype.removeAllListeners=function(a){var o=r.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&process.nextTick(re,this),o};function re(a){var o=a._readableState;o.readableListening=a.listenerCount("readable")>0,o.resumeScheduled&&!o.paused?o.flowing=!0:a.listenerCount("data")>0&&a.resume()}function V(a){d("readable nexttick read 0"),a.read(0)}M.prototype.resume=function(){var a=this._readableState;return a.flowing||(d("resume"),a.flowing=!a.readableListening,he(this,a)),a.paused=!1,this};function he(a,o){o.resumeScheduled||(o.resumeScheduled=!0,process.nextTick(ne,a,o))}function ne(a,o){d("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),_(a),o.flowing&&!o.reading&&a.read(0)}M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function _(a){var o=a._readableState;for(d("flow",o.flowing);o.flowing&&a.read()!==null;);}M.prototype.wrap=function(a){var o=this,g=this._readableState,C=!1;a.on("end",function(){if(d("wrapped end"),g.decoder&&!g.ended){var P=g.decoder.end();P&&P.length&&o.push(P)}o.push(null)}),a.on("data",function(P){if(d("wrapped data"),g.decoder&&(P=g.decoder.write(P)),!(g.objectMode&&P==null)&&!(!g.objectMode&&(!P||!P.length))){var ie=o.push(P);ie||(C=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(ie){return function(){return a[ie].apply(a,arguments)}}(U));for(var N=0;N=o.length?(o.decoder?g=o.buffer.join(""):o.buffer.length===1?g=o.buffer.first():g=o.buffer.concat(o.length),o.buffer.clear()):g=o.buffer.consume(a,o.decoder),g}function x(a){var o=a._readableState;d("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,process.nextTick(k,o,a))}function k(a,o){if(d("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var g=o._writableState;(!g||g.autoDestroy&&g.finished)&&o.destroy()}}typeof Symbol=="function"&&(M.from=function(a,o){return S===void 0&&(S=li()),S(M,a,o)});function L(a,o){for(var g=0,C=a.length;g0;return xi(l,d,b,function(E){i||(i=E),E&&f.forEach(Or),!d&&(f.forEach(Or),n(i))})});return t.reduce(Ei)}var Ri=Si;(function(e,t){t=e.exports=ln(),t.Stream=t,t.Readable=t,t.Writable=fn(),t.Duplex=me(),t.Transform=un,t.PassThrough=bi,t.finished=pr,t.pipeline=Ri})(ar,ar.exports);var cn=ar.exports;const{Transform:Ti}=cn;var Ai=e=>class dn extends Ti{constructor(r,n,i,f,l){super(l),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=f,this._options=l,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(l){f=l}i(f)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new dn(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Ci}=cn;var Bi=e=>class pn extends Ci{constructor(r,n,i,f){super(f),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=f,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let f=null;try{this.update(r,n)}catch(l){f=l}i(f)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new pn(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const ki=Ai,Mi=Bi;var Di=function(e){const t=ki(e),r=Mi(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},bn={};const Ir=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];bn.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],f=e[3]^e[13]^e[23]^e[33]^e[43],l=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],b=e[7]^e[17]^e[27]^e[37]^e[47],E=e[8]^e[18]^e[28]^e[38]^e[48],u=e[9]^e[19]^e[29]^e[39]^e[49];let m=E^(i<<1|f>>>31),v=u^(f<<1|i>>>31);const R=e[0]^m,A=e[1]^v,w=e[10]^m,s=e[11]^v,p=e[20]^m,y=e[21]^v,S=e[30]^m,T=e[31]^v,B=e[40]^m,O=e[41]^v;m=r^(l<<1|c>>>31),v=n^(c<<1|l>>>31);const D=e[2]^m,M=e[3]^v,F=e[12]^m,W=e[13]^v,Z=e[22]^m,q=e[23]^v,z=e[32]^m,G=e[33]^v,le=e[42]^m,K=e[43]^v;m=i^(d<<1|b>>>31),v=f^(b<<1|d>>>31);const ee=e[4]^m,Y=e[5]^v,te=e[14]^m,ue=e[15]^v,re=e[24]^m,V=e[25]^v,he=e[34]^m,ne=e[35]^v,_=e[44]^m,h=e[45]^v;m=l^(E<<1|u>>>31),v=c^(u<<1|E>>>31);const x=e[6]^m,k=e[7]^v,L=e[16]^m,a=e[17]^v,o=e[26]^m,g=e[27]^v,C=e[36]^m,U=e[37]^v,N=e[46]^m,P=e[47]^v;m=d^(r<<1|n>>>31),v=b^(n<<1|r>>>31);const ie=e[8]^m,ce=e[9]^v,Ce=e[18]^m,He=e[19]^v,Be=e[28]^m,ye=e[29]^v,we=e[38]^m,xe=e[39]^v,_e=e[48]^m,ae=e[49]^v,Q=R,et=A,tt=s<<4|w>>>28,rt=w<<4|s>>>28,nt=p<<3|y>>>29,it=y<<3|p>>>29,at=T<<9|S>>>23,ot=S<<9|T>>>23,ft=B<<18|O>>>14,st=O<<18|B>>>14,lt=D<<1|M>>>31,ut=M<<1|D>>>31,ht=W<<12|F>>>20,_t=F<<12|W>>>20,ct=Z<<10|q>>>22,dt=q<<10|Z>>>22,pt=G<<13|z>>>19,bt=z<<13|G>>>19,vt=le<<2|K>>>30,gt=K<<2|le>>>30,yt=Y<<30|ee>>>2,wt=ee<<30|Y>>>2,xt=te<<6|ue>>>26,Et=ue<<6|te>>>26,mt=V<<11|re>>>21,St=re<<11|V>>>21,Rt=he<<15|ne>>>17,Tt=ne<<15|he>>>17,At=h<<29|_>>>3,Ct=_<<29|h>>>3,Bt=x<<28|k>>>4,kt=k<<28|x>>>4,Mt=a<<23|L>>>9,Dt=L<<23|a>>>9,Nt=o<<25|g>>>7,Lt=g<<25|o>>>7,Pt=C<<21|U>>>11,Ot=U<<21|C>>>11,It=P<<24|N>>>8,$t=N<<24|P>>>8,Ft=ie<<27|ce>>>5,Ut=ce<<27|ie>>>5,Ht=Ce<<20|He>>>12,qt=He<<20|Ce>>>12,jt=ye<<7|Be>>>25,Wt=Be<<7|ye>>>25,zt=we<<8|xe>>>24,Gt=xe<<8|we>>>24,Vt=_e<<14|ae>>>18,Kt=ae<<14|_e>>>18;e[0]=Q^~ht&mt,e[1]=et^~_t&St,e[10]=Bt^~Ht&nt,e[11]=kt^~qt&it,e[20]=lt^~xt&Nt,e[21]=ut^~Et&Lt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Dt&Wt,e[2]=ht^~mt&Pt,e[3]=_t^~St&Ot,e[12]=Ht^~nt&pt,e[13]=qt^~it&bt,e[22]=xt^~Nt&zt,e[23]=Et^~Lt&Gt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Dt^~Wt&ot,e[4]=mt^~Pt&Vt,e[5]=St^~Ot&Kt,e[14]=nt^~pt&At,e[15]=it^~bt&Ct,e[24]=Nt^~zt&ft,e[25]=Lt^~Gt&st,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Pt^~Vt&Q,e[7]=Ot^~Kt&et,e[16]=pt^~At&Bt,e[17]=bt^~Ct&kt,e[26]=zt^~ft<,e[27]=Gt^~st&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Vt^~Q&ht,e[9]=Kt^~et&_t,e[18]=At^~Bt&Ht,e[19]=Ct^~kt&qt,e[28]=ft^~lt&xt,e[29]=st^~ut&Et,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Dt,e[0]^=Ir[t*2],e[1]^=Ir[t*2+1]}};const Ge=bn;function Te(){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}Te.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};Te.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(Ge.p1600(this.state),this.count=0);return t};Te.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Ni=Te,Xa=Di(Ni),vn={exports:{}},fr={exports:{}};(function(e,t){var r=Le,n=r.Buffer;function i(l,c){for(var d in l)c[d]=l[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=f);function f(l,c,d){return n(l,c,d)}i(n,f),f.from=function(l,c,d){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,c,d)},f.alloc=function(l,c,d){if(typeof l!="number")throw new TypeError("Argument must be a number");var b=n(l);return c!==void 0?typeof d=="string"?b.fill(c,d):b.fill(c):b.fill(0),b},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}})(fr,fr.exports);var be=fr.exports,gn=be.Buffer;function Xe(e,t){this._block=gn.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Xe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=gn.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,f=this._len,l=0;l=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var f=this._hash();return e?f.toString(e):f};Xe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Ae=Xe,Li=J,yn=Ae,Pi=be.Buffer,Oi=[1518500249,1859775393,-1894007588,-899497514],Ii=new Array(80);function Pe(){this.init(),this._w=Ii,yn.call(this,64,56)}Li(Pe,yn);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $i(e){return e<<5|e>>>27}function Fi(e){return e<<30|e>>>2}function Ui(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=t[c-3]^t[c-8]^t[c-14]^t[c-16];for(var d=0;d<80;++d){var b=~~(d/20),E=$i(r)+Ui(b,n,i,f)+l+t[d]+Oi[b]|0;l=f,f=i,i=Fi(n),n=r,r=E}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Pe.prototype._hash=function(){var e=Pi.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Hi=Pe,qi=J,wn=Ae,ji=be.Buffer,Wi=[1518500249,1859775393,-1894007588,-899497514],zi=new Array(80);function Oe(){this.init(),this._w=zi,wn.call(this,64,56)}qi(Oe,wn);Oe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Gi(e){return e<<1|e>>>31}function Vi(e){return e<<5|e>>>27}function Ki(e){return e<<30|e>>>2}function Yi(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}Oe.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=0;c<16;++c)t[c]=e.readInt32BE(c*4);for(;c<80;++c)t[c]=Gi(t[c-3]^t[c-8]^t[c-14]^t[c-16]);for(var d=0;d<80;++d){var b=~~(d/20),E=Vi(r)+Yi(b,n,i,f)+l+t[d]+Wi[b]|0;l=f,f=i,i=Ki(n),n=r,r=E}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Oe.prototype._hash=function(){var e=ji.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Xi=Oe,Ji=J,xn=Ae,Qi=be.Buffer,Zi=[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],ea=new Array(64);function Ie(){this.init(),this._w=ea,xn.call(this,64,56)}Ji(Ie,xn);Ie.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function ta(e,t,r){return r^e&(t^r)}function ra(e,t,r){return e&t|r&(e|t)}function na(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function ia(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function aa(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function oa(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Ie.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,f=this._d|0,l=this._e|0,c=this._f|0,d=this._g|0,b=this._h|0,E=0;E<16;++E)t[E]=e.readInt32BE(E*4);for(;E<64;++E)t[E]=oa(t[E-2])+t[E-7]+aa(t[E-15])+t[E-16]|0;for(var u=0;u<64;++u){var m=b+ia(l)+ta(l,c,d)+Zi[u]+t[u]|0,v=na(r)+ra(r,n,i)|0;b=d,d=c,c=l,l=f+m|0,f=i,i=n,n=r,r=m+v|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0,this._f=c+this._f|0,this._g=d+this._g|0,this._h=b+this._h|0};Ie.prototype._hash=function(){var e=Qi.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var En=Ie,fa=J,sa=En,la=Ae,ua=be.Buffer,ha=new Array(64);function Je(){this.init(),this._w=ha,la.call(this,64,56)}fa(Je,sa);Je.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};Je.prototype._hash=function(){var e=ua.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _a=Je,ca=J,mn=Ae,da=be.Buffer,$r=[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],pa=new Array(160);function $e(){this.init(),this._w=pa,mn.call(this,128,112)}ca($e,mn);$e.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Fr(e,t,r){return r^e&(t^r)}function Ur(e,t,r){return e&t|r&(e|t)}function Hr(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function qr(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ba(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function va(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ga(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function ya(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function j(e,t){return e>>>0>>0?1:0}$e.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,f=this._dh|0,l=this._eh|0,c=this._fh|0,d=this._gh|0,b=this._hh|0,E=this._al|0,u=this._bl|0,m=this._cl|0,v=this._dl|0,R=this._el|0,A=this._fl|0,w=this._gl|0,s=this._hl|0,p=0;p<32;p+=2)t[p]=e.readInt32BE(p*4),t[p+1]=e.readInt32BE(p*4+4);for(;p<160;p+=2){var y=t[p-30],S=t[p-15*2+1],T=ba(y,S),B=va(S,y);y=t[p-2*2],S=t[p-2*2+1];var O=ga(y,S),D=ya(S,y),M=t[p-7*2],F=t[p-7*2+1],W=t[p-16*2],Z=t[p-16*2+1],q=B+F|0,z=T+M+j(q,B)|0;q=q+D|0,z=z+O+j(q,D)|0,q=q+Z|0,z=z+W+j(q,Z)|0,t[p]=z,t[p+1]=q}for(var G=0;G<160;G+=2){z=t[G],q=t[G+1];var le=Ur(r,n,i),K=Ur(E,u,m),ee=Hr(r,E),Y=Hr(E,r),te=qr(l,R),ue=qr(R,l),re=$r[G],V=$r[G+1],he=Fr(l,c,d),ne=Fr(R,A,w),_=s+ue|0,h=b+te+j(_,s)|0;_=_+ne|0,h=h+he+j(_,ne)|0,_=_+V|0,h=h+re+j(_,V)|0,_=_+q|0,h=h+z+j(_,q)|0;var x=Y+K|0,k=ee+le+j(x,Y)|0;b=d,s=w,d=c,w=A,c=l,A=R,R=v+_|0,l=f+h+j(R,v)|0,f=i,v=m,i=n,m=u,n=r,u=E,E=_+x|0,r=h+k+j(E,_)|0}this._al=this._al+E|0,this._bl=this._bl+u|0,this._cl=this._cl+m|0,this._dl=this._dl+v|0,this._el=this._el+R|0,this._fl=this._fl+A|0,this._gl=this._gl+w|0,this._hl=this._hl+s|0,this._ah=this._ah+r+j(this._al,E)|0,this._bh=this._bh+n+j(this._bl,u)|0,this._ch=this._ch+i+j(this._cl,m)|0,this._dh=this._dh+f+j(this._dl,v)|0,this._eh=this._eh+l+j(this._el,R)|0,this._fh=this._fh+c+j(this._fl,A)|0,this._gh=this._gh+d+j(this._gl,w)|0,this._hh=this._hh+b+j(this._hl,s)|0};$e.prototype._hash=function(){var e=da.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Sn=$e,wa=J,xa=Sn,Ea=Ae,ma=be.Buffer,Sa=new Array(160);function Qe(){this.init(),this._w=Sa,Ea.call(this,128,112)}wa(Qe,xa);Qe.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};Qe.prototype._hash=function(){var e=ma.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ra=Qe,ve=vn.exports=function(t){t=t.toLowerCase();var r=ve[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ve.sha=Hi;ve.sha1=Xi;ve.sha224=_a;ve.sha256=En;ve.sha384=Ra;ve.sha512=Sn;var Ja=vn.exports,Fe,$,Rn,Tn,de,jr,An,sr,br,lr,ur,Cn,Ne={},Bn=[],Ta=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ze=Array.isArray;function oe(e,t){for(var r in t)e[r]=t[r];return e}function kn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hr(e,t,r){var n,i,f,l={};for(f in t)f=="key"?n=t[f]:f=="ref"?i=t[f]:l[f]=t[f];if(arguments.length>2&&(l.children=arguments.length>3?Fe.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(f in e.defaultProps)l[f]===void 0&&(l[f]=e.defaultProps[f]);return ke(e,l,n,i,null)}function ke(e,t,r,n,i){var f={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++Rn,__i:-1,__u:0};return i==null&&$.vnode!=null&&$.vnode(f),f}function Aa(){return{current:null}}function Ue(e){return e.children}function Me(e,t){this.props=e,this.context=t}function Se(e,t){if(t==null)return e.__?Se(e.__,e.__i+1):null;for(var r;tt&&de.sort(sr));Ve.__r=0}function Dn(e,t,r,n,i,f,l,c,d,b,E){var u,m,v,R,A,w=n&&n.__k||Bn,s=t.length;for(r.__d=d,Ca(r,t,w),d=r.__d,u=0;u0?ke(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,f=null,(c=i.__i=Ba(i,r,l,E))!==-1&&(E--,(f=r[c])&&(f.__u|=131072)),f==null||f.__v===null?(c==-1&&u--,typeof i.type!="function"&&(i.__u|=65536)):c!==l&&(c==l-1?u--:c==l+1?u++:(c>l?u--:u++,i.__u|=65536))):i=e.__k[n]=null;if(E)for(n=0;n(d!=null&&!(131072&d.__u)?1:0))for(;l>=0||c=0){if((d=t[l])&&!(131072&d.__u)&&i==d.key&&f===d.type)return l;l--}if(c2&&(c.children=arguments.length>3?Fe.call(arguments,2):r),ke(e.type,c,n||e.key,i||e.ref,null)}function Na(e,t){var r={__c:t="__cC"+Cn++,__:e,Consumer:function(n,i){return n.children(i)},Provider:function(n){var i,f;return this.getChildContext||(i=new Set,(f={})[t]=this,this.getChildContext=function(){return f},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(l){this.props.value!==l.value&&i.forEach(function(c){c.__e=!0,_r(c)})},this.sub=function(l){i.add(l);var c=l.componentWillUnmount;l.componentWillUnmount=function(){i&&i.delete(l),c&&c.call(l)}}),n.children}};return r.Provider.__=r.Consumer.contextType=r}Fe=Bn.slice,$={__e:function(e,t,r,n){for(var i,f,l;t=t.__;)if((i=t.__c)&&!i.__)try{if((f=i.constructor)&&f.getDerivedStateFromError!=null&&(i.setState(f.getDerivedStateFromError(e)),l=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),l=i.__d),l)return i.__E=i}catch(c){e=c}throw e}},Rn=0,Tn=function(e){return e!=null&&e.constructor==null},Me.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=oe({},this.state),typeof e=="function"&&(e=e(oe({},r),this.props)),e&&oe(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Me.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Me.prototype.render=Ue,de=[],An=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sr=function(e,t){return e.__v.__b-t.__v.__b},Ve.__r=0,br=0,lr=zr(!1),ur=zr(!0),Cn=0;const La=Object.freeze(Object.defineProperty({__proto__:null,Component:Me,Fragment:Ue,cloneElement:Da,createContext:Na,createElement:hr,createRef:Aa,h:hr,hydrate:$n,get isValidElement(){return Tn},get options(){return $},render:In,toChildArray:Ln},Symbol.toStringTag,{value:"Module"})),Qa=dr(La);var se,I,ir,Gr,Re=0,Fn=[],H=$,Vr=H.__b,Kr=H.__r,Yr=H.diffed,Xr=H.__c,Jr=H.unmount,Qr=H.__;function ge(e,t){H.__h&&H.__h(I,e,Re||t),Re=0;var r=I.__H||(I.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Un(e){return Re=1,Hn(jn,e)}function Hn(e,t,r){var n=ge(se++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):jn(void 0,t),function(c){var d=n.__N?n.__N[0]:n.__[0],b=n.t(d,c);d!==b&&(n.__N=[b,n.__[1]],n.__c.setState({}))}],n.__c=I,!I.u)){var i=function(c,d,b){if(!n.__c.__H)return!0;var E=n.__c.__H.__.filter(function(m){return!!m.__c});if(E.every(function(m){return!m.__N}))return!f||f.call(this,c,d,b);var u=!1;return E.forEach(function(m){if(m.__N){var v=m.__[0];m.__=m.__N,m.__N=void 0,v!==m.__[0]&&(u=!0)}}),!(!u&&n.__c.props===c)&&(!f||f.call(this,c,d,b))};I.u=!0;var f=I.shouldComponentUpdate,l=I.componentWillUpdate;I.componentWillUpdate=function(c,d,b){if(this.__e){var E=f;f=void 0,i(c,d,b),f=E}l&&l.call(this,c,d,b)},I.shouldComponentUpdate=i}return n.__N||n.__}function Pa(e,t){var r=ge(se++,3);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,I.__H.__h.push(r))}function qn(e,t){var r=ge(se++,4);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,I.__h.push(r))}function Oa(e){return Re=5,yr(function(){return{current:e}},[])}function Ia(e,t,r){Re=6,qn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function yr(e,t){var r=ge(se++,7);return wr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Re=8,yr(function(){return e},t)}function Fa(e){var t=I.context[e.__c],r=ge(se++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(I)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=ge(se++,10),r=Un();return t.__=e,I.componentDidCatch||(I.componentDidCatch=function(n,i){t.__&&t.__(n,i),r[1](n)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=ge(se++,11);if(!e.__){for(var t=I.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function ja(){for(var e;e=Fn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ze),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){I=null,Vr&&Vr(e)},H.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Qr&&Qr(e,t)},H.__r=function(e){Kr&&Kr(e),se=0;var t=(I=e.__c).__H;t&&(ir===I?(t.__h=[],I.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(ze),t.__h.forEach(cr),t.__h=[],se=0)),ir=I},H.diffed=function(e){Yr&&Yr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fn.push(t)!==1&&Gr===H.requestAnimationFrame||((Gr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),ir=I=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(ze),r.__h=r.__h.filter(function(n){return!n.__||cr(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],H.__e(n,r.__v)}}),Xr&&Xr(e,t)},H.unmount=function(e){Jr&&Jr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{ze(n)}catch(i){t=i}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Zr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(n),Zr&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Zr&&(t=requestAnimationFrame(r))}function ze(e){var t=I,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),I=t}function cr(e){var t=I;e.__c=e.__(),I=t}function wr(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function jn(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:Pa,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:qn,useMemo:yr,useReducer:Hn,useRef:Oa,useState:Un},Symbol.toStringTag,{value:"Module"})),Za=dr(za);export{Za as a,Ya as b,Xa as j,Qa as r,Ja as s}; diff --git a/buddybook/assets/index-D2uqR4Ry.js b/buddybook/assets/index-BNMaGkP5.js similarity index 99% rename from buddybook/assets/index-D2uqR4Ry.js rename to buddybook/assets/index-BNMaGkP5.js index 91588f5..c710029 100644 --- a/buddybook/assets/index-D2uqR4Ry.js +++ b/buddybook/assets/index-BNMaGkP5.js @@ -1 +1 @@ -import{d as M,g as sn,h as an}from"./index-B-6Lwopd.js";import{j as on,s as cn,r as _t,a as dn,b as ln}from"./hooks.module-D7M4pAco.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const un=(n,e)=>{let t;switch(n){case"standard":return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 `}};me.walletLogo=un;var be={},j={},U={};Object.defineProperty(U,"__esModule",{value:!0});U.errorValues=U.standardErrorCodes=void 0;U.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}};U.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 ye={},$e={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.serialize=n.getErrorCode=n.isValidCode=n.getMessageFromCode=n.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";n.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function r(d,p=t){if(d&&Number.isInteger(d)){const m=d.toString();if(h(e.errorValues,m))return e.errorValues[m].message;if(c(d))return n.JSON_RPC_SERVER_ERROR_MESSAGE}return p}n.getMessageFromCode=r;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}n.isValidCode=s;function i(d){var p;if(typeof d=="number")return d;if(a(d))return(p=d.code)!==null&&p!==void 0?p:d.errorCode}n.getErrorCode=i;function a(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}function o(d,{shouldIncludeStack:p=!1}={}){const m={};if(d&&typeof d=="object"&&!Array.isArray(d)&&h(d,"code")&&s(d.code)){const B=d;m.code=B.code,B.message&&typeof B.message=="string"?(m.message=B.message,h(B,"data")&&(m.data=B.data)):(m.message=r(m.code),m.data={originalError:l(d)})}else m.code=e.standardErrorCodes.rpc.internal,m.message=f(d,"message")?d.message:t,m.data={originalError:l(d)};return p&&(m.stack=f(d,"stack")?d.stack:void 0),m}n.serialize=o;function c(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function h(d,p){return Object.prototype.hasOwnProperty.call(d,p)}function f(d,p){return typeof d=="object"&&d!==null&&p in d&&typeof d[p]=="string"}})($e);Object.defineProperty(ye,"__esModule",{value:!0});ye.standardErrors=void 0;const v=U,St=$e;ye.standardErrors={rpc:{parse:n=>C(v.standardErrorCodes.rpc.parse,n),invalidRequest:n=>C(v.standardErrorCodes.rpc.invalidRequest,n),invalidParams:n=>C(v.standardErrorCodes.rpc.invalidParams,n),methodNotFound:n=>C(v.standardErrorCodes.rpc.methodNotFound,n),internal:n=>C(v.standardErrorCodes.rpc.internal,n),server:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=n;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,n)},invalidInput:n=>C(v.standardErrorCodes.rpc.invalidInput,n),resourceNotFound:n=>C(v.standardErrorCodes.rpc.resourceNotFound,n),resourceUnavailable:n=>C(v.standardErrorCodes.rpc.resourceUnavailable,n),transactionRejected:n=>C(v.standardErrorCodes.rpc.transactionRejected,n),methodNotSupported:n=>C(v.standardErrorCodes.rpc.methodNotSupported,n),limitExceeded:n=>C(v.standardErrorCodes.rpc.limitExceeded,n)},provider:{userRejectedRequest:n=>$(v.standardErrorCodes.provider.userRejectedRequest,n),unauthorized:n=>$(v.standardErrorCodes.provider.unauthorized,n),unsupportedMethod:n=>$(v.standardErrorCodes.provider.unsupportedMethod,n),disconnected:n=>$(v.standardErrorCodes.provider.disconnected,n),chainDisconnected:n=>$(v.standardErrorCodes.provider.chainDisconnected,n),unsupportedChain:n=>$(v.standardErrorCodes.provider.unsupportedChain,n),custom:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:r}=n;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,r)}}};function C(n,e){const[t,r]=Ct(e);return new kt(n,t||(0,St.getMessageFromCode)(n),r)}function $(n,e){const[t,r]=Ct(e);return new It(n,t||(0,St.getMessageFromCode)(n),r)}function Ct(n){if(n){if(typeof n=="string")return[n];if(typeof n=="object"&&!Array.isArray(n)){const{message:e,data:t}=n;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,t]}}return[]}class kt extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string.');super(t),this.code=e,r!==void 0&&(this.data=r)}}class It extends kt{constructor(e,t,r){if(!hn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function hn(n){return Number.isInteger(n)&&n>=1e3&&n<=4999}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.standardErrors=n.standardErrorCodes=void 0;var e=U;Object.defineProperty(n,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(n,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function gn(n){return n.errorMessage!==void 0}Q.isErrorResponse=gn;var K={};Object.defineProperty(K,"__esModule",{value:!0});K.LIB_VERSION=void 0;K.LIB_VERSION="4.0.4";Object.defineProperty(we,"__esModule",{value:!0});we.serializeError=void 0;const pn=Q,fn=K,mn=U,bn=$e;function yn(n,e){const t=(0,bn.serialize)(wn(n),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",fn.LIB_VERSION),r.searchParams.set("code",t.code.toString());const s=vn(t.data,e);return s&&r.searchParams.set("method",s),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}we.serializeError=yn;function wn(n){return typeof n=="string"?{message:n,code:mn.standardErrorCodes.rpc.internal}:(0,pn.isErrorResponse)(n)?Object.assign(Object.assign({},n),{message:n.errorMessage,code:n.errorCode,data:{method:n.method}}):n}function vn(n,e){const t=n==null?void 0:n.method;if(t)return t;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}var _={};Object.defineProperty(_,"__esModule",{value:!0});_.RegExpString=_.IntNumber=_.BigIntString=_.AddressString=_.HexString=_.OpaqueType=void 0;function ne(){return n=>n}_.OpaqueType=ne;_.HexString=ne();_.AddressString=ne();_.BigIntString=ne();function _n(n){return Math.floor(n)}_.IntNumber=_n;_.RegExpString=ne();var u={};Object.defineProperty(u,"__esModule",{value:!0});u.areAddressArraysEqual=u.getFavicon=u.range=u.isBigNumber=u.ensureParsedJSONObject=u.ensureBigInt=u.ensureRegExpString=u.ensureIntNumber=u.ensureBuffer=u.ensureAddressString=u.ensureEvenLengthHexString=u.ensureHexString=u.isHexString=u.prepend0x=u.strip0x=u.has0xPrefix=u.hexStringFromIntNumber=u.intNumberFromHexString=u.bigIntStringFromBigInt=u.hexStringFromBuffer=u.hexStringToUint8Array=u.uint8ArrayToHex=u.randomBytesHex=void 0;const q=j,I=_,Mt=/^[0-9]*$/,Lt=/^[a-f0-9]*$/;function En(n){return At(crypto.getRandomValues(new Uint8Array(n)))}u.randomBytesHex=En;function At(n){return[...n].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function Sn(n){return new Uint8Array(n.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=Sn;function Cn(n,e=!1){const t=n.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=Cn;function kn(n){return(0,I.BigIntString)(n.toString(10))}u.bigIntStringFromBigInt=kn;function In(n){return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}u.intNumberFromHexString=In;function Mn(n){return(0,I.HexString)(`0x${BigInt(n).toString(16)}`)}u.hexStringFromIntNumber=Mn;function Fe(n){return n.startsWith("0x")||n.startsWith("0X")}u.has0xPrefix=Fe;function ve(n){return Fe(n)?n.slice(2):n}u.strip0x=ve;function Rt(n){return Fe(n)?`0x${n.slice(2)}`:`0x${n}`}u.prepend0x=Rt;function re(n){if(typeof n!="string")return!1;const e=ve(n).toLowerCase();return Lt.test(e)}u.isHexString=re;function xt(n,e=!1){if(typeof n=="string"){const t=ve(n).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(n)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(n,e=!1){let t=xt(n,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function Ln(n){if(typeof n=="string"){const e=ve(n).toLowerCase();if(re(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(n)}`)}u.ensureAddressString=Ln;function An(n){if(Buffer.isBuffer(n))return n;if(typeof n=="string"){if(re(n)){const e=se(n,!1);return Buffer.from(e,"hex")}return Buffer.from(n,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(n)}`)}u.ensureBuffer=An;function Pt(n){if(typeof n=="number"&&Number.isInteger(n))return(0,I.IntNumber)(n);if(typeof n=="string"){if(Mt.test(n))return(0,I.IntNumber)(Number(n));if(re(n))return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureIntNumber=Pt;function Rn(n){if(n instanceof RegExp)return(0,I.RegExpString)(n.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(n)}`)}u.ensureRegExpString=Rn;function xn(n){if(n!==null&&(typeof n=="bigint"||Nt(n)))return BigInt(n.toString(10));if(typeof n=="number")return BigInt(Pt(n));if(typeof n=="string"){if(Mt.test(n))return BigInt(n);if(re(n))return BigInt(se(n,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureBigInt=xn;function Pn(n){if(typeof n=="string")return JSON.parse(n);if(typeof n=="object")return n;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(n)}`)}u.ensureParsedJSONObject=Pn;function Nt(n){if(n==null||typeof n.constructor!="function")return!1;const{constructor:e}=n;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Nn(n,e){return Array.from({length:e-n},(t,r)=>n+r)}u.range=Nn;function Tn(){const n=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:t}=document.location,r=n?n.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?e+r:`${e}//${t}${r}`}u.getFavicon=Tn;function jn(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}u.areAddressArraysEqual=jn;var P={},_e={},Ee={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.decryptContent=y.encryptContent=y.importKeyFromHexString=y.exportKeyToHexString=y.decrypt=y.encrypt=y.deriveSharedSecret=y.generateKeyPair=void 0;const Tt=u;async function On(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=On;async function Dn(n,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Dn;async function jt(n,e){const t=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,new TextEncoder().encode(e));return{iv:t,cipherText:r}}y.encrypt=jt;async function Ot(n,{iv:e,cipherText:t}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},n,t);return new TextDecoder().decode(r)}y.decrypt=Ot;function Dt(n){switch(n){case"public":return"spki";case"private":return"pkcs8"}}async function Wn(n,e){const t=Dt(n),r=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(r))}y.exportKeyToHexString=Wn;async function Un(n,e){const t=Dt(n),r=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,r,{name:"ECDH",namedCurve:"P-256"},!0,n==="private"?["deriveKey"]:[])}y.importKeyFromHexString=Un;async function Bn(n,e){const t=JSON.stringify(n,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return jt(e,t)}y.encryptContent=Bn;async function Hn(n,e){return JSON.parse(await Ot(e,n))}y.decryptContent=Hn;var O={};Object.defineProperty(O,"__esModule",{value:!0});O.ScopedLocalStorage=void 0;class fe{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(r))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new fe("CBWSDK").clear(),new fe("walletlink").clear()}}O.ScopedLocalStorage=fe;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.SCWKeyManager=void 0;const oe=y,Kn=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class qn{constructor(){this.storage=new Kn.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(Ue,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(We.storageKey),this.storage.removeItem(De.storageKey),this.storage.removeItem(Ue.storageKey)}async generateKeyPair(){const e=await(0,oe.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(De,e.privateKey),await this.storeKey(We,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(De)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(We)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ue)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,oe.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,oe.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}Ee.SCWKeyManager=qn;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const $n=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class Fn{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new $n.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(et),this._walletCapabilities=this.loadItemFromStorage(tt);const s=this.loadItemFromStorage(Qe),i=this.loadItemFromStorage(Xe);s&&this.updateListener.onAccountsUpdate({accounts:s,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=s||[],this._activeChain=i||{id:(r=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return r?(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(Xe,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([r,s])=>({id:Number(r),rpcUrl:s}));this.availableChains=t,this.storeItemToStorage(et,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(tt,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()}}Se.SCWStateManager=Fn;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const zn=Ee,Vn=Se,ce=j,nt=u,de=y;class Zn{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new zn.SCWKeyManager,this.stateManager=new Vn.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 r=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const s=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},s);const i=s.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(t!==void 0){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const r=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(r);this.updateInternalState(e,s);const i=s.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const r=e.params;if(!r||!(!((t=r[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,nt.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const r=this.stateManager.walletCapabilities;if(!r)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return r}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw ce.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(e){const t=await(0,de.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 r=await this.keyManager.getSharedSecret();if(!r)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,s;const i=(r=t.data)===null||r===void 0?void 0:r.chains;i&&this.stateManager.updateAvailableChains(i);const a=(s=t.data)===null||s===void 0?void 0:s.capabilities;a&&this.stateManager.updateWalletCapabilities(a);const o=t.result;if(!("error"in o))switch(e.method){case"eth_requestAccounts":{const c=o.value;this.stateManager.updateAccounts(c);break}case"wallet_switchEthereumChain":{if(o.value!==null)return;const c=e.params,l=(0,nt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Zn;var Ce={};const Gn=on;function Wt(n){return Buffer.allocUnsafe(n).fill(0)}function Yn(n){return n.toString(2).length}function Ut(n,e){let t=n.toString(16);t.length%2!==0&&(t="0"+t);const r=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length"u")throw new Error("Not an array?");if(t=Ft(n),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],n=n.slice(0,n.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(n,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(n==="bytes")return e=new Buffer(e),s=Buffer.concat([R("uint256",e.length),e]),e.length%32!==0&&(s=Buffer.concat([s,E.zeros(32-e.length%32)])),s;if(n.startsWith("bytes")){if(t=G(n),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(n.startsWith("uint")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(r,32)}else if(n.startsWith("int")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(r,256);return E.bufferBEFromBigInt(c,32)}else if(n.startsWith("ufixed")){if(t=rt(n),r=H(e),r<0)throw new Error("Supplied ufixed is negative");return R("uint256",r*BigInt(2)**BigInt(t[1]))}else if(n.startsWith("fixed"))return t=rt(n),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+n)}function nr(n){return n==="string"||n==="bytes"||Ft(n)==="dynamic"}function rr(n){return n.lastIndexOf("]")===n.length-1}function sr(n,e){var t=[],r=[],s=32*n.length;for(var i in n){var a=$t(n[i]),o=e[i],c=R(a,o);nr(a)?(t.push(R("uint256",s)),r.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(r))}function zt(n,e){if(n.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+t);s.push(E.setLengthRight(o,t))}else if(a.startsWith("uint")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(r,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(r,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function ir(n,e){return E.keccak(zt(n,e))}var ar={rawEncode:sr,solidityPack:zt,soliditySHA3:ir};const A=qt,ee=ar,Vt={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"]},Be={encodeData(n,e,t,r=!0){const s=["bytes32"],i=[this.hashType(n,t)];if(r){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,r))];if(l===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",A.keccak(l)];if(c==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",A.keccak(l)];if(c.lastIndexOf("]")===c.length-1){const h=c.slice(0,c.lastIndexOf("[")),f=l.map(d=>a(o,h,d));return["bytes32",A.keccak(ee.rawEncode(f.map(([d])=>d),f.map(([,d])=>d)))]}return[c,l]};for(const o of t[n]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[n]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")s.push("bytes32"),o=A.keccak(o),i.push(o);else if(a.type==="string")s.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=A.keccak(o),i.push(o);else if(t[a.type]!==void 0)s.push("bytes32"),o=A.keccak(this.encodeData(a.type,o,t,r)),i.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(o)}}return ee.rawEncode(s,i)},encodeType(n,e){let t="",r=this.findTypeDependencies(n,e).filter(s=>s!==n);r=[n].concat(r.sort());for(const s of r){if(!e[s])throw new Error("No type definition specified: "+s);t+=s+"("+e[s].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return t},findTypeDependencies(n,e,t=[]){if(n=n.match(/^\w*/)[0],t.includes(n)||e[n]===void 0)return t;t.push(n);for(const r of e[n])for(const s of this.findTypeDependencies(r.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(n,e,t,r=!0){return A.keccak(this.encodeData(n,e,t,r))},hashType(n,e){return A.keccak(this.encodeType(n,e))},sanitizeData(n){const e={};for(const t in Vt.properties)n[t]&&(e[t]=n[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(n,e=!0){const t=this.sanitizeData(n),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(r))}};var or={TYPED_MESSAGE_SCHEMA:Vt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(n){return cr(n.data)},hashForSignTypedData_v3:function(n){return Be.hash(n.data,!1)},hashForSignTypedData_v4:function(n){return Be.hash(n.data)}};function cr(n){const e=new Error("Expect argument to be non-empty array");if(typeof n!="object"||!n.length)throw e;const t=n.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),r=n.map(function(i){return i.type}),s=n.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(n.length).fill("string"),s),ee.soliditySHA3(r,t)])}var N={};Object.defineProperty(N,"__esModule",{value:!0});N.APP_VERSION_KEY=N.LOCAL_STORAGE_ADDRESSES_KEY=N.WALLET_USER_NAME_KEY=void 0;N.WALLET_USER_NAME_KEY="walletUsername";N.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";N.APP_VERSION_KEY="AppVersion";var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.RelayEventManager=void 0;const dr=u;class lr{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,dr.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=lr;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class ur{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(e)),o=16,c=a.slice(a.byteLength-o),l=a.slice(0,a.byteLength-o),h=new Uint8Array(c),f=new Uint8Array(l),d=new Uint8Array([...r,...h,...f]);return(0,le.uint8ArrayToHex)(d)}async decrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");return new Promise((r,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,le.hexStringToUint8Array)(e),o=a.slice(0,12),c=a.slice(12,28),l=a.slice(28),h=new Uint8Array([...l,...c]),f={name:"AES-GCM",iv:new Uint8Array(o)};try{const d=await window.crypto.subtle.decrypt(f,i,h),p=new TextDecoder;r(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=ur;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class hr{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(t=>fetch(`${this.linkAPIUrl}/events/${t.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(t=>console.error("Unabled to mark event as failed:",t))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=r==null?void 0:r.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=hr;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(n){n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class gr{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 s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Z.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),t(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.DISCONNECTED)},s.onopen=i=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Z.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch{}}}sendData(e){const{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}Y.WalletLinkWebSocket=gr;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,pr=Le,fr=Ae,ue=Y,F=_,it=1e4,mr=6e4;class br{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,F.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,l)=>{const h=a[l];h!==void 0&&c(h)})},this.handleDestroyed=a=>{var o;a==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async a=>{var o;{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.accountUpdated(c)}},this.handleMetadataUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,l)}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(st.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(st.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(a),h=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.chainUpdated(l,h)}},this.session=e,this.cipher=new pr.WalletLinkCipher(e.secret),this.listener=r;const i=new ue.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener(async a=>{let o=!1;switch(a){case ue.ConnectionState.DISCONNECTED:if(!this.destroyed){const c=async()=>{await new Promise(l=>setTimeout(l,5e3)),this.destroyed||i.connect().catch(()=>{c()})};c()}break;case ue.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),o=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},it),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case ue.ConnectionState.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(a=>{var o;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const c=a.type==="IsLinkedOK"?a.linked:void 0;this.linked=c||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((o=this.requestResolutions.get(a.id))===null||o===void 0||o(a))}),this.ws=i,this.http=new fr.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&&((t=this.onceConnected)===null||t===void 0||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(r=this.listener)===null||r===void 0||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;if(!(e.type!=="Event"||e.event!=="Web3Response")){const r=await this.cipher.decrypt(e.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(t=this.listener)===null||t===void 0||t.handleWeb3ResponseMessage(s)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(t=>this.handleIncomingEvent(t))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(r);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>it*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,t=mr){const r=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async authenticate(){const e={type:"HostSession",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if(t.type==="Fail")throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Me.WalletLinkConnection=br;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const yr=cn,at=u,ot="session:id",ct="session:secret",dt="session:linked";class ze{constructor(e,t,r,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=r||(0,at.randomBytesHex)(32),this._key=new yr.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),r=e.getItem(dt),s=e.getItem(ct);return t&&s?new ze(e,t,s,r==="1"):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(ot,this._id),this._storage.setItem(ct,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(dt,this._linked?"1":"0")}}Re.WalletLinkSession=ze;var S={};Object.defineProperty(S,"__esModule",{value:!0});S.isDarkMode=S.isMobileWeb=S.getLocation=S.createQrUrl=void 0;function wr(n,e,t,r,s,i){const a=r?"parent-id":"id",o=new URLSearchParams({[a]:n,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=wr;function vr(){try{return window.frameElement!==null}catch{return!1}}function _r(){try{return vr()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=_r;function Er(){var n;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((n=window==null?void 0:window.navigator)===null||n===void 0?void 0:n.userAgent)}S.isMobileWeb=Er;function Sr(){var n,e;return(e=(n=window==null?void 0:window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=Sr;var xe={},ae={},Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.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 Cr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const kr=Cr(Ve);function Ir(){const n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode(kr.default)),document.documentElement.appendChild(n)}ae.injectCssReset=Ir;var Ze={};function Zt(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e{this.items.delete(m),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(n.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,r.h)(n.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}n.Snackbar=l;const h=d=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,a.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},d.children));n.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,tn]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{tn(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const nn=()=>{Je(!Oe)};return(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:nn},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,r.h)("div",{class:"-gear-container"},!Oe&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,rn)=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:rn},(0,r.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};n.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Lr=ae,Ar=Ze;class Rr{constructor(){this.attached=!1,this.snackbar=new Ar.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,Lr.injectCssReset)()}showConnecting(e){let t;return e.isUnlinkedErrorState?t={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}]}:t={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)}}xe.WalletLinkRelayUI=Rr;var Pe={},Ne={},Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.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 Yt=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const xr=Yt(Gt),x=_t,Pr=ae,Nr=Ze,Tr=S,jr=Yt(Ye);class Or{constructor(){this.root=null,this.darkMode=(0,Tr.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Pr.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,x.render)(null,this.root),e&&(0,x.render)((0,x.h)(Dr,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=Or;const Dr=({title:n,buttonText:e,darkMode:t,onButtonClick:r,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Nr.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,jr.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,xr.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,n),(0,x.h)("button",{onClick:r},e))))};var T={};Object.defineProperty(T,"__esModule",{value:!0});T.CBW_MOBILE_DEEPLINK_URL=T.WALLETLINK_URL=T.CB_KEYS_URL=void 0;T.CB_KEYS_URL="https://keys.coinbase.com/connect";T.WALLETLINK_URL="https://www.walletlink.org";T.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.WLMobileRelayUI=void 0;const Wr=Ne,Ur=S,Br=T;class Hr{constructor(){this.attached=!1,this.redirectDialog=new Wr.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(Br.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Ur.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Hr;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Kr=Me,qr=N,$r=ie,He=Re,z=Q,Fr=S,zr=xe,ut=Pe,Vr=j,b=u,Zr=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Fr.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(qr.LOCAL_STORAGE_ADDRESSES_KEY);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(i,a))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),W.accountRequestCallbackIds.size>0&&(Array.from(W.accountRequestCallbackIds.values()).forEach(a=>{const o={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[i]}};this.invokeCallback(Object.assign(Object.assign({},o),{id:a}))}),W.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new $r.RelayEventManager,this.ui=r}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new Kr.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new ut.WLMobileRelayUI:new zr.WalletLinkRelayUI;return r.connect(),{session:e,ui:s,connection:r}}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=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Zr.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,r,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,b.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,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,b.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 r=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i),t==null||t()};return new Promise((i,a)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(t==null||t(),(0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:s.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ut.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();break}}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){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(r=>this.invokeCallback(Object.assign(Object.assign({},e),{id:r}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var s;const i=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,b.randomBytesHex)(8);return new Promise((r,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,z.isErrorResponse)(i))return s(new Error(i.errorMessage));r(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,z.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}addEthereumChain(e,t,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,z.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},s=(0,b.randomBytesHex)(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if((0,z.isErrorResponse)(o)&&o.errorCode)return a(Vr.standardErrors.provider.custom({code:o.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(s,r)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Gr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Gr(or),ht=N,Yr=ie,D=Q,Jr=Ie,gt=T,w=j,g=u,Qr=O,qe="DefaultChainId",pt="DefaultJsonRpcUrl";class Xr{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Qr.ScopedLocalStorage("walletlink",gt.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Yr.RelayEventManager,this._jsonRpcUrlFromOpts="";const a=this._storage.getItem(ht.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const c=a.split(" ");c[0]!==""&&(this._addresses=c.map(l=>(0,g.ensureAddressString)(l)),(t=this.updateListener)===null||t===void 0||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(qe)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:r}=e.getWalletLinkSession();return{id:t,secret:r}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(pt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(pt,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,r,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,r,s,i,a){var o,c;if((0,g.ensureIntNumber)(e)===this.getChainId())return!1;const l=this.initializeRelay();this._isAuthorized()||await l.requestEthereumAccounts();const h=await l.addEthereumChain(e.toString(),t,i,r,s,a);return(0,D.isErrorResponse)(h)?!1:(((o=h.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),((c=h.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(e){const r=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const s=r.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(t=>{throw t})}catch(t){return Promise.reject(t)}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw w.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if(typeof t!="string"||t.length===0)throw w.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=r===void 0?[]:r,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw new Error("addresses is not an array");const s=e.map(i=>(0,g.ensureAddressString)(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.updateListener)===null||r===void 0||r.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ht.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return r(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>r(s))})}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(e){try{const t=(0,g.ensureAddressString)(e);return this._addresses.map(s=>(0,g.ensureAddressString)(s)).includes(t)}catch{}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,g.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);const r=e.to?(0,g.ensureAddressString)(e.to):null,s=e.value!=null?(0,g.ensureBigInt)(e.value):BigInt(0),i=e.data?(0,g.ensureBuffer)(e.data):Buffer.alloc(0),a=e.nonce!=null?(0,g.ensureIntNumber)(e.nonce):null,o=e.gasPrice!=null?(0,g.ensureBigInt)(e.gasPrice):null,c=e.maxFeePerGas!=null?(0,g.ensureBigInt)(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?(0,g.ensureBigInt)(e.maxPriorityFeePerGas):null,h=e.gas!=null?(0,g.ensureBigInt)(e.gas):null,f=e.chainId?(0,g.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:t,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:l,gasLimit:h,chainId:f}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw w.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw w.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,r,s);if((0,D.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,t,r){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,r);if((0,D.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,g.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(qe);if(!e)return(0,g.ensureIntNumber)(1);const t=parseInt(e,10);return(0,g.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{if(e=await this.initializeRelay().requestEthereumAccounts(),(0,D.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){throw typeof t.message=="string"&&t.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied account authorization"):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,g.ensureAddressString)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(e){const t=(0,g.ensureBuffer)(e[0]),s=await this.initializeRelay().submitEthereumTransaction(t,this.getChainId());if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signAndSubmitEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),r=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,r,s,i;const a=e[0];if(((t=a.rpcUrls)===null||t===void 0?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!a.chainName||a.chainName.trim()==="")throw w.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw w.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(a.chainId,16);return await this.addEthereumChain(o,(r=a.rpcUrls)!==null&&r!==void 0?r:[],(s=a.blockExplorerUrls)!==null&&s!==void 0?s:[],a.chainName,(i=a.iconUrls)!==null&&i!==void 0?i:[],a.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(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 w.standardErrors.rpc.invalidParams("Type is required");if((t==null?void 0:t.type)!=="ERC20")throw w.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(t!=null&&t.options))throw w.standardErrors.rpc.invalidParams("Options are required");if(!(t!=null&&t.options.address))throw w.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,s,i,o,a,r)}}initializeRelay(){if(!this._relay){const e=new Jr.WalletLinkRelay({linkAPIUrl:gt.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,r)=>this._setAddresses(t,r)),e.setChainCallback((t,r)=>{this.updateProviderInfo(r,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Xr;var k={};Object.defineProperty(k,"__esModule",{value:!0});k.checkErrorForInvalidRequestArgs=k.getCoinbaseInjectedProvider=k.getCoinbaseInjectedSigner=k.fetchRPCRequest=void 0;const es=K,pe=j;async function ts(n,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},n),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(e.rpcUrl,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":es.LIB_VERSION}})).json()).result}k.fetchRPCRequest=ts;function Jt(){return globalThis.coinbaseWalletSigner}k.getCoinbaseInjectedSigner=Jt;function ns(){return globalThis.coinbaseWalletExtension}function rs(){var n,e;try{const t=globalThis;return(n=t.ethereum)!==null&&n!==void 0?n:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function ss({metadata:n,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Jt())return;const i=ns();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=n;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const r=rs();if(r!=null&&r.isCoinbaseBrowser)return r}k.getCoinbaseInjectedProvider=ss;function is(n){if(!n||typeof n!="object"||Array.isArray(n))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:n});const{method:e,params:t}=n;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:n});if(t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null))return pe.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:n})}k.checkErrorForInvalidRequestArgs=is;Object.defineProperty(P,"__esModule",{value:!0});P.createSigner=P.fetchSignerType=P.storeSignerType=P.loadSignerType=void 0;const as=_e,Qt=Ce,os=j,cs=k,ds=O,Xt="SignerType",en=new ds.ScopedLocalStorage("CBWSDK","SignerConfigurator");function ls(){return en.getItem(Xt)}P.loadSignerType=ls;function us(n){en.setItem(Xt,n)}P.storeSignerType=us;async function hs(n){const{communicator:e,metadata:t}=n;ps(e,t).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:n.preference},{data:s}=await e.postRequestAndWaitForResponse(r);return s}P.fetchSignerType=hs;function gs(n){const{signerType:e,metadata:t,communicator:r,updateListener:s}=n;switch(e){case"scw":return new as.SCWSigner({metadata:t,updateListener:s,communicator:r});case"walletlink":return new Qt.WalletLinkSigner({metadata:t,updateListener:s});case"extension":{const i=(0,cs.getCoinbaseInjectedSigner)();if(!i)throw os.standardErrors.rpc.internal("injected signer not found");return i}}}P.createSigner=gs;async function ps(n,e){await n.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const t=new Qt.WalletLinkSigner({metadata:e});n.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),n.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Te={},J={};Object.defineProperty(J,"__esModule",{value:!0});J.closePopup=J.openPopup=void 0;const fs=j,ft=420,mt=540;function ms(n){const e=(window.innerWidth-ft)/2+window.screenX,t=(window.innerHeight-mt)/2+window.screenY,r=window.open(n,"Smart Wallet",`width=${ft}, height=${mt}, left=${e}, top=${t}`);if(r==null||r.focus(),!r)throw fs.standardErrors.rpc.internal("Pop up window failed to open");return r}J.openPopup=ms;function bs(n){n&&!n.closed&&n.close()}J.closePopup=bs;Object.defineProperty(Te,"__esModule",{value:!0});Te.Communicator=void 0;const ys=K,bt=J,ws=T,yt=j;class vs{constructor(e=ws.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async t=>{(await this.waitForPopupLoaded()).postMessage(t,this.url.origin)},this.postRequestAndWaitForResponse=async t=>{const r=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await r},this.onMessage=async t=>new Promise((r,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(r(o),window.removeEventListener("message",i),this.listeners.delete(i))};window.addEventListener("message",i),this.listeners.set(i,{reject:s})}),this.disconnect=()=>{(0,bt.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:t},r)=>{t(yt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,bt.openPopup)(this.url),this.onMessage(({event:t})=>t==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:t})=>t==="PopupLoaded").then(t=>{this.postMessage({requestId:t.id,data:{version:ys.LIB_VERSION}})}).then(()=>{if(!this.popup)throw yt.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}Te.Communicator=vs;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.determineMethodCategory=void 0;const wt={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:[]};function _s(n){for(const e in wt){const t=e;if(wt[t].includes(n))return t}}je.determineMethodCategory=_s;var Es=M&&M.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s{try{if(this.connected)return this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),this.accounts;const h=await this.requestSignerSelection(),f=this.initSigner(h),d=await f.handshake();return this.signer=f,(0,ge.storeSignerType)(h),this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),d}catch(h){throw this.handleUnauthorizedError(h),h}},sign:async l=>{if(!this.connected||!this.signer)throw V.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(l)}catch(h){throw this.handleUnauthorizedError(h),h}},fetch:l=>(0,vt.fetchRPCRequest)(l,this.chain),state:l=>{const h=()=>{if(this.connected)return this.accounts;throw V.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(l.method){case"eth_chainId":return(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return h();case"eth_coinbase":return h()[0];default:return this.handlers.unsupported(l)}},deprecated:({method:l})=>{throw V.standardErrors.rpc.methodNotSupported(`Method ${l} is deprecated.`)},unsupported:({method:l})=>{throw V.standardErrors.rpc.methodNotSupported(`Method ${l} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:l,source:h})=>{(0,X.areAddressArraysEqual)(this.accounts,l)||(this.accounts=l,h!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:l,source:h})=>{l.id===this.chain.id&&l.rpcUrl===this.chain.rpcUrl||(this.chain=l,h!=="storage"&&this.emit("chainChanged",(0,X.hexStringFromIntNumber)((0,he.IntNumber)(l.id))))}},this.metadata=s,this.preference=o,this.communicator=new Is.Communicator(a),this.chain={id:(r=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1};const c=(0,ge.loadSignerType)();this.signer=c?this.initSigner(c):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const r=(0,vt.checkErrorForInvalidRequestArgs)(e);if(r)throw r;const s=(t=(0,Ms.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(r){return Promise.reject((0,ks.serializeError)(r,e.method))}}handleUnauthorizedError(e){e.code===V.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},Ls.ScopedLocalStorage.clearAll(),this.emit("disconnect",V.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,ge.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,ge.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}be.CoinbaseWalletProvider=As;Object.defineProperty(te,"__esModule",{value:!0});te.CoinbaseWalletSDK=void 0;const Rs=me,xs=be,Ps=O,Ns=K,Ts=u,js=k;class Os{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 r={metadata:this.metadata,preference:e};return(t=(0,js.getCoinbaseInjectedProvider)(r))!==null&&t!==void 0?t:new xs.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,Rs.walletLogo)(e,t)}storeLatestVersion(){new Ps.ScopedLocalStorage("CBWSDK").setItem("VERSION",Ns.LIB_VERSION)}}te.CoinbaseWalletSDK=Os;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CoinbaseWalletSDK=void 0;const e=te;n.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(n,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ds=an(Et),Bs=Object.freeze(Object.defineProperty({__proto__:null,default:Ds},Symbol.toStringTag,{value:"Module"}));export{Bs as i}; +import{d as M,g as sn,h as an}from"./index-CP6_TFKv.js";import{j as on,s as cn,r as _t,a as dn,b as ln}from"./hooks.module-ClmD75_J.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const un=(n,e)=>{let t;switch(n){case"standard":return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' 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 `}};me.walletLogo=un;var be={},j={},U={};Object.defineProperty(U,"__esModule",{value:!0});U.errorValues=U.standardErrorCodes=void 0;U.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}};U.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 ye={},$e={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.serialize=n.getErrorCode=n.isValidCode=n.getMessageFromCode=n.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";n.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function r(d,p=t){if(d&&Number.isInteger(d)){const m=d.toString();if(h(e.errorValues,m))return e.errorValues[m].message;if(c(d))return n.JSON_RPC_SERVER_ERROR_MESSAGE}return p}n.getMessageFromCode=r;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}n.isValidCode=s;function i(d){var p;if(typeof d=="number")return d;if(a(d))return(p=d.code)!==null&&p!==void 0?p:d.errorCode}n.getErrorCode=i;function a(d){return typeof d=="object"&&d!==null&&(typeof d.code=="number"||typeof d.errorCode=="number")}function o(d,{shouldIncludeStack:p=!1}={}){const m={};if(d&&typeof d=="object"&&!Array.isArray(d)&&h(d,"code")&&s(d.code)){const B=d;m.code=B.code,B.message&&typeof B.message=="string"?(m.message=B.message,h(B,"data")&&(m.data=B.data)):(m.message=r(m.code),m.data={originalError:l(d)})}else m.code=e.standardErrorCodes.rpc.internal,m.message=f(d,"message")?d.message:t,m.data={originalError:l(d)};return p&&(m.stack=f(d,"stack")?d.stack:void 0),m}n.serialize=o;function c(d){return d>=-32099&&d<=-32e3}function l(d){return d&&typeof d=="object"&&!Array.isArray(d)?Object.assign({},d):d}function h(d,p){return Object.prototype.hasOwnProperty.call(d,p)}function f(d,p){return typeof d=="object"&&d!==null&&p in d&&typeof d[p]=="string"}})($e);Object.defineProperty(ye,"__esModule",{value:!0});ye.standardErrors=void 0;const v=U,St=$e;ye.standardErrors={rpc:{parse:n=>C(v.standardErrorCodes.rpc.parse,n),invalidRequest:n=>C(v.standardErrorCodes.rpc.invalidRequest,n),invalidParams:n=>C(v.standardErrorCodes.rpc.invalidParams,n),methodNotFound:n=>C(v.standardErrorCodes.rpc.methodNotFound,n),internal:n=>C(v.standardErrorCodes.rpc.internal,n),server:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=n;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,n)},invalidInput:n=>C(v.standardErrorCodes.rpc.invalidInput,n),resourceNotFound:n=>C(v.standardErrorCodes.rpc.resourceNotFound,n),resourceUnavailable:n=>C(v.standardErrorCodes.rpc.resourceUnavailable,n),transactionRejected:n=>C(v.standardErrorCodes.rpc.transactionRejected,n),methodNotSupported:n=>C(v.standardErrorCodes.rpc.methodNotSupported,n),limitExceeded:n=>C(v.standardErrorCodes.rpc.limitExceeded,n)},provider:{userRejectedRequest:n=>$(v.standardErrorCodes.provider.userRejectedRequest,n),unauthorized:n=>$(v.standardErrorCodes.provider.unauthorized,n),unsupportedMethod:n=>$(v.standardErrorCodes.provider.unsupportedMethod,n),disconnected:n=>$(v.standardErrorCodes.provider.disconnected,n),chainDisconnected:n=>$(v.standardErrorCodes.provider.chainDisconnected,n),unsupportedChain:n=>$(v.standardErrorCodes.provider.unsupportedChain,n),custom:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:r}=n;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,r)}}};function C(n,e){const[t,r]=Ct(e);return new kt(n,t||(0,St.getMessageFromCode)(n),r)}function $(n,e){const[t,r]=Ct(e);return new It(n,t||(0,St.getMessageFromCode)(n),r)}function Ct(n){if(n){if(typeof n=="string")return[n];if(typeof n=="object"&&!Array.isArray(n)){const{message:e,data:t}=n;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,t]}}return[]}class kt extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string.');super(t),this.code=e,r!==void 0&&(this.data=r)}}class It extends kt{constructor(e,t,r){if(!hn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function hn(n){return Number.isInteger(n)&&n>=1e3&&n<=4999}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.standardErrors=n.standardErrorCodes=void 0;var e=U;Object.defineProperty(n,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(n,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function gn(n){return n.errorMessage!==void 0}Q.isErrorResponse=gn;var K={};Object.defineProperty(K,"__esModule",{value:!0});K.LIB_VERSION=void 0;K.LIB_VERSION="4.0.4";Object.defineProperty(we,"__esModule",{value:!0});we.serializeError=void 0;const pn=Q,fn=K,mn=U,bn=$e;function yn(n,e){const t=(0,bn.serialize)(wn(n),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",fn.LIB_VERSION),r.searchParams.set("code",t.code.toString());const s=vn(t.data,e);return s&&r.searchParams.set("method",s),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}we.serializeError=yn;function wn(n){return typeof n=="string"?{message:n,code:mn.standardErrorCodes.rpc.internal}:(0,pn.isErrorResponse)(n)?Object.assign(Object.assign({},n),{message:n.errorMessage,code:n.errorCode,data:{method:n.method}}):n}function vn(n,e){const t=n==null?void 0:n.method;if(t)return t;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}var _={};Object.defineProperty(_,"__esModule",{value:!0});_.RegExpString=_.IntNumber=_.BigIntString=_.AddressString=_.HexString=_.OpaqueType=void 0;function ne(){return n=>n}_.OpaqueType=ne;_.HexString=ne();_.AddressString=ne();_.BigIntString=ne();function _n(n){return Math.floor(n)}_.IntNumber=_n;_.RegExpString=ne();var u={};Object.defineProperty(u,"__esModule",{value:!0});u.areAddressArraysEqual=u.getFavicon=u.range=u.isBigNumber=u.ensureParsedJSONObject=u.ensureBigInt=u.ensureRegExpString=u.ensureIntNumber=u.ensureBuffer=u.ensureAddressString=u.ensureEvenLengthHexString=u.ensureHexString=u.isHexString=u.prepend0x=u.strip0x=u.has0xPrefix=u.hexStringFromIntNumber=u.intNumberFromHexString=u.bigIntStringFromBigInt=u.hexStringFromBuffer=u.hexStringToUint8Array=u.uint8ArrayToHex=u.randomBytesHex=void 0;const q=j,I=_,Mt=/^[0-9]*$/,Lt=/^[a-f0-9]*$/;function En(n){return At(crypto.getRandomValues(new Uint8Array(n)))}u.randomBytesHex=En;function At(n){return[...n].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function Sn(n){return new Uint8Array(n.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=Sn;function Cn(n,e=!1){const t=n.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=Cn;function kn(n){return(0,I.BigIntString)(n.toString(10))}u.bigIntStringFromBigInt=kn;function In(n){return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}u.intNumberFromHexString=In;function Mn(n){return(0,I.HexString)(`0x${BigInt(n).toString(16)}`)}u.hexStringFromIntNumber=Mn;function Fe(n){return n.startsWith("0x")||n.startsWith("0X")}u.has0xPrefix=Fe;function ve(n){return Fe(n)?n.slice(2):n}u.strip0x=ve;function Rt(n){return Fe(n)?`0x${n.slice(2)}`:`0x${n}`}u.prepend0x=Rt;function re(n){if(typeof n!="string")return!1;const e=ve(n).toLowerCase();return Lt.test(e)}u.isHexString=re;function xt(n,e=!1){if(typeof n=="string"){const t=ve(n).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(n)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(n,e=!1){let t=xt(n,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function Ln(n){if(typeof n=="string"){const e=ve(n).toLowerCase();if(re(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(n)}`)}u.ensureAddressString=Ln;function An(n){if(Buffer.isBuffer(n))return n;if(typeof n=="string"){if(re(n)){const e=se(n,!1);return Buffer.from(e,"hex")}return Buffer.from(n,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(n)}`)}u.ensureBuffer=An;function Pt(n){if(typeof n=="number"&&Number.isInteger(n))return(0,I.IntNumber)(n);if(typeof n=="string"){if(Mt.test(n))return(0,I.IntNumber)(Number(n));if(re(n))return(0,I.IntNumber)(Number(BigInt(se(n,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureIntNumber=Pt;function Rn(n){if(n instanceof RegExp)return(0,I.RegExpString)(n.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(n)}`)}u.ensureRegExpString=Rn;function xn(n){if(n!==null&&(typeof n=="bigint"||Nt(n)))return BigInt(n.toString(10));if(typeof n=="number")return BigInt(Pt(n));if(typeof n=="string"){if(Mt.test(n))return BigInt(n);if(re(n))return BigInt(se(n,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}u.ensureBigInt=xn;function Pn(n){if(typeof n=="string")return JSON.parse(n);if(typeof n=="object")return n;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(n)}`)}u.ensureParsedJSONObject=Pn;function Nt(n){if(n==null||typeof n.constructor!="function")return!1;const{constructor:e}=n;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Nn(n,e){return Array.from({length:e-n},(t,r)=>n+r)}u.range=Nn;function Tn(){const n=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:t}=document.location,r=n?n.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?e+r:`${e}//${t}${r}`}u.getFavicon=Tn;function jn(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}u.areAddressArraysEqual=jn;var P={},_e={},Ee={},y={};Object.defineProperty(y,"__esModule",{value:!0});y.decryptContent=y.encryptContent=y.importKeyFromHexString=y.exportKeyToHexString=y.decrypt=y.encrypt=y.deriveSharedSecret=y.generateKeyPair=void 0;const Tt=u;async function On(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=On;async function Dn(n,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Dn;async function jt(n,e){const t=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,new TextEncoder().encode(e));return{iv:t,cipherText:r}}y.encrypt=jt;async function Ot(n,{iv:e,cipherText:t}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},n,t);return new TextDecoder().decode(r)}y.decrypt=Ot;function Dt(n){switch(n){case"public":return"spki";case"private":return"pkcs8"}}async function Wn(n,e){const t=Dt(n),r=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(r))}y.exportKeyToHexString=Wn;async function Un(n,e){const t=Dt(n),r=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,r,{name:"ECDH",namedCurve:"P-256"},!0,n==="private"?["deriveKey"]:[])}y.importKeyFromHexString=Un;async function Bn(n,e){const t=JSON.stringify(n,(r,s)=>{if(!(s instanceof Error))return s;const i=s;return Object.assign(Object.assign({},i.code?{code:i.code}:{}),{message:i.message})});return jt(e,t)}y.encryptContent=Bn;async function Hn(n,e){return JSON.parse(await Ot(e,n))}y.decryptContent=Hn;var O={};Object.defineProperty(O,"__esModule",{value:!0});O.ScopedLocalStorage=void 0;class fe{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(r))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new fe("CBWSDK").clear(),new fe("walletlink").clear()}}O.ScopedLocalStorage=fe;Object.defineProperty(Ee,"__esModule",{value:!0});Ee.SCWKeyManager=void 0;const oe=y,Kn=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class qn{constructor(){this.storage=new Kn.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(Ue,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(We.storageKey),this.storage.removeItem(De.storageKey),this.storage.removeItem(Ue.storageKey)}async generateKeyPair(){const e=await(0,oe.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(De,e.privateKey),await this.storeKey(We,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(De)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(We)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(Ue)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,oe.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,oe.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}Ee.SCWKeyManager=qn;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const $n=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class Fn{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new $n.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(et),this._walletCapabilities=this.loadItemFromStorage(tt);const s=this.loadItemFromStorage(Qe),i=this.loadItemFromStorage(Xe);s&&this.updateListener.onAccountsUpdate({accounts:s,source:"storage"}),i&&this.updateListener.onChainUpdate({chain:i,source:"storage"}),this._accounts=s||[],this._activeChain=i||{id:(r=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return r?(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(Xe,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([r,s])=>({id:Number(r),rpcUrl:s}));this.availableChains=t,this.storeItemToStorage(et,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(tt,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()}}Se.SCWStateManager=Fn;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const zn=Ee,Vn=Se,ce=j,nt=u,de=y;class Zn{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new zn.SCWKeyManager,this.stateManager=new Vn.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 r=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const s=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},s);const i=s.result;if("error"in i)throw i.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(t!==void 0){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const r=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(r);this.updateInternalState(e,s);const i=s.result;if("error"in i)throw i.error;return i.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const r=e.params;if(!r||!(!((t=r[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,nt.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const r=this.stateManager.walletCapabilities;if(!r)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return r}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw ce.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(e){const t=await(0,de.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 r=await this.keyManager.getSharedSecret();if(!r)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,s;const i=(r=t.data)===null||r===void 0?void 0:r.chains;i&&this.stateManager.updateAvailableChains(i);const a=(s=t.data)===null||s===void 0?void 0:s.capabilities;a&&this.stateManager.updateWalletCapabilities(a);const o=t.result;if(!("error"in o))switch(e.method){case"eth_requestAccounts":{const c=o.value;this.stateManager.updateAccounts(c);break}case"wallet_switchEthereumChain":{if(o.value!==null)return;const c=e.params,l=(0,nt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Zn;var Ce={};const Gn=on;function Wt(n){return Buffer.allocUnsafe(n).fill(0)}function Yn(n){return n.toString(2).length}function Ut(n,e){let t=n.toString(16);t.length%2!==0&&(t="0"+t);const r=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length"u")throw new Error("Not an array?");if(t=Ft(n),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],n=n.slice(0,n.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(n,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(n==="bytes")return e=new Buffer(e),s=Buffer.concat([R("uint256",e.length),e]),e.length%32!==0&&(s=Buffer.concat([s,E.zeros(32-e.length%32)])),s;if(n.startsWith("bytes")){if(t=G(n),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(n.startsWith("uint")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(r,32)}else if(n.startsWith("int")){if(t=G(n),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(e);const o=E.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(r,256);return E.bufferBEFromBigInt(c,32)}else if(n.startsWith("ufixed")){if(t=rt(n),r=H(e),r<0)throw new Error("Supplied ufixed is negative");return R("uint256",r*BigInt(2)**BigInt(t[1]))}else if(n.startsWith("fixed"))return t=rt(n),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+n)}function nr(n){return n==="string"||n==="bytes"||Ft(n)==="dynamic"}function rr(n){return n.lastIndexOf("]")===n.length-1}function sr(n,e){var t=[],r=[],s=32*n.length;for(var i in n){var a=$t(n[i]),o=e[i],c=R(a,o);nr(a)?(t.push(R("uint256",s)),r.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(r))}function zt(n,e){if(n.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,r,s=[],i=0;i32)throw new Error("Invalid bytes width: "+t);s.push(E.setLengthRight(o,t))}else if(a.startsWith("uint")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(r,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=H(o);const c=E.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(r,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function ir(n,e){return E.keccak(zt(n,e))}var ar={rawEncode:sr,solidityPack:zt,soliditySHA3:ir};const A=qt,ee=ar,Vt={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"]},Be={encodeData(n,e,t,r=!0){const s=["bytes32"],i=[this.hashType(n,t)];if(r){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,r))];if(l===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",A.keccak(l)];if(c==="string")return typeof l=="string"&&(l=Buffer.from(l,"utf8")),["bytes32",A.keccak(l)];if(c.lastIndexOf("]")===c.length-1){const h=c.slice(0,c.lastIndexOf("[")),f=l.map(d=>a(o,h,d));return["bytes32",A.keccak(ee.rawEncode(f.map(([d])=>d),f.map(([,d])=>d)))]}return[c,l]};for(const o of t[n]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[n]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")s.push("bytes32"),o=A.keccak(o),i.push(o);else if(a.type==="string")s.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=A.keccak(o),i.push(o);else if(t[a.type]!==void 0)s.push("bytes32"),o=A.keccak(this.encodeData(a.type,o,t,r)),i.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(a.type),i.push(o)}}return ee.rawEncode(s,i)},encodeType(n,e){let t="",r=this.findTypeDependencies(n,e).filter(s=>s!==n);r=[n].concat(r.sort());for(const s of r){if(!e[s])throw new Error("No type definition specified: "+s);t+=s+"("+e[s].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return t},findTypeDependencies(n,e,t=[]){if(n=n.match(/^\w*/)[0],t.includes(n)||e[n]===void 0)return t;t.push(n);for(const r of e[n])for(const s of this.findTypeDependencies(r.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(n,e,t,r=!0){return A.keccak(this.encodeData(n,e,t,r))},hashType(n,e){return A.keccak(this.encodeType(n,e))},sanitizeData(n){const e={};for(const t in Vt.properties)n[t]&&(e[t]=n[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(n,e=!0){const t=this.sanitizeData(n),r=[Buffer.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(r))}};var or={TYPED_MESSAGE_SCHEMA:Vt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(n){return cr(n.data)},hashForSignTypedData_v3:function(n){return Be.hash(n.data,!1)},hashForSignTypedData_v4:function(n){return Be.hash(n.data)}};function cr(n){const e=new Error("Expect argument to be non-empty array");if(typeof n!="object"||!n.length)throw e;const t=n.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),r=n.map(function(i){return i.type}),s=n.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(n.length).fill("string"),s),ee.soliditySHA3(r,t)])}var N={};Object.defineProperty(N,"__esModule",{value:!0});N.APP_VERSION_KEY=N.LOCAL_STORAGE_ADDRESSES_KEY=N.WALLET_USER_NAME_KEY=void 0;N.WALLET_USER_NAME_KEY="walletUsername";N.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";N.APP_VERSION_KEY="AppVersion";var ie={};Object.defineProperty(ie,"__esModule",{value:!0});ie.RelayEventManager=void 0;const dr=u;class lr{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,dr.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=lr;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class ur{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,i.encode(e)),o=16,c=a.slice(a.byteLength-o),l=a.slice(0,a.byteLength-o),h=new Uint8Array(c),f=new Uint8Array(l),d=new Uint8Array([...r,...h,...f]);return(0,le.uint8ArrayToHex)(d)}async decrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");return new Promise((r,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,le.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,le.hexStringToUint8Array)(e),o=a.slice(0,12),c=a.slice(12,28),l=a.slice(28),h=new Uint8Array([...l,...c]),f={name:"AES-GCM",iv:new Uint8Array(o)};try{const d=await window.crypto.subtle.decrypt(f,i,h),p=new TextDecoder;r(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=ur;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class hr{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(t=>fetch(`${this.linkAPIUrl}/events/${t.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(t=>console.error("Unabled to mark event as failed:",t))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=r==null?void 0:r.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=hr;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(n){n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class gr{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 s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,Z.CONNECTING),s.onclose=i=>{var a;this.clearWebSocket(),t(new Error(`websocket error ${i.code}: ${i.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.DISCONNECTED)},s.onopen=i=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Z.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},s.onmessage=i=>{var a,o;if(i.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(i.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Z.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch{}}}sendData(e){const{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}Y.WalletLinkWebSocket=gr;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,pr=Le,fr=Ae,ue=Y,F=_,it=1e4,mr=6e4;class br{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,F.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,l)=>{const h=a[l];h!==void 0&&c(h)})},this.handleDestroyed=a=>{var o;a==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async a=>{var o;{const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.accountUpdated(c)}},this.handleMetadataUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,l)}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(st.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(st.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,o)=>{var c;{const l=await this.cipher.decrypt(a),h=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.chainUpdated(l,h)}},this.session=e,this.cipher=new pr.WalletLinkCipher(e.secret),this.listener=r;const i=new ue.WalletLinkWebSocket(`${t}/rpc`,s);i.setConnectionStateListener(async a=>{let o=!1;switch(a){case ue.ConnectionState.DISCONNECTED:if(!this.destroyed){const c=async()=>{await new Promise(l=>setTimeout(l,5e3)),this.destroyed||i.connect().catch(()=>{c()})};c()}break;case ue.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),o=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},it),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case ue.ConnectionState.CONNECTING:break}this.connected!==o&&(this.connected=o)}),i.setIncomingDataListener(a=>{var o;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const c=a.type==="IsLinkedOK"?a.linked:void 0;this.linked=c||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((o=this.requestResolutions.get(a.id))===null||o===void 0||o(a))}),this.ws=i,this.http=new fr.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&&((t=this.onceConnected)===null||t===void 0||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(r=this.listener)===null||r===void 0||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;if(!(e.type!=="Event"||e.event!=="Web3Response")){const r=await this.cipher.decrypt(e.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(t=this.listener)===null||t===void 0||t.handleWeb3ResponseMessage(s)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(t=>this.handleIncomingEvent(t))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(r);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const a=await this.makeRequest(i);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>it*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,t=mr){const r=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${r} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(r,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(r)})})])}async authenticate(){const e={type:"HostSession",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if(t.type==="Fail")throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Me.WalletLinkConnection=br;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const yr=cn,at=u,ot="session:id",ct="session:secret",dt="session:linked";class ze{constructor(e,t,r,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=r||(0,at.randomBytesHex)(32),this._key=new yr.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),r=e.getItem(dt),s=e.getItem(ct);return t&&s?new ze(e,t,s,r==="1"):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(ot,this._id),this._storage.setItem(ct,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(dt,this._linked?"1":"0")}}Re.WalletLinkSession=ze;var S={};Object.defineProperty(S,"__esModule",{value:!0});S.isDarkMode=S.isMobileWeb=S.getLocation=S.createQrUrl=void 0;function wr(n,e,t,r,s,i){const a=r?"parent-id":"id",o=new URLSearchParams({[a]:n,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=wr;function vr(){try{return window.frameElement!==null}catch{return!1}}function _r(){try{return vr()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=_r;function Er(){var n;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((n=window==null?void 0:window.navigator)===null||n===void 0?void 0:n.userAgent)}S.isMobileWeb=Er;function Sr(){var n,e;return(e=(n=window==null?void 0:window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=Sr;var xe={},ae={},Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.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 Cr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const kr=Cr(Ve);function Ir(){const n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode(kr.default)),document.documentElement.appendChild(n)}ae.injectCssReset=Ir;var Ze={};function Zt(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;e{this.items.delete(m),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(n.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,r.h)(n.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}n.Snackbar=l;const h=d=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,a.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},d.children));n.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,tn]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{tn(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const nn=()=>{Je(!Oe)};return(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:nn},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,r.h)("div",{class:"-gear-container"},!Oe&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,rn)=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:rn},(0,r.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};n.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Lr=ae,Ar=Ze;class Rr{constructor(){this.attached=!1,this.snackbar=new Ar.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,Lr.injectCssReset)()}showConnecting(e){let t;return e.isUnlinkedErrorState?t={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}]}:t={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)}}xe.WalletLinkRelayUI=Rr;var Pe={},Ne={},Ye={};Object.defineProperty(Ye,"__esModule",{value:!0});Ye.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 Yt=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const xr=Yt(Gt),x=_t,Pr=ae,Nr=Ze,Tr=S,jr=Yt(Ye);class Or{constructor(){this.root=null,this.darkMode=(0,Tr.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Pr.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,x.render)(null,this.root),e&&(0,x.render)((0,x.h)(Dr,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=Or;const Dr=({title:n,buttonText:e,darkMode:t,onButtonClick:r,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Nr.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,jr.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,xr.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,n),(0,x.h)("button",{onClick:r},e))))};var T={};Object.defineProperty(T,"__esModule",{value:!0});T.CBW_MOBILE_DEEPLINK_URL=T.WALLETLINK_URL=T.CB_KEYS_URL=void 0;T.CB_KEYS_URL="https://keys.coinbase.com/connect";T.WALLETLINK_URL="https://www.walletlink.org";T.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.WLMobileRelayUI=void 0;const Wr=Ne,Ur=S,Br=T;class Hr{constructor(){this.attached=!1,this.redirectDialog=new Wr.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(Br.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Ur.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Hr;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Kr=Me,qr=N,$r=ie,He=Re,z=Q,Fr=S,zr=xe,ut=Pe,Vr=j,b=u,Zr=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Fr.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(qr.LOCAL_STORAGE_ADDRESSES_KEY);if(i&&(this._session.linked=i),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!i&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(i,a)=>{this.storage.setItem(i,a)},this.chainUpdated=(i,a)=>{this.chainCallbackParams.chainId===i&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:i,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(i,a))},this.accountUpdated=i=>{this.accountsCallback&&this.accountsCallback([i]),W.accountRequestCallbackIds.size>0&&(Array.from(W.accountRequestCallbackIds.values()).forEach(a=>{const o={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[i]}};this.invokeCallback(Object.assign(Object.assign({},o),{id:a}))}),W.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new $r.RelayEventManager,this.ui=r}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new Kr.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new ut.WLMobileRelayUI:new zr.WalletLinkRelayUI;return r.connect(),{session:e,ui:s,connection:r}}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=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Zr.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,r,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,b.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,b.bigIntStringFromBigInt)(e.weiValue),data:(0,b.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,b.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,b.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,b.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,b.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 r=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i),t==null||t()};return new Promise((i,a)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(t==null||t(),(0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:s.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ut.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();break}}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){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(r=>this.invokeCallback(Object.assign(Object.assign({},e),{id:r}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var s;const i=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:i}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,b.randomBytesHex)(8);return new Promise((r,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,z.isErrorResponse)(i))return s(new Error(i.errorMessage));r(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:s,image:i},chainId:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,z.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}addEthereumChain(e,t,r,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:r,nativeCurrency:a}};let c=null;const l=(0,b.randomBytesHex)(8),h=f=>{this.publishWeb3RequestCanceledEvent(l),this.handleErrorResponse(l,o.method,f),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:h,onResetConnection:this.resetAndReload}),new Promise((f,d)=>{this.relayEventManager.callbacks.set(l,p=>{if(c==null||c(),(0,z.isErrorResponse)(p))return d(new Error(p.errorMessage));f(p)}),this.publishWeb3RequestEvent(l,o)})}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},s=(0,b.randomBytesHex)(8);return new Promise((i,a)=>{this.relayEventManager.callbacks.set(s,o=>{if((0,z.isErrorResponse)(o)&&o.errorCode)return a(Vr.standardErrors.provider.custom({code:o.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(s,r)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Gr=M&&M.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Gr(or),ht=N,Yr=ie,D=Q,Jr=Ie,gt=T,w=j,g=u,Qr=O,qe="DefaultChainId",pt="DefaultJsonRpcUrl";class Xr{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Qr.ScopedLocalStorage("walletlink",gt.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Yr.RelayEventManager,this._jsonRpcUrlFromOpts="";const a=this._storage.getItem(ht.LOCAL_STORAGE_ADDRESSES_KEY);if(a){const c=a.split(" ");c[0]!==""&&(this._addresses=c.map(l=>(0,g.ensureAddressString)(l)),(t=this.updateListener)===null||t===void 0||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(qe)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:r}=e.getWalletLinkSession();return{id:t,secret:r}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(pt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(pt,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,r,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,r,s,i,a){var o,c;if((0,g.ensureIntNumber)(e)===this.getChainId())return!1;const l=this.initializeRelay();this._isAuthorized()||await l.requestEthereumAccounts();const h=await l.addEthereumChain(e.toString(),t,i,r,s,a);return(0,D.isErrorResponse)(h)?!1:(((o=h.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),((c=h.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(e){const r=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const s=r.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(t=>{throw t})}catch(t){return Promise.reject(t)}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw w.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if(typeof t!="string"||t.length===0)throw w.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=r===void 0?[]:r,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw new Error("addresses is not an array");const s=e.map(i=>(0,g.ensureAddressString)(i));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.updateListener)===null||r===void 0||r.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ht.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return r(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>r(s))})}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(e){try{const t=(0,g.ensureAddressString)(e);return this._addresses.map(s=>(0,g.ensureAddressString)(s)).includes(t)}catch{}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,g.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);const r=e.to?(0,g.ensureAddressString)(e.to):null,s=e.value!=null?(0,g.ensureBigInt)(e.value):BigInt(0),i=e.data?(0,g.ensureBuffer)(e.data):Buffer.alloc(0),a=e.nonce!=null?(0,g.ensureIntNumber)(e.nonce):null,o=e.gasPrice!=null?(0,g.ensureBigInt)(e.gasPrice):null,c=e.maxFeePerGas!=null?(0,g.ensureBigInt)(e.maxFeePerGas):null,l=e.maxPriorityFeePerGas!=null?(0,g.ensureBigInt)(e.maxPriorityFeePerGas):null,h=e.gas!=null?(0,g.ensureBigInt)(e.gas):null,f=e.chainId?(0,g.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:t,toAddress:r,weiValue:s,data:i,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:l,gasLimit:h,chainId:f}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw w.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw w.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,r,s);if((0,D.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,t,r){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,r);if((0,D.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,g.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(qe);if(!e)return(0,g.ensureIntNumber)(1);const t=parseInt(e,10);return(0,g.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{if(e=await this.initializeRelay().requestEthereumAccounts(),(0,D.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){throw typeof t.message=="string"&&t.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied account authorization"):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,g.ensureAddressString)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),r=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(e){const t=(0,g.ensureBuffer)(e[0]),s=await this.initializeRelay().submitEthereumTransaction(t,this.getChainId());if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signAndSubmitEthereumTransaction(t);if((0,D.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),r=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),r=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,r,s,i;const a=e[0];if(((t=a.rpcUrls)===null||t===void 0?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!a.chainName||a.chainName.trim()==="")throw w.standardErrors.rpc.invalidParams("chainName is a required field");if(!a.nativeCurrency)throw w.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(a.chainId,16);return await this.addEthereumChain(o,(r=a.rpcUrls)!==null&&r!==void 0?r:[],(s=a.blockExplorerUrls)!==null&&s!==void 0?s:[],a.chainName,(i=a.iconUrls)!==null&&i!==void 0?i:[],a.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(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 w.standardErrors.rpc.invalidParams("Type is required");if((t==null?void 0:t.type)!=="ERC20")throw w.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(t!=null&&t.options))throw w.standardErrors.rpc.invalidParams("Options are required");if(!(t!=null&&t.options.address))throw w.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:i,image:a,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,s,i,o,a,r)}}initializeRelay(){if(!this._relay){const e=new Jr.WalletLinkRelay({linkAPIUrl:gt.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,r)=>this._setAddresses(t,r)),e.setChainCallback((t,r)=>{this.updateProviderInfo(r,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Xr;var k={};Object.defineProperty(k,"__esModule",{value:!0});k.checkErrorForInvalidRequestArgs=k.getCoinbaseInjectedProvider=k.getCoinbaseInjectedSigner=k.fetchRPCRequest=void 0;const es=K,pe=j;async function ts(n,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},n),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(e.rpcUrl,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":es.LIB_VERSION}})).json()).result}k.fetchRPCRequest=ts;function Jt(){return globalThis.coinbaseWalletSigner}k.getCoinbaseInjectedSigner=Jt;function ns(){return globalThis.coinbaseWalletExtension}function rs(){var n,e;try{const t=globalThis;return(n=t.ethereum)!==null&&n!==void 0?n:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function ss({metadata:n,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Jt())return;const i=ns();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=n;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const r=rs();if(r!=null&&r.isCoinbaseBrowser)return r}k.getCoinbaseInjectedProvider=ss;function is(n){if(!n||typeof n!="object"||Array.isArray(n))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:n});const{method:e,params:t}=n;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:n});if(t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null))return pe.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:n})}k.checkErrorForInvalidRequestArgs=is;Object.defineProperty(P,"__esModule",{value:!0});P.createSigner=P.fetchSignerType=P.storeSignerType=P.loadSignerType=void 0;const as=_e,Qt=Ce,os=j,cs=k,ds=O,Xt="SignerType",en=new ds.ScopedLocalStorage("CBWSDK","SignerConfigurator");function ls(){return en.getItem(Xt)}P.loadSignerType=ls;function us(n){en.setItem(Xt,n)}P.storeSignerType=us;async function hs(n){const{communicator:e,metadata:t}=n;ps(e,t).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:n.preference},{data:s}=await e.postRequestAndWaitForResponse(r);return s}P.fetchSignerType=hs;function gs(n){const{signerType:e,metadata:t,communicator:r,updateListener:s}=n;switch(e){case"scw":return new as.SCWSigner({metadata:t,updateListener:s,communicator:r});case"walletlink":return new Qt.WalletLinkSigner({metadata:t,updateListener:s});case"extension":{const i=(0,cs.getCoinbaseInjectedSigner)();if(!i)throw os.standardErrors.rpc.internal("injected signer not found");return i}}}P.createSigner=gs;async function ps(n,e){await n.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const t=new Qt.WalletLinkSigner({metadata:e});n.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),n.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Te={},J={};Object.defineProperty(J,"__esModule",{value:!0});J.closePopup=J.openPopup=void 0;const fs=j,ft=420,mt=540;function ms(n){const e=(window.innerWidth-ft)/2+window.screenX,t=(window.innerHeight-mt)/2+window.screenY,r=window.open(n,"Smart Wallet",`width=${ft}, height=${mt}, left=${e}, top=${t}`);if(r==null||r.focus(),!r)throw fs.standardErrors.rpc.internal("Pop up window failed to open");return r}J.openPopup=ms;function bs(n){n&&!n.closed&&n.close()}J.closePopup=bs;Object.defineProperty(Te,"__esModule",{value:!0});Te.Communicator=void 0;const ys=K,bt=J,ws=T,yt=j;class vs{constructor(e=ws.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async t=>{(await this.waitForPopupLoaded()).postMessage(t,this.url.origin)},this.postRequestAndWaitForResponse=async t=>{const r=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await r},this.onMessage=async t=>new Promise((r,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(r(o),window.removeEventListener("message",i),this.listeners.delete(i))};window.addEventListener("message",i),this.listeners.set(i,{reject:s})}),this.disconnect=()=>{(0,bt.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:t},r)=>{t(yt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,bt.openPopup)(this.url),this.onMessage(({event:t})=>t==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:t})=>t==="PopupLoaded").then(t=>{this.postMessage({requestId:t.id,data:{version:ys.LIB_VERSION}})}).then(()=>{if(!this.popup)throw yt.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}Te.Communicator=vs;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.determineMethodCategory=void 0;const wt={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:[]};function _s(n){for(const e in wt){const t=e;if(wt[t].includes(n))return t}}je.determineMethodCategory=_s;var Es=M&&M.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s{try{if(this.connected)return this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),this.accounts;const h=await this.requestSignerSelection(),f=this.initSigner(h),d=await f.handshake();return this.signer=f,(0,ge.storeSignerType)(h),this.emit("connect",{chainId:(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id))}),d}catch(h){throw this.handleUnauthorizedError(h),h}},sign:async l=>{if(!this.connected||!this.signer)throw V.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(l)}catch(h){throw this.handleUnauthorizedError(h),h}},fetch:l=>(0,vt.fetchRPCRequest)(l,this.chain),state:l=>{const h=()=>{if(this.connected)return this.accounts;throw V.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(l.method){case"eth_chainId":return(0,X.hexStringFromIntNumber)((0,he.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return h();case"eth_coinbase":return h()[0];default:return this.handlers.unsupported(l)}},deprecated:({method:l})=>{throw V.standardErrors.rpc.methodNotSupported(`Method ${l} is deprecated.`)},unsupported:({method:l})=>{throw V.standardErrors.rpc.methodNotSupported(`Method ${l} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:l,source:h})=>{(0,X.areAddressArraysEqual)(this.accounts,l)||(this.accounts=l,h!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:l,source:h})=>{l.id===this.chain.id&&l.rpcUrl===this.chain.rpcUrl||(this.chain=l,h!=="storage"&&this.emit("chainChanged",(0,X.hexStringFromIntNumber)((0,he.IntNumber)(l.id))))}},this.metadata=s,this.preference=o,this.communicator=new Is.Communicator(a),this.chain={id:(r=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1};const c=(0,ge.loadSignerType)();this.signer=c?this.initSigner(c):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const r=(0,vt.checkErrorForInvalidRequestArgs)(e);if(r)throw r;const s=(t=(0,Ms.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(r){return Promise.reject((0,ks.serializeError)(r,e.method))}}handleUnauthorizedError(e){e.code===V.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},Ls.ScopedLocalStorage.clearAll(),this.emit("disconnect",V.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,ge.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,ge.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}be.CoinbaseWalletProvider=As;Object.defineProperty(te,"__esModule",{value:!0});te.CoinbaseWalletSDK=void 0;const Rs=me,xs=be,Ps=O,Ns=K,Ts=u,js=k;class Os{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 r={metadata:this.metadata,preference:e};return(t=(0,js.getCoinbaseInjectedProvider)(r))!==null&&t!==void 0?t:new xs.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,Rs.walletLogo)(e,t)}storeLatestVersion(){new Ps.ScopedLocalStorage("CBWSDK").setItem("VERSION",Ns.LIB_VERSION)}}te.CoinbaseWalletSDK=Os;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CoinbaseWalletSDK=void 0;const e=te;n.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(n,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ds=an(Et),Bs=Object.freeze(Object.defineProperty({__proto__:null,default:Ds},Symbol.toStringTag,{value:"Module"}));export{Bs as i}; diff --git a/buddybook/assets/index-FH8NN1-S.js b/buddybook/assets/index-BSVGFq6n.js similarity index 99% rename from buddybook/assets/index-FH8NN1-S.js rename to buddybook/assets/index-BSVGFq6n.js index 0b33e2a..f4264a4 100644 --- a/buddybook/assets/index-FH8NN1-S.js +++ b/buddybook/assets/index-BSVGFq6n.js @@ -1,4 +1,4 @@ -import{d as x,g as Hs,j as xc,l as Tc,h as Pc}from"./index-B-6Lwopd.js";import{r as $c}from"./inherits_browser-BwZ6FBWK.js";import{s as Oc,r as Ke,a as an,j as Bc,b as Dc}from"./hooks.module-D7M4pAco.js";import{e as ta}from"./events-BzDGR98G.js";var ra={},br={},cn={};Object.defineProperty(cn,"__esModule",{value:!0});cn.walletLogo=void 0;const jc=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};cn.walletLogo=jc;var ln={};Object.defineProperty(ln,"__esModule",{value:!0});ln.LINK_API_URL=void 0;ln.LINK_API_URL="https://www.walletlink.org";var A={},Us={exports:{}};Us.exports;(function(t){(function(e,r){function n(b,o){if(!b)throw new Error(o||"Assertion failed")}function i(b,o){b.super_=o;var l=function(){};l.prototype=o.prototype,b.prototype=new l,b.prototype.constructor=b}function s(b,o,l){if(s.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((o==="le"||o==="be")&&(l=o,o=10),this._init(b||0,o||10,l||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=$c.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,l){return o.cmp(l)>0?o:l},s.min=function(o,l){return o.cmp(l)<0?o:l},s.prototype._init=function(o,l,f){if(typeof o=="number")return this._initNumber(o,l,f);if(typeof o=="object")return this._initArray(o,l,f);l==="hex"&&(l=16),n(l===(l|0)&&l>=2&&l<=36),o=o.toString().replace(/\s+/g,"");var g=0;o[0]==="-"&&(g++,this.negative=1),g=0;g-=3)w=o[g]|o[g-1]<<8|o[g-2]<<16,this.words[m]|=w<<_&67108863,this.words[m+1]=w>>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);else if(f==="le")for(g=0,m=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);return this._strip()};function u(b,o){var l=b.charCodeAt(o);if(l>=48&&l<=57)return l-48;if(l>=65&&l<=70)return l-55;if(l>=97&&l<=102)return l-87;n(!1,"Invalid character in "+b)}function d(b,o,l){var f=u(b,l);return l-1>=o&&(f|=u(b,l-1)<<4),f}s.prototype._parseHex=function(o,l,f){this.length=Math.ceil((o.length-l)/6),this.words=new Array(this.length);for(var g=0;g=l;g-=2)_=d(o,l,g)<=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8;else{var p=o.length-l;for(g=p%2===0?l+1:l;g=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8}this._strip()};function h(b,o,l,f){for(var g=0,m=0,w=Math.min(b.length,l),_=o;_=49?m=p-49+10:p>=17?m=p-17+10:m=p,n(p>=0&&m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{s.prototype.inspect=S}else s.prototype.inspect=S;function S(){return(this.red?""}var E=["","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"],M=[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],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,l){o=o||10,l=l|0||1;var f;if(o===16||o==="hex"){f="";for(var g=0,m=0,w=0;w>>24-g&16777215,g+=2,g>=26&&(g-=26,w--),m!==0||w!==this.length-1?f=E[6-p.length]+p+f:f=p+f}for(m!==0&&(f=m.toString(16)+f);f.length%l!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],v=k[o];f="";var N=this.clone();for(N.negative=0;!N.isZero();){var I=N.modrn(v).toString(o);N=N.idivn(v),N.isZero()?f=I+f:f=E[a-I.length]+I+f}for(this.isZero()&&(f="0"+f);f.length%l!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},c&&(s.prototype.toBuffer=function(o,l){return this.toArrayLike(c,o,l)}),s.prototype.toArray=function(o,l){return this.toArrayLike(Array,o,l)};var T=function(o,l){return o.allocUnsafe?o.allocUnsafe(l):new o(l)};s.prototype.toArrayLike=function(o,l,f){this._strip();var g=this.byteLength(),m=f||Math.max(1,g);n(g<=m,"byte array longer than desired length"),n(m>0,"Requested array length <= 0");var w=T(o,m),_=l==="le"?"LE":"BE";return this["_toArrayLike"+_](w,g),w},s.prototype._toArrayLikeLE=function(o,l){for(var f=0,g=0,m=0,w=0;m>8&255),f>16&255),w===6?(f>24&255),g=0,w=0):(g=_>>>24,w+=2)}if(f=0&&(o[f--]=_>>8&255),f>=0&&(o[f--]=_>>16&255),w===6?(f>=0&&(o[f--]=_>>24&255),g=0,w=0):(g=_>>>24,w+=2)}if(f>=0)for(o[f--]=g;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var l=o,f=0;return l>=4096&&(f+=13,l>>>=13),l>=64&&(f+=7,l>>>=7),l>=8&&(f+=4,l>>>=4),l>=2&&(f+=2,l>>>=2),f+l},s.prototype._zeroBits=function(o){if(o===0)return 26;var l=o,f=0;return l&8191||(f+=13,l>>>=13),l&127||(f+=7,l>>>=7),l&15||(f+=4,l>>>=4),l&3||(f+=2,l>>>=2),l&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],l=this._countBits(o);return(this.length-1)*26+l};function O(b){for(var o=new Array(b.bitLength()),l=0;l>>g&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,l=0;lo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var l;this.length>o.length?l=o:l=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var l,f;this.length>o.length?(l=this,f=o):(l=o,f=this);for(var g=0;go.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var l=Math.ceil(o/26)|0,f=o%26;this._expand(l),f>0&&l--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,l){n(typeof o=="number"&&o>=0);var f=o/26|0,g=o%26;return this._expand(f+1),l?this.words[f]=this.words[f]|1<o.length?(f=this,g=o):(f=o,g=this);for(var m=0,w=0;w>>26;for(;m!==0&&w>>26;if(this.length=f.length,m!==0)this.words[this.length]=m,this.length++;else if(f!==this)for(;wo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var l=this.iadd(o);return o.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,m;f>0?(g=this,m=o):(g=o,m=this);for(var w=0,_=0;_>26,this.words[_]=l&67108863;for(;w!==0&&_>26,this.words[_]=l&67108863;if(w===0&&_>>26,N=p&67108863,I=Math.min(a,o.length-1),$=Math.max(0,a-b.length+1);$<=I;$++){var ze=a-$|0;g=b.words[ze]|0,m=o.words[$]|0,w=g*m+N,v+=w/67108864|0,N=w&67108863}l.words[a]=N|0,p=v|0}return p!==0?l.words[a]=p|0:l.length--,l._strip()}var L=function(o,l,f){var g=o.words,m=l.words,w=f.words,_=0,p,a,v,N=g[0]|0,I=N&8191,$=N>>>13,ze=g[1]|0,G=ze&8191,Z=ze>>>13,ki=g[2]|0,te=ki&8191,re=ki>>>13,Ri=g[3]|0,ne=Ri&8191,se=Ri>>>13,Ii=g[4]|0,ie=Ii&8191,oe=Ii>>>13,Ci=g[5]|0,ae=Ci&8191,ce=Ci>>>13,Ai=g[6]|0,le=Ai&8191,ue=Ai>>>13,Ni=g[7]|0,de=Ni&8191,he=Ni>>>13,Li=g[8]|0,fe=Li&8191,ge=Li>>>13,xi=g[9]|0,pe=xi&8191,me=xi>>>13,Ti=m[0]|0,ve=Ti&8191,we=Ti>>>13,Pi=m[1]|0,ye=Pi&8191,be=Pi>>>13,$i=m[2]|0,_e=$i&8191,Ee=$i>>>13,Oi=m[3]|0,Se=Oi&8191,Me=Oi>>>13,Bi=m[4]|0,ke=Bi&8191,Re=Bi>>>13,Di=m[5]|0,Ie=Di&8191,Ce=Di>>>13,ji=m[6]|0,Ae=ji&8191,Ne=ji>>>13,Fi=m[7]|0,Le=Fi&8191,xe=Fi>>>13,Hi=m[8]|0,Te=Hi&8191,Pe=Hi>>>13,Ui=m[9]|0,$e=Ui&8191,Oe=Ui>>>13;f.negative=o.negative^l.negative,f.length=19,p=Math.imul(I,ve),a=Math.imul(I,we),a=a+Math.imul($,ve)|0,v=Math.imul($,we);var Xn=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,p=Math.imul(G,ve),a=Math.imul(G,we),a=a+Math.imul(Z,ve)|0,v=Math.imul(Z,we),p=p+Math.imul(I,ye)|0,a=a+Math.imul(I,be)|0,a=a+Math.imul($,ye)|0,v=v+Math.imul($,be)|0;var Yn=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,p=Math.imul(te,ve),a=Math.imul(te,we),a=a+Math.imul(re,ve)|0,v=Math.imul(re,we),p=p+Math.imul(G,ye)|0,a=a+Math.imul(G,be)|0,a=a+Math.imul(Z,ye)|0,v=v+Math.imul(Z,be)|0,p=p+Math.imul(I,_e)|0,a=a+Math.imul(I,Ee)|0,a=a+Math.imul($,_e)|0,v=v+Math.imul($,Ee)|0;var es=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(es>>>26)|0,es&=67108863,p=Math.imul(ne,ve),a=Math.imul(ne,we),a=a+Math.imul(se,ve)|0,v=Math.imul(se,we),p=p+Math.imul(te,ye)|0,a=a+Math.imul(te,be)|0,a=a+Math.imul(re,ye)|0,v=v+Math.imul(re,be)|0,p=p+Math.imul(G,_e)|0,a=a+Math.imul(G,Ee)|0,a=a+Math.imul(Z,_e)|0,v=v+Math.imul(Z,Ee)|0,p=p+Math.imul(I,Se)|0,a=a+Math.imul(I,Me)|0,a=a+Math.imul($,Se)|0,v=v+Math.imul($,Me)|0;var ts=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ts>>>26)|0,ts&=67108863,p=Math.imul(ie,ve),a=Math.imul(ie,we),a=a+Math.imul(oe,ve)|0,v=Math.imul(oe,we),p=p+Math.imul(ne,ye)|0,a=a+Math.imul(ne,be)|0,a=a+Math.imul(se,ye)|0,v=v+Math.imul(se,be)|0,p=p+Math.imul(te,_e)|0,a=a+Math.imul(te,Ee)|0,a=a+Math.imul(re,_e)|0,v=v+Math.imul(re,Ee)|0,p=p+Math.imul(G,Se)|0,a=a+Math.imul(G,Me)|0,a=a+Math.imul(Z,Se)|0,v=v+Math.imul(Z,Me)|0,p=p+Math.imul(I,ke)|0,a=a+Math.imul(I,Re)|0,a=a+Math.imul($,ke)|0,v=v+Math.imul($,Re)|0;var rs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(rs>>>26)|0,rs&=67108863,p=Math.imul(ae,ve),a=Math.imul(ae,we),a=a+Math.imul(ce,ve)|0,v=Math.imul(ce,we),p=p+Math.imul(ie,ye)|0,a=a+Math.imul(ie,be)|0,a=a+Math.imul(oe,ye)|0,v=v+Math.imul(oe,be)|0,p=p+Math.imul(ne,_e)|0,a=a+Math.imul(ne,Ee)|0,a=a+Math.imul(se,_e)|0,v=v+Math.imul(se,Ee)|0,p=p+Math.imul(te,Se)|0,a=a+Math.imul(te,Me)|0,a=a+Math.imul(re,Se)|0,v=v+Math.imul(re,Me)|0,p=p+Math.imul(G,ke)|0,a=a+Math.imul(G,Re)|0,a=a+Math.imul(Z,ke)|0,v=v+Math.imul(Z,Re)|0,p=p+Math.imul(I,Ie)|0,a=a+Math.imul(I,Ce)|0,a=a+Math.imul($,Ie)|0,v=v+Math.imul($,Ce)|0;var ns=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ns>>>26)|0,ns&=67108863,p=Math.imul(le,ve),a=Math.imul(le,we),a=a+Math.imul(ue,ve)|0,v=Math.imul(ue,we),p=p+Math.imul(ae,ye)|0,a=a+Math.imul(ae,be)|0,a=a+Math.imul(ce,ye)|0,v=v+Math.imul(ce,be)|0,p=p+Math.imul(ie,_e)|0,a=a+Math.imul(ie,Ee)|0,a=a+Math.imul(oe,_e)|0,v=v+Math.imul(oe,Ee)|0,p=p+Math.imul(ne,Se)|0,a=a+Math.imul(ne,Me)|0,a=a+Math.imul(se,Se)|0,v=v+Math.imul(se,Me)|0,p=p+Math.imul(te,ke)|0,a=a+Math.imul(te,Re)|0,a=a+Math.imul(re,ke)|0,v=v+Math.imul(re,Re)|0,p=p+Math.imul(G,Ie)|0,a=a+Math.imul(G,Ce)|0,a=a+Math.imul(Z,Ie)|0,v=v+Math.imul(Z,Ce)|0,p=p+Math.imul(I,Ae)|0,a=a+Math.imul(I,Ne)|0,a=a+Math.imul($,Ae)|0,v=v+Math.imul($,Ne)|0;var ss=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ss>>>26)|0,ss&=67108863,p=Math.imul(de,ve),a=Math.imul(de,we),a=a+Math.imul(he,ve)|0,v=Math.imul(he,we),p=p+Math.imul(le,ye)|0,a=a+Math.imul(le,be)|0,a=a+Math.imul(ue,ye)|0,v=v+Math.imul(ue,be)|0,p=p+Math.imul(ae,_e)|0,a=a+Math.imul(ae,Ee)|0,a=a+Math.imul(ce,_e)|0,v=v+Math.imul(ce,Ee)|0,p=p+Math.imul(ie,Se)|0,a=a+Math.imul(ie,Me)|0,a=a+Math.imul(oe,Se)|0,v=v+Math.imul(oe,Me)|0,p=p+Math.imul(ne,ke)|0,a=a+Math.imul(ne,Re)|0,a=a+Math.imul(se,ke)|0,v=v+Math.imul(se,Re)|0,p=p+Math.imul(te,Ie)|0,a=a+Math.imul(te,Ce)|0,a=a+Math.imul(re,Ie)|0,v=v+Math.imul(re,Ce)|0,p=p+Math.imul(G,Ae)|0,a=a+Math.imul(G,Ne)|0,a=a+Math.imul(Z,Ae)|0,v=v+Math.imul(Z,Ne)|0,p=p+Math.imul(I,Le)|0,a=a+Math.imul(I,xe)|0,a=a+Math.imul($,Le)|0,v=v+Math.imul($,xe)|0;var is=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(is>>>26)|0,is&=67108863,p=Math.imul(fe,ve),a=Math.imul(fe,we),a=a+Math.imul(ge,ve)|0,v=Math.imul(ge,we),p=p+Math.imul(de,ye)|0,a=a+Math.imul(de,be)|0,a=a+Math.imul(he,ye)|0,v=v+Math.imul(he,be)|0,p=p+Math.imul(le,_e)|0,a=a+Math.imul(le,Ee)|0,a=a+Math.imul(ue,_e)|0,v=v+Math.imul(ue,Ee)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(ce,Se)|0,v=v+Math.imul(ce,Me)|0,p=p+Math.imul(ie,ke)|0,a=a+Math.imul(ie,Re)|0,a=a+Math.imul(oe,ke)|0,v=v+Math.imul(oe,Re)|0,p=p+Math.imul(ne,Ie)|0,a=a+Math.imul(ne,Ce)|0,a=a+Math.imul(se,Ie)|0,v=v+Math.imul(se,Ce)|0,p=p+Math.imul(te,Ae)|0,a=a+Math.imul(te,Ne)|0,a=a+Math.imul(re,Ae)|0,v=v+Math.imul(re,Ne)|0,p=p+Math.imul(G,Le)|0,a=a+Math.imul(G,xe)|0,a=a+Math.imul(Z,Le)|0,v=v+Math.imul(Z,xe)|0,p=p+Math.imul(I,Te)|0,a=a+Math.imul(I,Pe)|0,a=a+Math.imul($,Te)|0,v=v+Math.imul($,Pe)|0;var os=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(os>>>26)|0,os&=67108863,p=Math.imul(pe,ve),a=Math.imul(pe,we),a=a+Math.imul(me,ve)|0,v=Math.imul(me,we),p=p+Math.imul(fe,ye)|0,a=a+Math.imul(fe,be)|0,a=a+Math.imul(ge,ye)|0,v=v+Math.imul(ge,be)|0,p=p+Math.imul(de,_e)|0,a=a+Math.imul(de,Ee)|0,a=a+Math.imul(he,_e)|0,v=v+Math.imul(he,Ee)|0,p=p+Math.imul(le,Se)|0,a=a+Math.imul(le,Me)|0,a=a+Math.imul(ue,Se)|0,v=v+Math.imul(ue,Me)|0,p=p+Math.imul(ae,ke)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(ce,ke)|0,v=v+Math.imul(ce,Re)|0,p=p+Math.imul(ie,Ie)|0,a=a+Math.imul(ie,Ce)|0,a=a+Math.imul(oe,Ie)|0,v=v+Math.imul(oe,Ce)|0,p=p+Math.imul(ne,Ae)|0,a=a+Math.imul(ne,Ne)|0,a=a+Math.imul(se,Ae)|0,v=v+Math.imul(se,Ne)|0,p=p+Math.imul(te,Le)|0,a=a+Math.imul(te,xe)|0,a=a+Math.imul(re,Le)|0,v=v+Math.imul(re,xe)|0,p=p+Math.imul(G,Te)|0,a=a+Math.imul(G,Pe)|0,a=a+Math.imul(Z,Te)|0,v=v+Math.imul(Z,Pe)|0,p=p+Math.imul(I,$e)|0,a=a+Math.imul(I,Oe)|0,a=a+Math.imul($,$e)|0,v=v+Math.imul($,Oe)|0;var as=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(as>>>26)|0,as&=67108863,p=Math.imul(pe,ye),a=Math.imul(pe,be),a=a+Math.imul(me,ye)|0,v=Math.imul(me,be),p=p+Math.imul(fe,_e)|0,a=a+Math.imul(fe,Ee)|0,a=a+Math.imul(ge,_e)|0,v=v+Math.imul(ge,Ee)|0,p=p+Math.imul(de,Se)|0,a=a+Math.imul(de,Me)|0,a=a+Math.imul(he,Se)|0,v=v+Math.imul(he,Me)|0,p=p+Math.imul(le,ke)|0,a=a+Math.imul(le,Re)|0,a=a+Math.imul(ue,ke)|0,v=v+Math.imul(ue,Re)|0,p=p+Math.imul(ae,Ie)|0,a=a+Math.imul(ae,Ce)|0,a=a+Math.imul(ce,Ie)|0,v=v+Math.imul(ce,Ce)|0,p=p+Math.imul(ie,Ae)|0,a=a+Math.imul(ie,Ne)|0,a=a+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Ne)|0,p=p+Math.imul(ne,Le)|0,a=a+Math.imul(ne,xe)|0,a=a+Math.imul(se,Le)|0,v=v+Math.imul(se,xe)|0,p=p+Math.imul(te,Te)|0,a=a+Math.imul(te,Pe)|0,a=a+Math.imul(re,Te)|0,v=v+Math.imul(re,Pe)|0,p=p+Math.imul(G,$e)|0,a=a+Math.imul(G,Oe)|0,a=a+Math.imul(Z,$e)|0,v=v+Math.imul(Z,Oe)|0;var cs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(cs>>>26)|0,cs&=67108863,p=Math.imul(pe,_e),a=Math.imul(pe,Ee),a=a+Math.imul(me,_e)|0,v=Math.imul(me,Ee),p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ge,Se)|0,v=v+Math.imul(ge,Me)|0,p=p+Math.imul(de,ke)|0,a=a+Math.imul(de,Re)|0,a=a+Math.imul(he,ke)|0,v=v+Math.imul(he,Re)|0,p=p+Math.imul(le,Ie)|0,a=a+Math.imul(le,Ce)|0,a=a+Math.imul(ue,Ie)|0,v=v+Math.imul(ue,Ce)|0,p=p+Math.imul(ae,Ae)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(ce,Ae)|0,v=v+Math.imul(ce,Ne)|0,p=p+Math.imul(ie,Le)|0,a=a+Math.imul(ie,xe)|0,a=a+Math.imul(oe,Le)|0,v=v+Math.imul(oe,xe)|0,p=p+Math.imul(ne,Te)|0,a=a+Math.imul(ne,Pe)|0,a=a+Math.imul(se,Te)|0,v=v+Math.imul(se,Pe)|0,p=p+Math.imul(te,$e)|0,a=a+Math.imul(te,Oe)|0,a=a+Math.imul(re,$e)|0,v=v+Math.imul(re,Oe)|0;var ls=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ls>>>26)|0,ls&=67108863,p=Math.imul(pe,Se),a=Math.imul(pe,Me),a=a+Math.imul(me,Se)|0,v=Math.imul(me,Me),p=p+Math.imul(fe,ke)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ge,ke)|0,v=v+Math.imul(ge,Re)|0,p=p+Math.imul(de,Ie)|0,a=a+Math.imul(de,Ce)|0,a=a+Math.imul(he,Ie)|0,v=v+Math.imul(he,Ce)|0,p=p+Math.imul(le,Ae)|0,a=a+Math.imul(le,Ne)|0,a=a+Math.imul(ue,Ae)|0,v=v+Math.imul(ue,Ne)|0,p=p+Math.imul(ae,Le)|0,a=a+Math.imul(ae,xe)|0,a=a+Math.imul(ce,Le)|0,v=v+Math.imul(ce,xe)|0,p=p+Math.imul(ie,Te)|0,a=a+Math.imul(ie,Pe)|0,a=a+Math.imul(oe,Te)|0,v=v+Math.imul(oe,Pe)|0,p=p+Math.imul(ne,$e)|0,a=a+Math.imul(ne,Oe)|0,a=a+Math.imul(se,$e)|0,v=v+Math.imul(se,Oe)|0;var us=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(us>>>26)|0,us&=67108863,p=Math.imul(pe,ke),a=Math.imul(pe,Re),a=a+Math.imul(me,ke)|0,v=Math.imul(me,Re),p=p+Math.imul(fe,Ie)|0,a=a+Math.imul(fe,Ce)|0,a=a+Math.imul(ge,Ie)|0,v=v+Math.imul(ge,Ce)|0,p=p+Math.imul(de,Ae)|0,a=a+Math.imul(de,Ne)|0,a=a+Math.imul(he,Ae)|0,v=v+Math.imul(he,Ne)|0,p=p+Math.imul(le,Le)|0,a=a+Math.imul(le,xe)|0,a=a+Math.imul(ue,Le)|0,v=v+Math.imul(ue,xe)|0,p=p+Math.imul(ae,Te)|0,a=a+Math.imul(ae,Pe)|0,a=a+Math.imul(ce,Te)|0,v=v+Math.imul(ce,Pe)|0,p=p+Math.imul(ie,$e)|0,a=a+Math.imul(ie,Oe)|0,a=a+Math.imul(oe,$e)|0,v=v+Math.imul(oe,Oe)|0;var ds=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ds>>>26)|0,ds&=67108863,p=Math.imul(pe,Ie),a=Math.imul(pe,Ce),a=a+Math.imul(me,Ie)|0,v=Math.imul(me,Ce),p=p+Math.imul(fe,Ae)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ge,Ae)|0,v=v+Math.imul(ge,Ne)|0,p=p+Math.imul(de,Le)|0,a=a+Math.imul(de,xe)|0,a=a+Math.imul(he,Le)|0,v=v+Math.imul(he,xe)|0,p=p+Math.imul(le,Te)|0,a=a+Math.imul(le,Pe)|0,a=a+Math.imul(ue,Te)|0,v=v+Math.imul(ue,Pe)|0,p=p+Math.imul(ae,$e)|0,a=a+Math.imul(ae,Oe)|0,a=a+Math.imul(ce,$e)|0,v=v+Math.imul(ce,Oe)|0;var hs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(hs>>>26)|0,hs&=67108863,p=Math.imul(pe,Ae),a=Math.imul(pe,Ne),a=a+Math.imul(me,Ae)|0,v=Math.imul(me,Ne),p=p+Math.imul(fe,Le)|0,a=a+Math.imul(fe,xe)|0,a=a+Math.imul(ge,Le)|0,v=v+Math.imul(ge,xe)|0,p=p+Math.imul(de,Te)|0,a=a+Math.imul(de,Pe)|0,a=a+Math.imul(he,Te)|0,v=v+Math.imul(he,Pe)|0,p=p+Math.imul(le,$e)|0,a=a+Math.imul(le,Oe)|0,a=a+Math.imul(ue,$e)|0,v=v+Math.imul(ue,Oe)|0;var fs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(fs>>>26)|0,fs&=67108863,p=Math.imul(pe,Le),a=Math.imul(pe,xe),a=a+Math.imul(me,Le)|0,v=Math.imul(me,xe),p=p+Math.imul(fe,Te)|0,a=a+Math.imul(fe,Pe)|0,a=a+Math.imul(ge,Te)|0,v=v+Math.imul(ge,Pe)|0,p=p+Math.imul(de,$e)|0,a=a+Math.imul(de,Oe)|0,a=a+Math.imul(he,$e)|0,v=v+Math.imul(he,Oe)|0;var gs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(gs>>>26)|0,gs&=67108863,p=Math.imul(pe,Te),a=Math.imul(pe,Pe),a=a+Math.imul(me,Te)|0,v=Math.imul(me,Pe),p=p+Math.imul(fe,$e)|0,a=a+Math.imul(fe,Oe)|0,a=a+Math.imul(ge,$e)|0,v=v+Math.imul(ge,Oe)|0;var ps=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ps>>>26)|0,ps&=67108863,p=Math.imul(pe,$e),a=Math.imul(pe,Oe),a=a+Math.imul(me,$e)|0,v=Math.imul(me,Oe);var ms=(_+p|0)+((a&8191)<<13)|0;return _=(v+(a>>>13)|0)+(ms>>>26)|0,ms&=67108863,w[0]=Xn,w[1]=Yn,w[2]=es,w[3]=ts,w[4]=rs,w[5]=ns,w[6]=ss,w[7]=is,w[8]=os,w[9]=as,w[10]=cs,w[11]=ls,w[12]=us,w[13]=ds,w[14]=hs,w[15]=fs,w[16]=gs,w[17]=ps,w[18]=ms,_!==0&&(w[19]=_,f.length++),f};Math.imul||(L=B);function R(b,o,l){l.negative=o.negative^b.negative,l.length=b.length+o.length;for(var f=0,g=0,m=0;m>>26)|0,g+=w>>>26,w&=67108863}l.words[m]=_,f=w,w=g}return f!==0?l.words[m]=f:l.length--,l._strip()}function z(b,o,l){return R(b,o,l)}s.prototype.mulTo=function(o,l){var f,g=this.length+o.length;return this.length===10&&o.length===10?f=L(this,o,l):g<63?f=B(this,o,l):g<1024?f=R(this,o,l):f=z(this,o,l),f},s.prototype.mul=function(o){var l=new s(null);return l.words=new Array(this.length+o.length),this.mulTo(o,l)},s.prototype.mulf=function(o){var l=new s(null);return l.words=new Array(this.length+o.length),z(this,o,l)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var l=o<0;l&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,g=0;g>=26,f+=m/67108864|0,f+=w>>>26,this.words[g]=w&67108863}return f!==0&&(this.words[g]=f,this.length++),l?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var l=O(o);if(l.length===0)return new s(1);for(var f=this,g=0;g=0);var l=o%26,f=(o-l)/26,g=67108863>>>26-l<<26-l,m;if(l!==0){var w=0;for(m=0;m>>26-l}w&&(this.words[m]=w,this.length++)}if(f!==0){for(m=this.length-1;m>=0;m--)this.words[m+f]=this.words[m];for(m=0;m=0);var g;l?g=(l-l%26)/26:g=0;var m=o%26,w=Math.min((o-m)/26,this.length),_=67108863^67108863>>>m<w)for(this.length-=w,a=0;a=0&&(v!==0||a>=g);a--){var N=this.words[a]|0;this.words[a]=v<<26-m|N>>>m,v=N&_}return p&&v!==0&&(p.words[p.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,l,f){return n(this.negative===0),this.iushrn(o,l,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var l=o%26,f=(o-l)/26,g=1<=0);var l=o%26,f=(o-l)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(l!==0&&f++,this.length=Math.min(f,this.length),l!==0){var g=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(p/67108864|0),this.words[m+f]=w&67108863}for(;m>26,this.words[m+f]=w&67108863;if(_===0)return this._strip();for(n(_===-1),_=0,m=0;m>26,this.words[m]=w&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,l){var f=this.length-o.length,g=this.clone(),m=o,w=m.words[m.length-1]|0,_=this._countBits(w);f=26-_,f!==0&&(m=m.ushln(f),g.iushln(f),w=m.words[m.length-1]|0);var p=g.length-m.length,a;if(l!=="mod"){a=new s(null),a.length=p+1,a.words=new Array(a.length);for(var v=0;v=0;I--){var $=(g.words[m.length+I]|0)*67108864+(g.words[m.length+I-1]|0);for($=Math.min($/w|0,67108863),g._ishlnsubmul(m,$,I);g.negative!==0;)$--,g.negative=0,g._ishlnsubmul(m,1,I),g.isZero()||(g.negative^=1);a&&(a.words[I]=$)}return a&&a._strip(),g._strip(),l!=="div"&&f!==0&&g.iushrn(f),{div:a||null,mod:g}},s.prototype.divmod=function(o,l,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,m,w;return this.negative!==0&&o.negative===0?(w=this.neg().divmod(o,l),l!=="mod"&&(g=w.div.neg()),l!=="div"&&(m=w.mod.neg(),f&&m.negative!==0&&m.iadd(o)),{div:g,mod:m}):this.negative===0&&o.negative!==0?(w=this.divmod(o.neg(),l),l!=="mod"&&(g=w.div.neg()),{div:g,mod:w.mod}):this.negative&o.negative?(w=this.neg().divmod(o.neg(),l),l!=="div"&&(m=w.mod.neg(),f&&m.negative!==0&&m.isub(o)),{div:w.div,mod:m}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?l==="div"?{div:this.divn(o.words[0]),mod:null}:l==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,l)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var l=this.divmod(o);if(l.mod.isZero())return l.div;var f=l.div.negative!==0?l.mod.isub(o):l.mod,g=o.ushrn(1),m=o.andln(1),w=f.cmp(g);return w<0||m===1&&w===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},s.prototype.modrn=function(o){var l=o<0;l&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,g=0,m=this.length-1;m>=0;m--)g=(f*g+(this.words[m]|0))%o;return l?-g:g},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var l=o<0;l&&(o=-o),n(o<=67108863);for(var f=0,g=this.length-1;g>=0;g--){var m=(this.words[g]|0)+f*67108864;this.words[g]=m/o|0,f=m%o}return this._strip(),l?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var l=this,f=o.clone();l.negative!==0?l=l.umod(o):l=l.clone();for(var g=new s(1),m=new s(0),w=new s(0),_=new s(1),p=0;l.isEven()&&f.isEven();)l.iushrn(1),f.iushrn(1),++p;for(var a=f.clone(),v=l.clone();!l.isZero();){for(var N=0,I=1;!(l.words[0]&I)&&N<26;++N,I<<=1);if(N>0)for(l.iushrn(N);N-- >0;)(g.isOdd()||m.isOdd())&&(g.iadd(a),m.isub(v)),g.iushrn(1),m.iushrn(1);for(var $=0,ze=1;!(f.words[0]&ze)&&$<26;++$,ze<<=1);if($>0)for(f.iushrn($);$-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(a),_.isub(v)),w.iushrn(1),_.iushrn(1);l.cmp(f)>=0?(l.isub(f),g.isub(w),m.isub(_)):(f.isub(l),w.isub(g),_.isub(m))}return{a:w,b:_,gcd:f.iushln(p)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var l=this,f=o.clone();l.negative!==0?l=l.umod(o):l=l.clone();for(var g=new s(1),m=new s(0),w=f.clone();l.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,p=1;!(l.words[0]&p)&&_<26;++_,p<<=1);if(_>0)for(l.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(w),g.iushrn(1);for(var a=0,v=1;!(f.words[0]&v)&&a<26;++a,v<<=1);if(a>0)for(f.iushrn(a);a-- >0;)m.isOdd()&&m.iadd(w),m.iushrn(1);l.cmp(f)>=0?(l.isub(f),g.isub(m)):(f.isub(l),m.isub(g))}var N;return l.cmpn(1)===0?N=g:N=m,N.cmpn(0)<0&&N.iadd(o),N},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var l=this.clone(),f=o.clone();l.negative=0,f.negative=0;for(var g=0;l.isEven()&&f.isEven();g++)l.iushrn(1),f.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;f.isEven();)f.iushrn(1);var m=l.cmp(f);if(m<0){var w=l;l=f,f=w}else if(m===0||f.cmpn(1)===0)break;l.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var l=o%26,f=(o-l)/26,g=1<>>26,_&=67108863,this.words[w]=_}return m!==0&&(this.words[w]=m,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var l=o<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var f;if(this.length>1)f=1;else{l&&(o=-o),n(o<=67108863,"Number is too big");var g=this.words[0]|0;f=g===o?0:go.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,m=o.words[f]|0;if(g!==m){gm&&(l=1);break}}return l},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new H(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function P(b,o){this.name=b,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},P.prototype.ireduce=function(o){var l=o,f;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),f=l.bitLength();while(f>this.n);var g=f0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},P.prototype.split=function(o,l){o.iushrn(this.n,0,l)},P.prototype.imulK=function(o){return o.imul(this.k)};function J(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(J,P),J.prototype.split=function(o,l){for(var f=4194303,g=Math.min(o.length,9),m=0;m>>22,w=_}w>>>=22,o.words[m-10]=w,w===0&&o.length>10?o.length-=10:o.length-=9},J.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var l=0,f=0;f>>=26,o.words[f]=m,l=g}return l!==0&&(o.words[o.length++]=l),o},s._prime=function(o){if(C[o])return C[o];var l;if(o==="k256")l=new J;else if(o==="p224")l=new We;else if(o==="p192")l=new Qe;else if(o==="p25519")l=new Y;else throw new Error("Unknown prime "+o);return C[o]=l,l};function H(b){if(typeof b=="string"){var o=s._prime(b);this.m=o.p,this.prime=o}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}H.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},H.prototype._verify2=function(o,l){n((o.negative|l.negative)===0,"red works only with positives"),n(o.red&&o.red===l.red,"red works only with red numbers")},H.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(y(o,o.umod(this.m)._forceRed(this)),o)},H.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},H.prototype.add=function(o,l){this._verify2(o,l);var f=o.add(l);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},H.prototype.iadd=function(o,l){this._verify2(o,l);var f=o.iadd(l);return f.cmp(this.m)>=0&&f.isub(this.m),f},H.prototype.sub=function(o,l){this._verify2(o,l);var f=o.sub(l);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},H.prototype.isub=function(o,l){this._verify2(o,l);var f=o.isub(l);return f.cmpn(0)<0&&f.iadd(this.m),f},H.prototype.shl=function(o,l){return this._verify1(o),this.imod(o.ushln(l))},H.prototype.imul=function(o,l){return this._verify2(o,l),this.imod(o.imul(l))},H.prototype.mul=function(o,l){return this._verify2(o,l),this.imod(o.mul(l))},H.prototype.isqr=function(o){return this.imul(o,o.clone())},H.prototype.sqr=function(o){return this.mul(o,o)},H.prototype.sqrt=function(o){if(o.isZero())return o.clone();var l=this.m.andln(3);if(n(l%2===1),l===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var g=this.m.subn(1),m=0;!g.isZero()&&g.andln(1)===0;)m++,g.iushrn(1);n(!g.isZero());var w=new s(1).toRed(this),_=w.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new s(2*a*a).toRed(this);this.pow(a,p).cmp(_)!==0;)a.redIAdd(_);for(var v=this.pow(a,g),N=this.pow(o,g.addn(1).iushrn(1)),I=this.pow(o,g),$=m;I.cmp(w)!==0;){for(var ze=I,G=0;ze.cmp(w)!==0;G++)ze=ze.redSqr();n(G<$);var Z=this.pow(v,new s(1).iushln($-G-1));N=N.redMul(Z),v=Z.redSqr(),I=I.redMul(v),$=G}return N},H.prototype.invm=function(o){var l=o._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},H.prototype.pow=function(o,l){if(l.isZero())return new s(1).toRed(this);if(l.cmpn(1)===0)return o.clone();var f=4,g=new Array(1<=0;m--){for(var v=l.words[m],N=a-1;N>=0;N--){var I=v>>N&1;if(w!==g[0]&&(w=this.sqr(w)),I===0&&_===0){p=0;continue}_<<=1,_|=I,p++,!(p!==f&&(m!==0||N!==0))&&(w=this.mul(w,g[_]),p=0,_=0)}a=26}return w},H.prototype.convertTo=function(o){var l=o.umod(this.m);return l===o?l.clone():l},H.prototype.convertFrom=function(o){var l=o.clone();return l.red=null,l},s.mont=function(o){return new q(o)};function q(b){H.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(q,H),q.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},q.prototype.convertFrom=function(o){var l=this.imod(o.mul(this.rinv));return l.red=null,l},q.prototype.imul=function(o,l){if(o.isZero()||l.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(l),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=f.isub(g).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},q.prototype.mul=function(o,l){if(o.isZero()||l.isZero())return new s(0)._forceRed(this);var f=o.mul(l),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=f.isub(g).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},q.prototype.invm=function(o){var l=this.imod(o._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(t,x)})(Us);var un=Us.exports,Sr={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.errorValues=St.standardErrorCodes=void 0;St.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};St.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var dn={},hn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=St,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(E,M=r){if(E&&Number.isInteger(E)){const k=E.toString();if(y(e.errorValues,k))return e.errorValues[k].message;if(d(E))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return M}t.getMessageFromCode=n;function i(E){if(!Number.isInteger(E))return!1;const M=E.toString();return!!(e.errorValues[M]||d(E))}t.isValidCode=i;function s(E){var M;if(typeof E=="number")return E;if(c(E))return(M=E.code)!==null&&M!==void 0?M:E.errorCode}t.getErrorCode=s;function c(E){return typeof E=="object"&&E!==null&&(typeof E.code=="number"||typeof E.errorCode=="number")}function u(E,{shouldIncludeStack:M=!1}={}){const k={};if(E&&typeof E=="object"&&!Array.isArray(E)&&y(E,"code")&&i(E.code)){const T=E;k.code=T.code,T.message&&typeof T.message=="string"?(k.message=T.message,y(T,"data")&&(k.data=T.data)):(k.message=n(k.code),k.data={originalError:h(E)})}else k.code=e.standardErrorCodes.rpc.internal,k.message=S(E,"message")?E.message:r,k.data={originalError:h(E)};return M&&(k.stack=S(E,"stack")?E.stack:void 0),k}t.serialize=u;function d(E){return E>=-32099&&E<=-32e3}function h(E){return E&&typeof E=="object"&&!Array.isArray(E)?Object.assign({},E):E}function y(E,M){return Object.prototype.hasOwnProperty.call(E,M)}function S(E,M){return typeof E=="object"&&E!==null&&M in E&&typeof E[M]=="string"}})(hn);Object.defineProperty(dn,"__esModule",{value:!0});dn.standardErrors=void 0;const He=St,na=hn;dn.standardErrors={rpc:{parse:t=>rt(He.standardErrorCodes.rpc.parse,t),invalidRequest:t=>rt(He.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>rt(He.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>rt(He.standardErrorCodes.rpc.methodNotFound,t),internal:t=>rt(He.standardErrorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return rt(e,t)},invalidInput:t=>rt(He.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>rt(He.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>rt(He.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>rt(He.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>rt(He.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>rt(He.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Wt(He.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>Wt(He.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>Wt(He.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>Wt(He.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>Wt(He.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>Wt(He.standardErrorCodes.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new oa(e,r,n)}}};function rt(t,e){const[r,n]=sa(e);return new ia(t,r||(0,na.getMessageFromCode)(t),n)}function Wt(t,e){const[r,n]=sa(e);return new oa(t,r||(0,na.getMessageFromCode)(t),n)}function sa(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}let ia=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},oa=class extends ia{constructor(e,r,n){if(!Fc(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function Fc(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var fn={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});cr.isErrorResponse=void 0;function Hc(t){return t.errorMessage!==void 0}cr.isErrorResponse=Hc;var lr={};Object.defineProperty(lr,"__esModule",{value:!0});lr.LIB_VERSION=void 0;lr.LIB_VERSION="3.9.3";Object.defineProperty(fn,"__esModule",{value:!0});fn.serializeError=void 0;const Uc=cr,Vc=lr,Wc=St,zc=hn;function qc(t,e){const r=(0,zc.serialize)(Jc(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",Vc.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=Gc(r.data,e);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}fn.serializeError=qc;function Jc(t){return typeof t=="string"?{message:t,code:Wc.standardErrorCodes.rpc.internal}:(0,Uc.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function Gc(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=St;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=dn;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=fn;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=hn;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(Sr);var De={};Object.defineProperty(De,"__esModule",{value:!0});De.ProviderType=De.RegExpString=De.IntNumber=De.BigIntString=De.AddressString=De.HexString=De.OpaqueType=void 0;function Mr(){return t=>t}De.OpaqueType=Mr;De.HexString=Mr();De.AddressString=Mr();De.BigIntString=Mr();function Zc(t){return Math.floor(t)}De.IntNumber=Zc;De.RegExpString=Mr();var Vi;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(Vi||(De.ProviderType=Vi={}));var Qc=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(A,"__esModule",{value:!0});A.isMobileWeb=A.getLocation=A.isInIFrame=A.createQrUrl=A.getFavicon=A.range=A.isBigNumber=A.ensureParsedJSONObject=A.ensureBN=A.ensureRegExpString=A.ensureIntNumber=A.ensureBuffer=A.ensureAddressString=A.ensureEvenLengthHexString=A.ensureHexString=A.isHexString=A.prepend0x=A.strip0x=A.has0xPrefix=A.hexStringFromIntNumber=A.intNumberFromHexString=A.bigIntStringFromBN=A.hexStringFromBuffer=A.hexStringToUint8Array=A.uint8ArrayToHex=A.randomBytesHex=void 0;const Rt=Qc(un),Ht=Sr,ot=De,aa=/^[0-9]*$/,ca=/^[a-f0-9]*$/;function Kc(t){return la(crypto.getRandomValues(new Uint8Array(t)))}A.randomBytesHex=Kc;function la(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}A.uint8ArrayToHex=la;function Xc(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}A.hexStringToUint8Array=Xc;function Yc(t,e=!1){const r=t.toString("hex");return(0,ot.HexString)(e?`0x${r}`:r)}A.hexStringFromBuffer=Yc;function el(t){return(0,ot.BigIntString)(t.toString(10))}A.bigIntStringFromBN=el;function tl(t){return(0,ot.IntNumber)(new Rt.default(Rr(t,!1),16).toNumber())}A.intNumberFromHexString=tl;function rl(t){return(0,ot.HexString)(`0x${new Rt.default(t).toString(16)}`)}A.hexStringFromIntNumber=rl;function Vs(t){return t.startsWith("0x")||t.startsWith("0X")}A.has0xPrefix=Vs;function gn(t){return Vs(t)?t.slice(2):t}A.strip0x=gn;function ua(t){return Vs(t)?`0x${t.slice(2)}`:`0x${t}`}A.prepend0x=ua;function kr(t){if(typeof t!="string")return!1;const e=gn(t).toLowerCase();return ca.test(e)}A.isHexString=kr;function da(t,e=!1){if(typeof t=="string"){const r=gn(t).toLowerCase();if(ca.test(r))return(0,ot.HexString)(e?`0x${r}`:r)}throw Ht.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}A.ensureHexString=da;function Rr(t,e=!1){let r=da(t,!1);return r.length%2===1&&(r=(0,ot.HexString)(`0${r}`)),e?(0,ot.HexString)(`0x${r}`):r}A.ensureEvenLengthHexString=Rr;function nl(t){if(typeof t=="string"){const e=gn(t).toLowerCase();if(kr(e)&&e.length===40)return(0,ot.AddressString)(ua(e))}throw Ht.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}A.ensureAddressString=nl;function sl(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(kr(t)){const e=Rr(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ht.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}A.ensureBuffer=sl;function ha(t){if(typeof t=="number"&&Number.isInteger(t))return(0,ot.IntNumber)(t);if(typeof t=="string"){if(aa.test(t))return(0,ot.IntNumber)(Number(t));if(kr(t))return(0,ot.IntNumber)(new Rt.default(Rr(t,!1),16).toNumber())}throw Ht.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}A.ensureIntNumber=ha;function il(t){if(t instanceof RegExp)return(0,ot.RegExpString)(t.toString());throw Ht.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}A.ensureRegExpString=il;function ol(t){if(t!==null&&(Rt.default.isBN(t)||fa(t)))return new Rt.default(t.toString(10),10);if(typeof t=="number")return new Rt.default(ha(t));if(typeof t=="string"){if(aa.test(t))return new Rt.default(t,10);if(kr(t))return new Rt.default(Rr(t,!1),16)}throw Ht.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}A.ensureBN=ol;function al(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ht.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}A.ensureParsedJSONObject=al;function fa(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}A.isBigNumber=fa;function cl(t,e){return Array.from({length:e-t},(r,n)=>t+n)}A.range=cl;function ll(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}A.getFavicon=ll;function ul(t,e,r,n,i,s){const c=n?"parent-id":"id",u=new URLSearchParams({[c]:t,secret:e,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${u}`}A.createQrUrl=ul;function ga(){try{return window.frameElement!==null}catch{return!1}}A.isInIFrame=ga;function dl(){try{return ga()&&window.top?window.top.location:window.location}catch{return window.location}}A.getLocation=dl;function hl(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}A.isMobileWeb=hl;var pn={};Object.defineProperty(pn,"__esModule",{value:!0});pn.ScopedLocalStorage=void 0;class fl{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}pn.ScopedLocalStorage=fl;var rr={},Ir={},Cr={},ur={};Object.defineProperty(ur,"__esModule",{value:!0});ur.EVENTS=void 0;ur.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var it={};Object.defineProperty(it,"__esModule",{value:!0});it.RelayAbstract=it.APP_VERSION_KEY=it.LOCAL_STORAGE_ADDRESSES_KEY=it.WALLET_USER_NAME_KEY=void 0;const Wi=Sr;it.WALLET_USER_NAME_KEY="walletUsername";it.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";it.APP_VERSION_KEY="AppVersion";class gl{async makeEthereumJSONRPCRequest(e,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(e),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw Wi.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,Wi.serializeError)(s,e.method);return i})}}it.RelayAbstract=gl;var dr={};Object.defineProperty(dr,"__esModule",{value:!0});dr.Session=void 0;const zi=Oc,qi=A,Ji="session:id",Gi="session:secret",Zi="session:linked";class Ws{constructor(e,r,n,i){this._storage=e,this._id=r||(0,qi.randomBytesHex)(16),this._secret=n||(0,qi.randomBytesHex)(32),this._key=new zi.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(e){const r=e.getItem(Ji),n=e.getItem(Zi),i=e.getItem(Gi);return r&&i?new Ws(e,r,i,n==="1"):null}static hash(e){return new zi.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(Ji,this._id),this._storage.setItem(Gi,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Zi,this._linked?"1":"0")}}dr.Session=Ws;var mn={},vn={};Object.defineProperty(vn,"__esModule",{value:!0});vn.Cipher=void 0;const Wr=A;class pl{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,Wr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,c=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),u=16,d=c.slice(c.byteLength-u),h=c.slice(0,c.byteLength-u),y=new Uint8Array(d),S=new Uint8Array(h),E=new Uint8Array([...n,...y,...S]);return(0,Wr.uint8ArrayToHex)(E)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,Wr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),c=(0,Wr.hexStringToUint8Array)(e),u=c.slice(0,12),d=c.slice(12,28),h=c.slice(28),y=new Uint8Array([...h,...d]),S={name:"AES-GCM",iv:new Uint8Array(u)};try{const E=await window.crypto.subtle.decrypt(S,s,y),M=new TextDecoder;n(M.decode(E))}catch(E){i(E)}})()})}}vn.Cipher=pl;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});wn.WalletLinkHTTP=void 0;class ml{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(c=>c.event==="Web3Response").map(c=>({type:"Event",sessionId:this.sessionId,eventId:c.id,event:c.event,data:c.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wn.WalletLinkHTTP=ml;var nr={};Object.defineProperty(nr,"__esModule",{value:!0});nr.WalletLinkWebSocket=nr.ConnectionState=void 0;var Kt;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Kt||(nr.ConnectionState=Kt={}));class vl{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Kt.CONNECTING),i.onclose=s=>{var c;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(c=this.connectionStateListener)===null||c===void 0||c.call(this,Kt.DISCONNECTED)},i.onopen=s=>{var c;e(),(c=this.connectionStateListener)===null||c===void 0||c.call(this,Kt.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var c,u;if(s.data==="h")(c=this.incomingDataListener)===null||c===void 0||c.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(u=this.incomingDataListener)===null||u===void 0||u.call(this,d)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Kt.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}nr.WalletLinkWebSocket=vl;Object.defineProperty(mn,"__esModule",{value:!0});mn.WalletLinkConnection=void 0;const zt=De,wl=vn,ht=ur,Qi=it,qt=dr,yl=wn,zr=nr,Ki=1e4,bl=6e4;class _l{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,zt.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=u=>{if(!u)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>u.JsonRpcUrl&&this.handleChainUpdated(h,u.JsonRpcUrl)]]).forEach((h,y)=>{const S=u[y];S!==void 0&&h(S)})},this.handleDestroyed=u=>{var d,h;u==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:qt.Session.hash(this.session.id)}))},this.handleAccountUpdated=async u=>{var d,h;try{const y=await this.cipher.decrypt(u);(d=this.listener)===null||d===void 0||d.accountUpdated(y)}catch{(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(u,d)=>{var h,y;try{const S=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(u,S)}catch{(y=this.diagnostic)===null||y===void 0||y.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:u})}},this.handleWalletUsernameUpdated=async u=>{this.handleMetadataUpdated(Qi.WALLET_USER_NAME_KEY,u)},this.handleAppVersionUpdated=async u=>{this.handleMetadataUpdated(Qi.APP_VERSION_KEY,u)},this.handleChainUpdated=async(u,d)=>{var h,y;try{const S=await this.cipher.decrypt(u),E=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(S,E)}catch{(y=this.diagnostic)===null||y===void 0||y.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new wl.Cipher(e.secret),this.diagnostic=i,this.listener=n;const c=new zr.WalletLinkWebSocket(`${r}/rpc`,s);c.setConnectionStateListener(async u=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(ht.EVENTS.CONNECTED_STATE_CHANGE,{state:u,sessionIdHash:qt.Session.hash(e.id)});let h=!1;switch(u){case zr.ConnectionState.DISCONNECTED:if(!this.destroyed){const y=async()=>{await new Promise(S=>setTimeout(S,5e3)),this.destroyed||c.connect().catch(()=>{y()})};y()}break;case zr.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ki),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case zr.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),c.setIncomingDataListener(u=>{var d,h,y;switch(u.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const S=u.type==="IsLinkedOK"?u.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(ht.EVENTS.LINKED,{sessionIdHash:qt.Session.hash(e.id),linked:S,type:u.type,onlineGuests:u.onlineGuests}),this.linked=S||u.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:qt.Session.hash(e.id),metadata_keys:u&&u.metadata?Object.keys(u.metadata):void 0}),this.handleSessionMetadataUpdated(u.metadata);break}case"Event":{this.handleIncomingEvent(u);break}}u.id!==void 0&&((y=this.requestResolutions.get(u.id))===null||y===void 0||y(u))}),this.ws=c,this.http=new yl.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(ht.EVENTS.STARTED_CONNECTING,{sessionIdHash:qt.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(ht.EVENTS.DISCONNECTED,{sessionIdHash:qt.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const i=await this.cipher.decrypt(e.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const c=await this.makeRequest(s);if(c.type==="Fail")throw new Error(c.error||"failed to publish event");return c.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ki*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=bl){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,c)=>{i=window.setTimeout(()=>{c(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,c=>{clearTimeout(i),s(c),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}mn.WalletLinkConnection=_l;var Ar={},Nr={},zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.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 El=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.injectCssReset=void 0;const Sl=El(zs);function Ml(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Sl.default)),document.documentElement.appendChild(t)}Nr.injectCssReset=Ml;var yn={},bn={};function pa(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}ma.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=wt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=K.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=K.getBCHTypeInfo(r),i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,i=7,s=0,c=this.moduleCount-1;c>0;c-=2)for(c==6&&c--;;){for(var u=0;u<2;u++)if(this.modules[n][c-u]==null){var d=!1;s>>i&1)==1);var h=K.getMask(e,n,c-u);h&&(d=!d),this.modules[n][c-u]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};wt.PAD0=236;wt.PAD1=17;wt.createData=function(t,e,r){for(var n=vt.getRSBlocks(t,e),i=new va,s=0;su*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+u*8+")");for(i.getLengthInBits()+4<=u*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=u*8||(i.put(wt.PAD0,8),i.getLengthInBits()>=u*8));)i.put(wt.PAD1,8);return wt.createBytes(i,n)};wt.createBytes=function(t,e){for(var r=0,n=0,i=0,s=new Array(e.length),c=new Array(e.length),u=0;u=0?M.get(k):0}}for(var T=0,y=0;y=0;)e^=K.G15<=0;)e^=K.G18<>>=1;return e},getPatternPosition:function(t){return K.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case Mt.PATTERN000:return(e+r)%2==0;case Mt.PATTERN001:return e%2==0;case Mt.PATTERN010:return r%3==0;case Mt.PATTERN011:return(e+r)%3==0;case Mt.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Mt.PATTERN101:return e*r%2+e*r%3==0;case Mt.PATTERN110:return(e*r%2+e*r%3)%2==0;case Mt.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new Xt([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)t-=255;return Fe.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ue=0;Ue<8;Ue++)Fe.EXP_TABLE[Ue]=1<>>7-t%8&1)==1},put:function(t,e){for(var r=0;r>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var vs=[[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 wa(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return It.L;case"M":return It.M;case"Q":return It.Q;case"H":return It.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var y=i(d),S=1,E=0,M=0,k=vs.length;M<=k;M++){var T=vs[M];if(!T)throw new Error("Content too long: expected "+E+" but got "+y);switch(h){case"L":E=T[0];break;case"M":E=T[1];break;case"Q":E=T[2];break;case"H":E=T[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(y<=E)break;S++}if(S>vs.length)throw new Error("Content too long");return S}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,c=n(s,this.options.ecl),u=r(this.options.ecl);this.qrcode=new wt(c,u),this.qrcode.addData(s),this.qrcode.make()}wa.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,i=n?" ":"",s=n?`\r +import{d as x,g as Hs,j as xc,l as Tc,h as Pc}from"./index-CP6_TFKv.js";import{r as $c}from"./inherits_browser-C53US4G5.js";import{s as Oc,r as Ke,a as an,j as Bc,b as Dc}from"./hooks.module-ClmD75_J.js";import{e as ta}from"./events-0WpuQ3DP.js";var ra={},br={},cn={};Object.defineProperty(cn,"__esModule",{value:!0});cn.walletLogo=void 0;const jc=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};cn.walletLogo=jc;var ln={};Object.defineProperty(ln,"__esModule",{value:!0});ln.LINK_API_URL=void 0;ln.LINK_API_URL="https://www.walletlink.org";var A={},Us={exports:{}};Us.exports;(function(t){(function(e,r){function n(b,o){if(!b)throw new Error(o||"Assertion failed")}function i(b,o){b.super_=o;var l=function(){};l.prototype=o.prototype,b.prototype=new l,b.prototype.constructor=b}function s(b,o,l){if(s.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((o==="le"||o==="be")&&(l=o,o=10),this._init(b||0,o||10,l||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=$c.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,l){return o.cmp(l)>0?o:l},s.min=function(o,l){return o.cmp(l)<0?o:l},s.prototype._init=function(o,l,f){if(typeof o=="number")return this._initNumber(o,l,f);if(typeof o=="object")return this._initArray(o,l,f);l==="hex"&&(l=16),n(l===(l|0)&&l>=2&&l<=36),o=o.toString().replace(/\s+/g,"");var g=0;o[0]==="-"&&(g++,this.negative=1),g=0;g-=3)w=o[g]|o[g-1]<<8|o[g-2]<<16,this.words[m]|=w<<_&67108863,this.words[m+1]=w>>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);else if(f==="le")for(g=0,m=0;g>>26-_&67108863,_+=24,_>=26&&(_-=26,m++);return this._strip()};function u(b,o){var l=b.charCodeAt(o);if(l>=48&&l<=57)return l-48;if(l>=65&&l<=70)return l-55;if(l>=97&&l<=102)return l-87;n(!1,"Invalid character in "+b)}function d(b,o,l){var f=u(b,l);return l-1>=o&&(f|=u(b,l-1)<<4),f}s.prototype._parseHex=function(o,l,f){this.length=Math.ceil((o.length-l)/6),this.words=new Array(this.length);for(var g=0;g=l;g-=2)_=d(o,l,g)<=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8;else{var p=o.length-l;for(g=p%2===0?l+1:l;g=18?(m-=18,w+=1,this.words[w]|=_>>>26):m+=8}this._strip()};function h(b,o,l,f){for(var g=0,m=0,w=Math.min(b.length,l),_=o;_=49?m=p-49+10:p>=17?m=p-17+10:m=p,n(p>=0&&m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{s.prototype.inspect=S}else s.prototype.inspect=S;function S(){return(this.red?""}var E=["","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"],M=[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],k=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,l){o=o||10,l=l|0||1;var f;if(o===16||o==="hex"){f="";for(var g=0,m=0,w=0;w>>24-g&16777215,g+=2,g>=26&&(g-=26,w--),m!==0||w!==this.length-1?f=E[6-p.length]+p+f:f=p+f}for(m!==0&&(f=m.toString(16)+f);f.length%l!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var a=M[o],v=k[o];f="";var N=this.clone();for(N.negative=0;!N.isZero();){var I=N.modrn(v).toString(o);N=N.idivn(v),N.isZero()?f=I+f:f=E[a-I.length]+I+f}for(this.isZero()&&(f="0"+f);f.length%l!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},c&&(s.prototype.toBuffer=function(o,l){return this.toArrayLike(c,o,l)}),s.prototype.toArray=function(o,l){return this.toArrayLike(Array,o,l)};var T=function(o,l){return o.allocUnsafe?o.allocUnsafe(l):new o(l)};s.prototype.toArrayLike=function(o,l,f){this._strip();var g=this.byteLength(),m=f||Math.max(1,g);n(g<=m,"byte array longer than desired length"),n(m>0,"Requested array length <= 0");var w=T(o,m),_=l==="le"?"LE":"BE";return this["_toArrayLike"+_](w,g),w},s.prototype._toArrayLikeLE=function(o,l){for(var f=0,g=0,m=0,w=0;m>8&255),f>16&255),w===6?(f>24&255),g=0,w=0):(g=_>>>24,w+=2)}if(f=0&&(o[f--]=_>>8&255),f>=0&&(o[f--]=_>>16&255),w===6?(f>=0&&(o[f--]=_>>24&255),g=0,w=0):(g=_>>>24,w+=2)}if(f>=0)for(o[f--]=g;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var l=o,f=0;return l>=4096&&(f+=13,l>>>=13),l>=64&&(f+=7,l>>>=7),l>=8&&(f+=4,l>>>=4),l>=2&&(f+=2,l>>>=2),f+l},s.prototype._zeroBits=function(o){if(o===0)return 26;var l=o,f=0;return l&8191||(f+=13,l>>>=13),l&127||(f+=7,l>>>=7),l&15||(f+=4,l>>>=4),l&3||(f+=2,l>>>=2),l&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],l=this._countBits(o);return(this.length-1)*26+l};function O(b){for(var o=new Array(b.bitLength()),l=0;l>>g&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,l=0;lo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var l;this.length>o.length?l=o:l=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var l,f;this.length>o.length?(l=this,f=o):(l=o,f=this);for(var g=0;go.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var l=Math.ceil(o/26)|0,f=o%26;this._expand(l),f>0&&l--;for(var g=0;g0&&(this.words[g]=~this.words[g]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,l){n(typeof o=="number"&&o>=0);var f=o/26|0,g=o%26;return this._expand(f+1),l?this.words[f]=this.words[f]|1<o.length?(f=this,g=o):(f=o,g=this);for(var m=0,w=0;w>>26;for(;m!==0&&w>>26;if(this.length=f.length,m!==0)this.words[this.length]=m,this.length++;else if(f!==this)for(;wo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var l=this.iadd(o);return o.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,m;f>0?(g=this,m=o):(g=o,m=this);for(var w=0,_=0;_>26,this.words[_]=l&67108863;for(;w!==0&&_>26,this.words[_]=l&67108863;if(w===0&&_>>26,N=p&67108863,I=Math.min(a,o.length-1),$=Math.max(0,a-b.length+1);$<=I;$++){var ze=a-$|0;g=b.words[ze]|0,m=o.words[$]|0,w=g*m+N,v+=w/67108864|0,N=w&67108863}l.words[a]=N|0,p=v|0}return p!==0?l.words[a]=p|0:l.length--,l._strip()}var L=function(o,l,f){var g=o.words,m=l.words,w=f.words,_=0,p,a,v,N=g[0]|0,I=N&8191,$=N>>>13,ze=g[1]|0,G=ze&8191,Z=ze>>>13,ki=g[2]|0,te=ki&8191,re=ki>>>13,Ri=g[3]|0,ne=Ri&8191,se=Ri>>>13,Ii=g[4]|0,ie=Ii&8191,oe=Ii>>>13,Ci=g[5]|0,ae=Ci&8191,ce=Ci>>>13,Ai=g[6]|0,le=Ai&8191,ue=Ai>>>13,Ni=g[7]|0,de=Ni&8191,he=Ni>>>13,Li=g[8]|0,fe=Li&8191,ge=Li>>>13,xi=g[9]|0,pe=xi&8191,me=xi>>>13,Ti=m[0]|0,ve=Ti&8191,we=Ti>>>13,Pi=m[1]|0,ye=Pi&8191,be=Pi>>>13,$i=m[2]|0,_e=$i&8191,Ee=$i>>>13,Oi=m[3]|0,Se=Oi&8191,Me=Oi>>>13,Bi=m[4]|0,ke=Bi&8191,Re=Bi>>>13,Di=m[5]|0,Ie=Di&8191,Ce=Di>>>13,ji=m[6]|0,Ae=ji&8191,Ne=ji>>>13,Fi=m[7]|0,Le=Fi&8191,xe=Fi>>>13,Hi=m[8]|0,Te=Hi&8191,Pe=Hi>>>13,Ui=m[9]|0,$e=Ui&8191,Oe=Ui>>>13;f.negative=o.negative^l.negative,f.length=19,p=Math.imul(I,ve),a=Math.imul(I,we),a=a+Math.imul($,ve)|0,v=Math.imul($,we);var Xn=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,p=Math.imul(G,ve),a=Math.imul(G,we),a=a+Math.imul(Z,ve)|0,v=Math.imul(Z,we),p=p+Math.imul(I,ye)|0,a=a+Math.imul(I,be)|0,a=a+Math.imul($,ye)|0,v=v+Math.imul($,be)|0;var Yn=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,p=Math.imul(te,ve),a=Math.imul(te,we),a=a+Math.imul(re,ve)|0,v=Math.imul(re,we),p=p+Math.imul(G,ye)|0,a=a+Math.imul(G,be)|0,a=a+Math.imul(Z,ye)|0,v=v+Math.imul(Z,be)|0,p=p+Math.imul(I,_e)|0,a=a+Math.imul(I,Ee)|0,a=a+Math.imul($,_e)|0,v=v+Math.imul($,Ee)|0;var es=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(es>>>26)|0,es&=67108863,p=Math.imul(ne,ve),a=Math.imul(ne,we),a=a+Math.imul(se,ve)|0,v=Math.imul(se,we),p=p+Math.imul(te,ye)|0,a=a+Math.imul(te,be)|0,a=a+Math.imul(re,ye)|0,v=v+Math.imul(re,be)|0,p=p+Math.imul(G,_e)|0,a=a+Math.imul(G,Ee)|0,a=a+Math.imul(Z,_e)|0,v=v+Math.imul(Z,Ee)|0,p=p+Math.imul(I,Se)|0,a=a+Math.imul(I,Me)|0,a=a+Math.imul($,Se)|0,v=v+Math.imul($,Me)|0;var ts=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ts>>>26)|0,ts&=67108863,p=Math.imul(ie,ve),a=Math.imul(ie,we),a=a+Math.imul(oe,ve)|0,v=Math.imul(oe,we),p=p+Math.imul(ne,ye)|0,a=a+Math.imul(ne,be)|0,a=a+Math.imul(se,ye)|0,v=v+Math.imul(se,be)|0,p=p+Math.imul(te,_e)|0,a=a+Math.imul(te,Ee)|0,a=a+Math.imul(re,_e)|0,v=v+Math.imul(re,Ee)|0,p=p+Math.imul(G,Se)|0,a=a+Math.imul(G,Me)|0,a=a+Math.imul(Z,Se)|0,v=v+Math.imul(Z,Me)|0,p=p+Math.imul(I,ke)|0,a=a+Math.imul(I,Re)|0,a=a+Math.imul($,ke)|0,v=v+Math.imul($,Re)|0;var rs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(rs>>>26)|0,rs&=67108863,p=Math.imul(ae,ve),a=Math.imul(ae,we),a=a+Math.imul(ce,ve)|0,v=Math.imul(ce,we),p=p+Math.imul(ie,ye)|0,a=a+Math.imul(ie,be)|0,a=a+Math.imul(oe,ye)|0,v=v+Math.imul(oe,be)|0,p=p+Math.imul(ne,_e)|0,a=a+Math.imul(ne,Ee)|0,a=a+Math.imul(se,_e)|0,v=v+Math.imul(se,Ee)|0,p=p+Math.imul(te,Se)|0,a=a+Math.imul(te,Me)|0,a=a+Math.imul(re,Se)|0,v=v+Math.imul(re,Me)|0,p=p+Math.imul(G,ke)|0,a=a+Math.imul(G,Re)|0,a=a+Math.imul(Z,ke)|0,v=v+Math.imul(Z,Re)|0,p=p+Math.imul(I,Ie)|0,a=a+Math.imul(I,Ce)|0,a=a+Math.imul($,Ie)|0,v=v+Math.imul($,Ce)|0;var ns=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ns>>>26)|0,ns&=67108863,p=Math.imul(le,ve),a=Math.imul(le,we),a=a+Math.imul(ue,ve)|0,v=Math.imul(ue,we),p=p+Math.imul(ae,ye)|0,a=a+Math.imul(ae,be)|0,a=a+Math.imul(ce,ye)|0,v=v+Math.imul(ce,be)|0,p=p+Math.imul(ie,_e)|0,a=a+Math.imul(ie,Ee)|0,a=a+Math.imul(oe,_e)|0,v=v+Math.imul(oe,Ee)|0,p=p+Math.imul(ne,Se)|0,a=a+Math.imul(ne,Me)|0,a=a+Math.imul(se,Se)|0,v=v+Math.imul(se,Me)|0,p=p+Math.imul(te,ke)|0,a=a+Math.imul(te,Re)|0,a=a+Math.imul(re,ke)|0,v=v+Math.imul(re,Re)|0,p=p+Math.imul(G,Ie)|0,a=a+Math.imul(G,Ce)|0,a=a+Math.imul(Z,Ie)|0,v=v+Math.imul(Z,Ce)|0,p=p+Math.imul(I,Ae)|0,a=a+Math.imul(I,Ne)|0,a=a+Math.imul($,Ae)|0,v=v+Math.imul($,Ne)|0;var ss=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ss>>>26)|0,ss&=67108863,p=Math.imul(de,ve),a=Math.imul(de,we),a=a+Math.imul(he,ve)|0,v=Math.imul(he,we),p=p+Math.imul(le,ye)|0,a=a+Math.imul(le,be)|0,a=a+Math.imul(ue,ye)|0,v=v+Math.imul(ue,be)|0,p=p+Math.imul(ae,_e)|0,a=a+Math.imul(ae,Ee)|0,a=a+Math.imul(ce,_e)|0,v=v+Math.imul(ce,Ee)|0,p=p+Math.imul(ie,Se)|0,a=a+Math.imul(ie,Me)|0,a=a+Math.imul(oe,Se)|0,v=v+Math.imul(oe,Me)|0,p=p+Math.imul(ne,ke)|0,a=a+Math.imul(ne,Re)|0,a=a+Math.imul(se,ke)|0,v=v+Math.imul(se,Re)|0,p=p+Math.imul(te,Ie)|0,a=a+Math.imul(te,Ce)|0,a=a+Math.imul(re,Ie)|0,v=v+Math.imul(re,Ce)|0,p=p+Math.imul(G,Ae)|0,a=a+Math.imul(G,Ne)|0,a=a+Math.imul(Z,Ae)|0,v=v+Math.imul(Z,Ne)|0,p=p+Math.imul(I,Le)|0,a=a+Math.imul(I,xe)|0,a=a+Math.imul($,Le)|0,v=v+Math.imul($,xe)|0;var is=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(is>>>26)|0,is&=67108863,p=Math.imul(fe,ve),a=Math.imul(fe,we),a=a+Math.imul(ge,ve)|0,v=Math.imul(ge,we),p=p+Math.imul(de,ye)|0,a=a+Math.imul(de,be)|0,a=a+Math.imul(he,ye)|0,v=v+Math.imul(he,be)|0,p=p+Math.imul(le,_e)|0,a=a+Math.imul(le,Ee)|0,a=a+Math.imul(ue,_e)|0,v=v+Math.imul(ue,Ee)|0,p=p+Math.imul(ae,Se)|0,a=a+Math.imul(ae,Me)|0,a=a+Math.imul(ce,Se)|0,v=v+Math.imul(ce,Me)|0,p=p+Math.imul(ie,ke)|0,a=a+Math.imul(ie,Re)|0,a=a+Math.imul(oe,ke)|0,v=v+Math.imul(oe,Re)|0,p=p+Math.imul(ne,Ie)|0,a=a+Math.imul(ne,Ce)|0,a=a+Math.imul(se,Ie)|0,v=v+Math.imul(se,Ce)|0,p=p+Math.imul(te,Ae)|0,a=a+Math.imul(te,Ne)|0,a=a+Math.imul(re,Ae)|0,v=v+Math.imul(re,Ne)|0,p=p+Math.imul(G,Le)|0,a=a+Math.imul(G,xe)|0,a=a+Math.imul(Z,Le)|0,v=v+Math.imul(Z,xe)|0,p=p+Math.imul(I,Te)|0,a=a+Math.imul(I,Pe)|0,a=a+Math.imul($,Te)|0,v=v+Math.imul($,Pe)|0;var os=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(os>>>26)|0,os&=67108863,p=Math.imul(pe,ve),a=Math.imul(pe,we),a=a+Math.imul(me,ve)|0,v=Math.imul(me,we),p=p+Math.imul(fe,ye)|0,a=a+Math.imul(fe,be)|0,a=a+Math.imul(ge,ye)|0,v=v+Math.imul(ge,be)|0,p=p+Math.imul(de,_e)|0,a=a+Math.imul(de,Ee)|0,a=a+Math.imul(he,_e)|0,v=v+Math.imul(he,Ee)|0,p=p+Math.imul(le,Se)|0,a=a+Math.imul(le,Me)|0,a=a+Math.imul(ue,Se)|0,v=v+Math.imul(ue,Me)|0,p=p+Math.imul(ae,ke)|0,a=a+Math.imul(ae,Re)|0,a=a+Math.imul(ce,ke)|0,v=v+Math.imul(ce,Re)|0,p=p+Math.imul(ie,Ie)|0,a=a+Math.imul(ie,Ce)|0,a=a+Math.imul(oe,Ie)|0,v=v+Math.imul(oe,Ce)|0,p=p+Math.imul(ne,Ae)|0,a=a+Math.imul(ne,Ne)|0,a=a+Math.imul(se,Ae)|0,v=v+Math.imul(se,Ne)|0,p=p+Math.imul(te,Le)|0,a=a+Math.imul(te,xe)|0,a=a+Math.imul(re,Le)|0,v=v+Math.imul(re,xe)|0,p=p+Math.imul(G,Te)|0,a=a+Math.imul(G,Pe)|0,a=a+Math.imul(Z,Te)|0,v=v+Math.imul(Z,Pe)|0,p=p+Math.imul(I,$e)|0,a=a+Math.imul(I,Oe)|0,a=a+Math.imul($,$e)|0,v=v+Math.imul($,Oe)|0;var as=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(as>>>26)|0,as&=67108863,p=Math.imul(pe,ye),a=Math.imul(pe,be),a=a+Math.imul(me,ye)|0,v=Math.imul(me,be),p=p+Math.imul(fe,_e)|0,a=a+Math.imul(fe,Ee)|0,a=a+Math.imul(ge,_e)|0,v=v+Math.imul(ge,Ee)|0,p=p+Math.imul(de,Se)|0,a=a+Math.imul(de,Me)|0,a=a+Math.imul(he,Se)|0,v=v+Math.imul(he,Me)|0,p=p+Math.imul(le,ke)|0,a=a+Math.imul(le,Re)|0,a=a+Math.imul(ue,ke)|0,v=v+Math.imul(ue,Re)|0,p=p+Math.imul(ae,Ie)|0,a=a+Math.imul(ae,Ce)|0,a=a+Math.imul(ce,Ie)|0,v=v+Math.imul(ce,Ce)|0,p=p+Math.imul(ie,Ae)|0,a=a+Math.imul(ie,Ne)|0,a=a+Math.imul(oe,Ae)|0,v=v+Math.imul(oe,Ne)|0,p=p+Math.imul(ne,Le)|0,a=a+Math.imul(ne,xe)|0,a=a+Math.imul(se,Le)|0,v=v+Math.imul(se,xe)|0,p=p+Math.imul(te,Te)|0,a=a+Math.imul(te,Pe)|0,a=a+Math.imul(re,Te)|0,v=v+Math.imul(re,Pe)|0,p=p+Math.imul(G,$e)|0,a=a+Math.imul(G,Oe)|0,a=a+Math.imul(Z,$e)|0,v=v+Math.imul(Z,Oe)|0;var cs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(cs>>>26)|0,cs&=67108863,p=Math.imul(pe,_e),a=Math.imul(pe,Ee),a=a+Math.imul(me,_e)|0,v=Math.imul(me,Ee),p=p+Math.imul(fe,Se)|0,a=a+Math.imul(fe,Me)|0,a=a+Math.imul(ge,Se)|0,v=v+Math.imul(ge,Me)|0,p=p+Math.imul(de,ke)|0,a=a+Math.imul(de,Re)|0,a=a+Math.imul(he,ke)|0,v=v+Math.imul(he,Re)|0,p=p+Math.imul(le,Ie)|0,a=a+Math.imul(le,Ce)|0,a=a+Math.imul(ue,Ie)|0,v=v+Math.imul(ue,Ce)|0,p=p+Math.imul(ae,Ae)|0,a=a+Math.imul(ae,Ne)|0,a=a+Math.imul(ce,Ae)|0,v=v+Math.imul(ce,Ne)|0,p=p+Math.imul(ie,Le)|0,a=a+Math.imul(ie,xe)|0,a=a+Math.imul(oe,Le)|0,v=v+Math.imul(oe,xe)|0,p=p+Math.imul(ne,Te)|0,a=a+Math.imul(ne,Pe)|0,a=a+Math.imul(se,Te)|0,v=v+Math.imul(se,Pe)|0,p=p+Math.imul(te,$e)|0,a=a+Math.imul(te,Oe)|0,a=a+Math.imul(re,$e)|0,v=v+Math.imul(re,Oe)|0;var ls=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ls>>>26)|0,ls&=67108863,p=Math.imul(pe,Se),a=Math.imul(pe,Me),a=a+Math.imul(me,Se)|0,v=Math.imul(me,Me),p=p+Math.imul(fe,ke)|0,a=a+Math.imul(fe,Re)|0,a=a+Math.imul(ge,ke)|0,v=v+Math.imul(ge,Re)|0,p=p+Math.imul(de,Ie)|0,a=a+Math.imul(de,Ce)|0,a=a+Math.imul(he,Ie)|0,v=v+Math.imul(he,Ce)|0,p=p+Math.imul(le,Ae)|0,a=a+Math.imul(le,Ne)|0,a=a+Math.imul(ue,Ae)|0,v=v+Math.imul(ue,Ne)|0,p=p+Math.imul(ae,Le)|0,a=a+Math.imul(ae,xe)|0,a=a+Math.imul(ce,Le)|0,v=v+Math.imul(ce,xe)|0,p=p+Math.imul(ie,Te)|0,a=a+Math.imul(ie,Pe)|0,a=a+Math.imul(oe,Te)|0,v=v+Math.imul(oe,Pe)|0,p=p+Math.imul(ne,$e)|0,a=a+Math.imul(ne,Oe)|0,a=a+Math.imul(se,$e)|0,v=v+Math.imul(se,Oe)|0;var us=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(us>>>26)|0,us&=67108863,p=Math.imul(pe,ke),a=Math.imul(pe,Re),a=a+Math.imul(me,ke)|0,v=Math.imul(me,Re),p=p+Math.imul(fe,Ie)|0,a=a+Math.imul(fe,Ce)|0,a=a+Math.imul(ge,Ie)|0,v=v+Math.imul(ge,Ce)|0,p=p+Math.imul(de,Ae)|0,a=a+Math.imul(de,Ne)|0,a=a+Math.imul(he,Ae)|0,v=v+Math.imul(he,Ne)|0,p=p+Math.imul(le,Le)|0,a=a+Math.imul(le,xe)|0,a=a+Math.imul(ue,Le)|0,v=v+Math.imul(ue,xe)|0,p=p+Math.imul(ae,Te)|0,a=a+Math.imul(ae,Pe)|0,a=a+Math.imul(ce,Te)|0,v=v+Math.imul(ce,Pe)|0,p=p+Math.imul(ie,$e)|0,a=a+Math.imul(ie,Oe)|0,a=a+Math.imul(oe,$e)|0,v=v+Math.imul(oe,Oe)|0;var ds=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ds>>>26)|0,ds&=67108863,p=Math.imul(pe,Ie),a=Math.imul(pe,Ce),a=a+Math.imul(me,Ie)|0,v=Math.imul(me,Ce),p=p+Math.imul(fe,Ae)|0,a=a+Math.imul(fe,Ne)|0,a=a+Math.imul(ge,Ae)|0,v=v+Math.imul(ge,Ne)|0,p=p+Math.imul(de,Le)|0,a=a+Math.imul(de,xe)|0,a=a+Math.imul(he,Le)|0,v=v+Math.imul(he,xe)|0,p=p+Math.imul(le,Te)|0,a=a+Math.imul(le,Pe)|0,a=a+Math.imul(ue,Te)|0,v=v+Math.imul(ue,Pe)|0,p=p+Math.imul(ae,$e)|0,a=a+Math.imul(ae,Oe)|0,a=a+Math.imul(ce,$e)|0,v=v+Math.imul(ce,Oe)|0;var hs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(hs>>>26)|0,hs&=67108863,p=Math.imul(pe,Ae),a=Math.imul(pe,Ne),a=a+Math.imul(me,Ae)|0,v=Math.imul(me,Ne),p=p+Math.imul(fe,Le)|0,a=a+Math.imul(fe,xe)|0,a=a+Math.imul(ge,Le)|0,v=v+Math.imul(ge,xe)|0,p=p+Math.imul(de,Te)|0,a=a+Math.imul(de,Pe)|0,a=a+Math.imul(he,Te)|0,v=v+Math.imul(he,Pe)|0,p=p+Math.imul(le,$e)|0,a=a+Math.imul(le,Oe)|0,a=a+Math.imul(ue,$e)|0,v=v+Math.imul(ue,Oe)|0;var fs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(fs>>>26)|0,fs&=67108863,p=Math.imul(pe,Le),a=Math.imul(pe,xe),a=a+Math.imul(me,Le)|0,v=Math.imul(me,xe),p=p+Math.imul(fe,Te)|0,a=a+Math.imul(fe,Pe)|0,a=a+Math.imul(ge,Te)|0,v=v+Math.imul(ge,Pe)|0,p=p+Math.imul(de,$e)|0,a=a+Math.imul(de,Oe)|0,a=a+Math.imul(he,$e)|0,v=v+Math.imul(he,Oe)|0;var gs=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(gs>>>26)|0,gs&=67108863,p=Math.imul(pe,Te),a=Math.imul(pe,Pe),a=a+Math.imul(me,Te)|0,v=Math.imul(me,Pe),p=p+Math.imul(fe,$e)|0,a=a+Math.imul(fe,Oe)|0,a=a+Math.imul(ge,$e)|0,v=v+Math.imul(ge,Oe)|0;var ps=(_+p|0)+((a&8191)<<13)|0;_=(v+(a>>>13)|0)+(ps>>>26)|0,ps&=67108863,p=Math.imul(pe,$e),a=Math.imul(pe,Oe),a=a+Math.imul(me,$e)|0,v=Math.imul(me,Oe);var ms=(_+p|0)+((a&8191)<<13)|0;return _=(v+(a>>>13)|0)+(ms>>>26)|0,ms&=67108863,w[0]=Xn,w[1]=Yn,w[2]=es,w[3]=ts,w[4]=rs,w[5]=ns,w[6]=ss,w[7]=is,w[8]=os,w[9]=as,w[10]=cs,w[11]=ls,w[12]=us,w[13]=ds,w[14]=hs,w[15]=fs,w[16]=gs,w[17]=ps,w[18]=ms,_!==0&&(w[19]=_,f.length++),f};Math.imul||(L=B);function R(b,o,l){l.negative=o.negative^b.negative,l.length=b.length+o.length;for(var f=0,g=0,m=0;m>>26)|0,g+=w>>>26,w&=67108863}l.words[m]=_,f=w,w=g}return f!==0?l.words[m]=f:l.length--,l._strip()}function z(b,o,l){return R(b,o,l)}s.prototype.mulTo=function(o,l){var f,g=this.length+o.length;return this.length===10&&o.length===10?f=L(this,o,l):g<63?f=B(this,o,l):g<1024?f=R(this,o,l):f=z(this,o,l),f},s.prototype.mul=function(o){var l=new s(null);return l.words=new Array(this.length+o.length),this.mulTo(o,l)},s.prototype.mulf=function(o){var l=new s(null);return l.words=new Array(this.length+o.length),z(this,o,l)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var l=o<0;l&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,g=0;g>=26,f+=m/67108864|0,f+=w>>>26,this.words[g]=w&67108863}return f!==0&&(this.words[g]=f,this.length++),l?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var l=O(o);if(l.length===0)return new s(1);for(var f=this,g=0;g=0);var l=o%26,f=(o-l)/26,g=67108863>>>26-l<<26-l,m;if(l!==0){var w=0;for(m=0;m>>26-l}w&&(this.words[m]=w,this.length++)}if(f!==0){for(m=this.length-1;m>=0;m--)this.words[m+f]=this.words[m];for(m=0;m=0);var g;l?g=(l-l%26)/26:g=0;var m=o%26,w=Math.min((o-m)/26,this.length),_=67108863^67108863>>>m<w)for(this.length-=w,a=0;a=0&&(v!==0||a>=g);a--){var N=this.words[a]|0;this.words[a]=v<<26-m|N>>>m,v=N&_}return p&&v!==0&&(p.words[p.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,l,f){return n(this.negative===0),this.iushrn(o,l,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var l=o%26,f=(o-l)/26,g=1<=0);var l=o%26,f=(o-l)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(l!==0&&f++,this.length=Math.min(f,this.length),l!==0){var g=67108863^67108863>>>l<=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l>26)-(p/67108864|0),this.words[m+f]=w&67108863}for(;m>26,this.words[m+f]=w&67108863;if(_===0)return this._strip();for(n(_===-1),_=0,m=0;m>26,this.words[m]=w&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,l){var f=this.length-o.length,g=this.clone(),m=o,w=m.words[m.length-1]|0,_=this._countBits(w);f=26-_,f!==0&&(m=m.ushln(f),g.iushln(f),w=m.words[m.length-1]|0);var p=g.length-m.length,a;if(l!=="mod"){a=new s(null),a.length=p+1,a.words=new Array(a.length);for(var v=0;v=0;I--){var $=(g.words[m.length+I]|0)*67108864+(g.words[m.length+I-1]|0);for($=Math.min($/w|0,67108863),g._ishlnsubmul(m,$,I);g.negative!==0;)$--,g.negative=0,g._ishlnsubmul(m,1,I),g.isZero()||(g.negative^=1);a&&(a.words[I]=$)}return a&&a._strip(),g._strip(),l!=="div"&&f!==0&&g.iushrn(f),{div:a||null,mod:g}},s.prototype.divmod=function(o,l,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,m,w;return this.negative!==0&&o.negative===0?(w=this.neg().divmod(o,l),l!=="mod"&&(g=w.div.neg()),l!=="div"&&(m=w.mod.neg(),f&&m.negative!==0&&m.iadd(o)),{div:g,mod:m}):this.negative===0&&o.negative!==0?(w=this.divmod(o.neg(),l),l!=="mod"&&(g=w.div.neg()),{div:g,mod:w.mod}):this.negative&o.negative?(w=this.neg().divmod(o.neg(),l),l!=="div"&&(m=w.mod.neg(),f&&m.negative!==0&&m.isub(o)),{div:w.div,mod:m}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?l==="div"?{div:this.divn(o.words[0]),mod:null}:l==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,l)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var l=this.divmod(o);if(l.mod.isZero())return l.div;var f=l.div.negative!==0?l.mod.isub(o):l.mod,g=o.ushrn(1),m=o.andln(1),w=f.cmp(g);return w<0||m===1&&w===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},s.prototype.modrn=function(o){var l=o<0;l&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,g=0,m=this.length-1;m>=0;m--)g=(f*g+(this.words[m]|0))%o;return l?-g:g},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var l=o<0;l&&(o=-o),n(o<=67108863);for(var f=0,g=this.length-1;g>=0;g--){var m=(this.words[g]|0)+f*67108864;this.words[g]=m/o|0,f=m%o}return this._strip(),l?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var l=this,f=o.clone();l.negative!==0?l=l.umod(o):l=l.clone();for(var g=new s(1),m=new s(0),w=new s(0),_=new s(1),p=0;l.isEven()&&f.isEven();)l.iushrn(1),f.iushrn(1),++p;for(var a=f.clone(),v=l.clone();!l.isZero();){for(var N=0,I=1;!(l.words[0]&I)&&N<26;++N,I<<=1);if(N>0)for(l.iushrn(N);N-- >0;)(g.isOdd()||m.isOdd())&&(g.iadd(a),m.isub(v)),g.iushrn(1),m.iushrn(1);for(var $=0,ze=1;!(f.words[0]&ze)&&$<26;++$,ze<<=1);if($>0)for(f.iushrn($);$-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(a),_.isub(v)),w.iushrn(1),_.iushrn(1);l.cmp(f)>=0?(l.isub(f),g.isub(w),m.isub(_)):(f.isub(l),w.isub(g),_.isub(m))}return{a:w,b:_,gcd:f.iushln(p)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var l=this,f=o.clone();l.negative!==0?l=l.umod(o):l=l.clone();for(var g=new s(1),m=new s(0),w=f.clone();l.cmpn(1)>0&&f.cmpn(1)>0;){for(var _=0,p=1;!(l.words[0]&p)&&_<26;++_,p<<=1);if(_>0)for(l.iushrn(_);_-- >0;)g.isOdd()&&g.iadd(w),g.iushrn(1);for(var a=0,v=1;!(f.words[0]&v)&&a<26;++a,v<<=1);if(a>0)for(f.iushrn(a);a-- >0;)m.isOdd()&&m.iadd(w),m.iushrn(1);l.cmp(f)>=0?(l.isub(f),g.isub(m)):(f.isub(l),m.isub(g))}var N;return l.cmpn(1)===0?N=g:N=m,N.cmpn(0)<0&&N.iadd(o),N},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var l=this.clone(),f=o.clone();l.negative=0,f.negative=0;for(var g=0;l.isEven()&&f.isEven();g++)l.iushrn(1),f.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;f.isEven();)f.iushrn(1);var m=l.cmp(f);if(m<0){var w=l;l=f,f=w}else if(m===0||f.cmpn(1)===0)break;l.isub(f)}while(!0);return f.iushln(g)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var l=o%26,f=(o-l)/26,g=1<>>26,_&=67108863,this.words[w]=_}return m!==0&&(this.words[w]=m,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var l=o<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var f;if(this.length>1)f=1;else{l&&(o=-o),n(o<=67108863,"Number is too big");var g=this.words[0]|0;f=g===o?0:go.length)return 1;if(this.length=0;f--){var g=this.words[f]|0,m=o.words[f]|0;if(g!==m){gm&&(l=1);break}}return l},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new H(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function P(b,o){this.name=b,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}P.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},P.prototype.ireduce=function(o){var l=o,f;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),f=l.bitLength();while(f>this.n);var g=f0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},P.prototype.split=function(o,l){o.iushrn(this.n,0,l)},P.prototype.imulK=function(o){return o.imul(this.k)};function J(){P.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(J,P),J.prototype.split=function(o,l){for(var f=4194303,g=Math.min(o.length,9),m=0;m>>22,w=_}w>>>=22,o.words[m-10]=w,w===0&&o.length>10?o.length-=10:o.length-=9},J.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var l=0,f=0;f>>=26,o.words[f]=m,l=g}return l!==0&&(o.words[o.length++]=l),o},s._prime=function(o){if(C[o])return C[o];var l;if(o==="k256")l=new J;else if(o==="p224")l=new We;else if(o==="p192")l=new Qe;else if(o==="p25519")l=new Y;else throw new Error("Unknown prime "+o);return C[o]=l,l};function H(b){if(typeof b=="string"){var o=s._prime(b);this.m=o.p,this.prime=o}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}H.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},H.prototype._verify2=function(o,l){n((o.negative|l.negative)===0,"red works only with positives"),n(o.red&&o.red===l.red,"red works only with red numbers")},H.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(y(o,o.umod(this.m)._forceRed(this)),o)},H.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},H.prototype.add=function(o,l){this._verify2(o,l);var f=o.add(l);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},H.prototype.iadd=function(o,l){this._verify2(o,l);var f=o.iadd(l);return f.cmp(this.m)>=0&&f.isub(this.m),f},H.prototype.sub=function(o,l){this._verify2(o,l);var f=o.sub(l);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},H.prototype.isub=function(o,l){this._verify2(o,l);var f=o.isub(l);return f.cmpn(0)<0&&f.iadd(this.m),f},H.prototype.shl=function(o,l){return this._verify1(o),this.imod(o.ushln(l))},H.prototype.imul=function(o,l){return this._verify2(o,l),this.imod(o.imul(l))},H.prototype.mul=function(o,l){return this._verify2(o,l),this.imod(o.mul(l))},H.prototype.isqr=function(o){return this.imul(o,o.clone())},H.prototype.sqr=function(o){return this.mul(o,o)},H.prototype.sqrt=function(o){if(o.isZero())return o.clone();var l=this.m.andln(3);if(n(l%2===1),l===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var g=this.m.subn(1),m=0;!g.isZero()&&g.andln(1)===0;)m++,g.iushrn(1);n(!g.isZero());var w=new s(1).toRed(this),_=w.redNeg(),p=this.m.subn(1).iushrn(1),a=this.m.bitLength();for(a=new s(2*a*a).toRed(this);this.pow(a,p).cmp(_)!==0;)a.redIAdd(_);for(var v=this.pow(a,g),N=this.pow(o,g.addn(1).iushrn(1)),I=this.pow(o,g),$=m;I.cmp(w)!==0;){for(var ze=I,G=0;ze.cmp(w)!==0;G++)ze=ze.redSqr();n(G<$);var Z=this.pow(v,new s(1).iushln($-G-1));N=N.redMul(Z),v=Z.redSqr(),I=I.redMul(v),$=G}return N},H.prototype.invm=function(o){var l=o._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},H.prototype.pow=function(o,l){if(l.isZero())return new s(1).toRed(this);if(l.cmpn(1)===0)return o.clone();var f=4,g=new Array(1<=0;m--){for(var v=l.words[m],N=a-1;N>=0;N--){var I=v>>N&1;if(w!==g[0]&&(w=this.sqr(w)),I===0&&_===0){p=0;continue}_<<=1,_|=I,p++,!(p!==f&&(m!==0||N!==0))&&(w=this.mul(w,g[_]),p=0,_=0)}a=26}return w},H.prototype.convertTo=function(o){var l=o.umod(this.m);return l===o?l.clone():l},H.prototype.convertFrom=function(o){var l=o.clone();return l.red=null,l},s.mont=function(o){return new q(o)};function q(b){H.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(q,H),q.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},q.prototype.convertFrom=function(o){var l=this.imod(o.mul(this.rinv));return l.red=null,l},q.prototype.imul=function(o,l){if(o.isZero()||l.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(l),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=f.isub(g).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},q.prototype.mul=function(o,l){if(o.isZero()||l.isZero())return new s(0)._forceRed(this);var f=o.mul(l),g=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=f.isub(g).iushrn(this.shift),w=m;return m.cmp(this.m)>=0?w=m.isub(this.m):m.cmpn(0)<0&&(w=m.iadd(this.m)),w._forceRed(this)},q.prototype.invm=function(o){var l=this.imod(o._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(t,x)})(Us);var un=Us.exports,Sr={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.errorValues=St.standardErrorCodes=void 0;St.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};St.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var dn={},hn={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=St,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(E,M=r){if(E&&Number.isInteger(E)){const k=E.toString();if(y(e.errorValues,k))return e.errorValues[k].message;if(d(E))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return M}t.getMessageFromCode=n;function i(E){if(!Number.isInteger(E))return!1;const M=E.toString();return!!(e.errorValues[M]||d(E))}t.isValidCode=i;function s(E){var M;if(typeof E=="number")return E;if(c(E))return(M=E.code)!==null&&M!==void 0?M:E.errorCode}t.getErrorCode=s;function c(E){return typeof E=="object"&&E!==null&&(typeof E.code=="number"||typeof E.errorCode=="number")}function u(E,{shouldIncludeStack:M=!1}={}){const k={};if(E&&typeof E=="object"&&!Array.isArray(E)&&y(E,"code")&&i(E.code)){const T=E;k.code=T.code,T.message&&typeof T.message=="string"?(k.message=T.message,y(T,"data")&&(k.data=T.data)):(k.message=n(k.code),k.data={originalError:h(E)})}else k.code=e.standardErrorCodes.rpc.internal,k.message=S(E,"message")?E.message:r,k.data={originalError:h(E)};return M&&(k.stack=S(E,"stack")?E.stack:void 0),k}t.serialize=u;function d(E){return E>=-32099&&E<=-32e3}function h(E){return E&&typeof E=="object"&&!Array.isArray(E)?Object.assign({},E):E}function y(E,M){return Object.prototype.hasOwnProperty.call(E,M)}function S(E,M){return typeof E=="object"&&E!==null&&M in E&&typeof E[M]=="string"}})(hn);Object.defineProperty(dn,"__esModule",{value:!0});dn.standardErrors=void 0;const He=St,na=hn;dn.standardErrors={rpc:{parse:t=>rt(He.standardErrorCodes.rpc.parse,t),invalidRequest:t=>rt(He.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>rt(He.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>rt(He.standardErrorCodes.rpc.methodNotFound,t),internal:t=>rt(He.standardErrorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return rt(e,t)},invalidInput:t=>rt(He.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>rt(He.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>rt(He.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>rt(He.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>rt(He.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>rt(He.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Wt(He.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>Wt(He.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>Wt(He.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>Wt(He.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>Wt(He.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>Wt(He.standardErrorCodes.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new oa(e,r,n)}}};function rt(t,e){const[r,n]=sa(e);return new ia(t,r||(0,na.getMessageFromCode)(t),n)}function Wt(t,e){const[r,n]=sa(e);return new oa(t,r||(0,na.getMessageFromCode)(t),n)}function sa(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}let ia=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},oa=class extends ia{constructor(e,r,n){if(!Fc(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function Fc(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var fn={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});cr.isErrorResponse=void 0;function Hc(t){return t.errorMessage!==void 0}cr.isErrorResponse=Hc;var lr={};Object.defineProperty(lr,"__esModule",{value:!0});lr.LIB_VERSION=void 0;lr.LIB_VERSION="3.9.3";Object.defineProperty(fn,"__esModule",{value:!0});fn.serializeError=void 0;const Uc=cr,Vc=lr,Wc=St,zc=hn;function qc(t,e){const r=(0,zc.serialize)(Jc(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",Vc.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=Gc(r.data,e);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}fn.serializeError=qc;function Jc(t){return typeof t=="string"?{message:t,code:Wc.standardErrorCodes.rpc.internal}:(0,Uc.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function Gc(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=St;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=dn;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=fn;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=hn;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(Sr);var De={};Object.defineProperty(De,"__esModule",{value:!0});De.ProviderType=De.RegExpString=De.IntNumber=De.BigIntString=De.AddressString=De.HexString=De.OpaqueType=void 0;function Mr(){return t=>t}De.OpaqueType=Mr;De.HexString=Mr();De.AddressString=Mr();De.BigIntString=Mr();function Zc(t){return Math.floor(t)}De.IntNumber=Zc;De.RegExpString=Mr();var Vi;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(Vi||(De.ProviderType=Vi={}));var Qc=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(A,"__esModule",{value:!0});A.isMobileWeb=A.getLocation=A.isInIFrame=A.createQrUrl=A.getFavicon=A.range=A.isBigNumber=A.ensureParsedJSONObject=A.ensureBN=A.ensureRegExpString=A.ensureIntNumber=A.ensureBuffer=A.ensureAddressString=A.ensureEvenLengthHexString=A.ensureHexString=A.isHexString=A.prepend0x=A.strip0x=A.has0xPrefix=A.hexStringFromIntNumber=A.intNumberFromHexString=A.bigIntStringFromBN=A.hexStringFromBuffer=A.hexStringToUint8Array=A.uint8ArrayToHex=A.randomBytesHex=void 0;const Rt=Qc(un),Ht=Sr,ot=De,aa=/^[0-9]*$/,ca=/^[a-f0-9]*$/;function Kc(t){return la(crypto.getRandomValues(new Uint8Array(t)))}A.randomBytesHex=Kc;function la(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}A.uint8ArrayToHex=la;function Xc(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}A.hexStringToUint8Array=Xc;function Yc(t,e=!1){const r=t.toString("hex");return(0,ot.HexString)(e?`0x${r}`:r)}A.hexStringFromBuffer=Yc;function el(t){return(0,ot.BigIntString)(t.toString(10))}A.bigIntStringFromBN=el;function tl(t){return(0,ot.IntNumber)(new Rt.default(Rr(t,!1),16).toNumber())}A.intNumberFromHexString=tl;function rl(t){return(0,ot.HexString)(`0x${new Rt.default(t).toString(16)}`)}A.hexStringFromIntNumber=rl;function Vs(t){return t.startsWith("0x")||t.startsWith("0X")}A.has0xPrefix=Vs;function gn(t){return Vs(t)?t.slice(2):t}A.strip0x=gn;function ua(t){return Vs(t)?`0x${t.slice(2)}`:`0x${t}`}A.prepend0x=ua;function kr(t){if(typeof t!="string")return!1;const e=gn(t).toLowerCase();return ca.test(e)}A.isHexString=kr;function da(t,e=!1){if(typeof t=="string"){const r=gn(t).toLowerCase();if(ca.test(r))return(0,ot.HexString)(e?`0x${r}`:r)}throw Ht.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}A.ensureHexString=da;function Rr(t,e=!1){let r=da(t,!1);return r.length%2===1&&(r=(0,ot.HexString)(`0${r}`)),e?(0,ot.HexString)(`0x${r}`):r}A.ensureEvenLengthHexString=Rr;function nl(t){if(typeof t=="string"){const e=gn(t).toLowerCase();if(kr(e)&&e.length===40)return(0,ot.AddressString)(ua(e))}throw Ht.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}A.ensureAddressString=nl;function sl(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(kr(t)){const e=Rr(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw Ht.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}A.ensureBuffer=sl;function ha(t){if(typeof t=="number"&&Number.isInteger(t))return(0,ot.IntNumber)(t);if(typeof t=="string"){if(aa.test(t))return(0,ot.IntNumber)(Number(t));if(kr(t))return(0,ot.IntNumber)(new Rt.default(Rr(t,!1),16).toNumber())}throw Ht.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}A.ensureIntNumber=ha;function il(t){if(t instanceof RegExp)return(0,ot.RegExpString)(t.toString());throw Ht.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}A.ensureRegExpString=il;function ol(t){if(t!==null&&(Rt.default.isBN(t)||fa(t)))return new Rt.default(t.toString(10),10);if(typeof t=="number")return new Rt.default(ha(t));if(typeof t=="string"){if(aa.test(t))return new Rt.default(t,10);if(kr(t))return new Rt.default(Rr(t,!1),16)}throw Ht.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}A.ensureBN=ol;function al(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw Ht.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}A.ensureParsedJSONObject=al;function fa(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}A.isBigNumber=fa;function cl(t,e){return Array.from({length:e-t},(r,n)=>t+n)}A.range=cl;function ll(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}A.getFavicon=ll;function ul(t,e,r,n,i,s){const c=n?"parent-id":"id",u=new URLSearchParams({[c]:t,secret:e,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${u}`}A.createQrUrl=ul;function ga(){try{return window.frameElement!==null}catch{return!1}}A.isInIFrame=ga;function dl(){try{return ga()&&window.top?window.top.location:window.location}catch{return window.location}}A.getLocation=dl;function hl(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}A.isMobileWeb=hl;var pn={};Object.defineProperty(pn,"__esModule",{value:!0});pn.ScopedLocalStorage=void 0;class fl{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}pn.ScopedLocalStorage=fl;var rr={},Ir={},Cr={},ur={};Object.defineProperty(ur,"__esModule",{value:!0});ur.EVENTS=void 0;ur.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var it={};Object.defineProperty(it,"__esModule",{value:!0});it.RelayAbstract=it.APP_VERSION_KEY=it.LOCAL_STORAGE_ADDRESSES_KEY=it.WALLET_USER_NAME_KEY=void 0;const Wi=Sr;it.WALLET_USER_NAME_KEY="walletUsername";it.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";it.APP_VERSION_KEY="AppVersion";class gl{async makeEthereumJSONRPCRequest(e,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(e),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw Wi.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,Wi.serializeError)(s,e.method);return i})}}it.RelayAbstract=gl;var dr={};Object.defineProperty(dr,"__esModule",{value:!0});dr.Session=void 0;const zi=Oc,qi=A,Ji="session:id",Gi="session:secret",Zi="session:linked";class Ws{constructor(e,r,n,i){this._storage=e,this._id=r||(0,qi.randomBytesHex)(16),this._secret=n||(0,qi.randomBytesHex)(32),this._key=new zi.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(e){const r=e.getItem(Ji),n=e.getItem(Zi),i=e.getItem(Gi);return r&&i?new Ws(e,r,i,n==="1"):null}static hash(e){return new zi.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(Ji,this._id),this._storage.setItem(Gi,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Zi,this._linked?"1":"0")}}dr.Session=Ws;var mn={},vn={};Object.defineProperty(vn,"__esModule",{value:!0});vn.Cipher=void 0;const Wr=A;class pl{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,Wr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,c=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(e)),u=16,d=c.slice(c.byteLength-u),h=c.slice(0,c.byteLength-u),y=new Uint8Array(d),S=new Uint8Array(h),E=new Uint8Array([...n,...y,...S]);return(0,Wr.uint8ArrayToHex)(E)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,Wr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),c=(0,Wr.hexStringToUint8Array)(e),u=c.slice(0,12),d=c.slice(12,28),h=c.slice(28),y=new Uint8Array([...h,...d]),S={name:"AES-GCM",iv:new Uint8Array(u)};try{const E=await window.crypto.subtle.decrypt(S,s,y),M=new TextDecoder;n(M.decode(E))}catch(E){i(E)}})()})}}vn.Cipher=pl;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});wn.WalletLinkHTTP=void 0;class ml{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(e=n==null?void 0:n.filter(c=>c.event==="Web3Response").map(c=>({type:"Event",sessionId:this.sessionId,eventId:c.id,event:c.event,data:c.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wn.WalletLinkHTTP=ml;var nr={};Object.defineProperty(nr,"__esModule",{value:!0});nr.WalletLinkWebSocket=nr.ConnectionState=void 0;var Kt;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(Kt||(nr.ConnectionState=Kt={}));class vl{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Kt.CONNECTING),i.onclose=s=>{var c;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(c=this.connectionStateListener)===null||c===void 0||c.call(this,Kt.DISCONNECTED)},i.onopen=s=>{var c;e(),(c=this.connectionStateListener)===null||c===void 0||c.call(this,Kt.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var c,u;if(s.data==="h")(c=this.incomingDataListener)===null||c===void 0||c.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(u=this.incomingDataListener)===null||u===void 0||u.call(this,d)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,Kt.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}nr.WalletLinkWebSocket=vl;Object.defineProperty(mn,"__esModule",{value:!0});mn.WalletLinkConnection=void 0;const zt=De,wl=vn,ht=ur,Qi=it,qt=dr,yl=wn,zr=nr,Ki=1e4,bl=6e4;class _l{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,zt.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=u=>{if(!u)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>u.JsonRpcUrl&&this.handleChainUpdated(h,u.JsonRpcUrl)]]).forEach((h,y)=>{const S=u[y];S!==void 0&&h(S)})},this.handleDestroyed=u=>{var d,h;u==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:qt.Session.hash(this.session.id)}))},this.handleAccountUpdated=async u=>{var d,h;try{const y=await this.cipher.decrypt(u);(d=this.listener)===null||d===void 0||d.accountUpdated(y)}catch{(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(u,d)=>{var h,y;try{const S=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(u,S)}catch{(y=this.diagnostic)===null||y===void 0||y.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:u})}},this.handleWalletUsernameUpdated=async u=>{this.handleMetadataUpdated(Qi.WALLET_USER_NAME_KEY,u)},this.handleAppVersionUpdated=async u=>{this.handleMetadataUpdated(Qi.APP_VERSION_KEY,u)},this.handleChainUpdated=async(u,d)=>{var h,y;try{const S=await this.cipher.decrypt(u),E=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(S,E)}catch{(y=this.diagnostic)===null||y===void 0||y.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new wl.Cipher(e.secret),this.diagnostic=i,this.listener=n;const c=new zr.WalletLinkWebSocket(`${r}/rpc`,s);c.setConnectionStateListener(async u=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(ht.EVENTS.CONNECTED_STATE_CHANGE,{state:u,sessionIdHash:qt.Session.hash(e.id)});let h=!1;switch(u){case zr.ConnectionState.DISCONNECTED:if(!this.destroyed){const y=async()=>{await new Promise(S=>setTimeout(S,5e3)),this.destroyed||c.connect().catch(()=>{y()})};y()}break;case zr.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ki),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case zr.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),c.setIncomingDataListener(u=>{var d,h,y;switch(u.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const S=u.type==="IsLinkedOK"?u.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(ht.EVENTS.LINKED,{sessionIdHash:qt.Session.hash(e.id),linked:S,type:u.type,onlineGuests:u.onlineGuests}),this.linked=S||u.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(ht.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:qt.Session.hash(e.id),metadata_keys:u&&u.metadata?Object.keys(u.metadata):void 0}),this.handleSessionMetadataUpdated(u.metadata);break}case"Event":{this.handleIncomingEvent(u);break}}u.id!==void 0&&((y=this.requestResolutions.get(u.id))===null||y===void 0||y(u))}),this.ws=c,this.http=new yl.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(ht.EVENTS.STARTED_CONNECTING,{sessionIdHash:qt.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(ht.EVENTS.DISCONNECTED,{sessionIdHash:qt.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const i=await this.cipher.decrypt(e.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(ht.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const c=await this.makeRequest(s);if(c.type==="Fail")throw new Error(c.error||"failed to publish event");return c.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ki*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=bl){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((s,c)=>{i=window.setTimeout(()=>{c(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,c=>{clearTimeout(i),s(c),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,zt.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}mn.WalletLinkConnection=_l;var Ar={},Nr={},zs={};Object.defineProperty(zs,"__esModule",{value:!0});zs.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 El=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nr,"__esModule",{value:!0});Nr.injectCssReset=void 0;const Sl=El(zs);function Ml(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Sl.default)),document.documentElement.appendChild(t)}Nr.injectCssReset=Ml;var yn={},bn={};function pa(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}ma.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=wt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=K.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=K.getBCHTypeInfo(r),i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!t&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,i=7,s=0,c=this.moduleCount-1;c>0;c-=2)for(c==6&&c--;;){for(var u=0;u<2;u++)if(this.modules[n][c-u]==null){var d=!1;s>>i&1)==1);var h=K.getMask(e,n,c-u);h&&(d=!d),this.modules[n][c-u]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};wt.PAD0=236;wt.PAD1=17;wt.createData=function(t,e,r){for(var n=vt.getRSBlocks(t,e),i=new va,s=0;su*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+u*8+")");for(i.getLengthInBits()+4<=u*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=u*8||(i.put(wt.PAD0,8),i.getLengthInBits()>=u*8));)i.put(wt.PAD1,8);return wt.createBytes(i,n)};wt.createBytes=function(t,e){for(var r=0,n=0,i=0,s=new Array(e.length),c=new Array(e.length),u=0;u=0?M.get(k):0}}for(var T=0,y=0;y=0;)e^=K.G15<=0;)e^=K.G18<>>=1;return e},getPatternPosition:function(t){return K.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case Mt.PATTERN000:return(e+r)%2==0;case Mt.PATTERN001:return e%2==0;case Mt.PATTERN010:return r%3==0;case Mt.PATTERN011:return(e+r)%3==0;case Mt.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Mt.PATTERN101:return e*r%2+e*r%3==0;case Mt.PATTERN110:return(e*r%2+e*r%3)%2==0;case Mt.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new Xt([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)t-=255;return Fe.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ue=0;Ue<8;Ue++)Fe.EXP_TABLE[Ue]=1<>>7-t%8&1)==1},put:function(t,e){for(var r=0;r>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var vs=[[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 wa(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return It.L;case"M":return It.M;case"Q":return It.Q;case"H":return It.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var y=i(d),S=1,E=0,M=0,k=vs.length;M<=k;M++){var T=vs[M];if(!T)throw new Error("Content too long: expected "+E+" but got "+y);switch(h){case"L":E=T[0];break;case"M":E=T[1];break;case"Q":E=T[2];break;case"H":E=T[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(y<=E)break;S++}if(S>vs.length)throw new Error("Content too long");return S}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,c=n(s,this.options.ecl),u=r(this.options.ecl);this.qrcode=new wt(c,u),this.qrcode.addData(s),this.qrcode.make()}wa.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,i=n?" ":"",s=n?`\r `:"",c=e.width,u=e.height,d=r.length,h=c/(d+2*e.padding),y=u/(d+2*e.padding),S=typeof e.join<"u"?!!e.join:!1,E=typeof e.swap<"u"?!!e.swap:!1,M=typeof e.xmlDeclaration<"u"?!!e.xmlDeclaration:!0,k=typeof e.predefined<"u"?!!e.predefined:!1,T=k?i+''+s:"",O=i+''+s,B="",L="",R=0;R'+s:B+=i+''+s}}S&&(B=i+'');let H="";if(this.options.image!==void 0&&this.options.image.svg){const b=c*this.options.image.width/100,o=u*this.options.image.height/100,l=c/2-b/2,f=u/2-o/2;H+=``,H+=this.options.image.svg+s,H+=""}var q="";switch(t.container){case"svg":M&&(q+=''+s),q+=''+s,q+=T+O+B,q+=H,q+="";break;case"svg-viewbox":M&&(q+=''+s),q+=''+s,q+=T+O+B,q+=H,q+="";break;case"g":q+=''+s,q+=T+O+B,q+=H,q+="";break;default:q+=(T+O+B+H).replace(/^\s+/,"");break}return q};var Al=wa,Nl=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.QRCode=void 0;const Ll=Ke,eo=an,xl=Nl(Al),Tl=t=>{const[e,r]=(0,eo.useState)("");return(0,eo.useEffect)(()=>{var n,i;const s=new xl.default({content:t.content,background:t.bgColor||"#ffffff",color:t.fgColor||"#000000",container:"svg",ecl:"M",width:(n=t.width)!==null&&n!==void 0?n:256,height:(i=t.height)!==null&&i!==void 0?i:256,padding:0,image:t.image}),c=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${c}`)},[t.bgColor,t.content,t.fgColor,t.height,t.image,t.width]),e?(0,Ll.h)("img",{src:e,alt:"QR Code"}):null};Mn.QRCode=Tl;var kn={},qs={};Object.defineProperty(qs,"__esModule",{value:!0});qs.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 Pl=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kn,"__esModule",{value:!0});kn.Spinner=void 0;const Jr=Ke,$l=Pl(qs),Ol=t=>{var e;const r=(e=t.size)!==null&&e!==void 0?e:64,n=t.color||"#000";return(0,Jr.h)("div",{class:"-cbwsdk-spinner"},(0,Jr.h)("style",null,$l.default),(0,Jr.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Jr.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};kn.Spinner=Ol;var Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.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 ya=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(sr,"__esModule",{value:!0});sr.CoinbaseWalletSteps=sr.ConnectContent=void 0;const Dt=ya(Lr),V=Ke,Bl=A,Dl=lr,jl=_n,Fl=En,Hl=Sn,Ul=Mn,Vl=kn,Wl=ya(Js),ws={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:ba},zl=t=>t==="light"?"#FFFFFF":"#0A0B0D";function ql(t){const{theme:e}=t,r=(0,Bl.createQrUrl)(t.sessionId,t.sessionSecret,t.linkAPIUrl,t.isParentConnection,t.version,t.chainId),n=ws.steps;return(0,V.h)("div",{"data-testid":"connect-content",className:(0,Dt.default)("-cbwsdk-connect-content",e)},(0,V.h)("style",null,Wl.default),(0,V.h)("div",{className:"-cbwsdk-connect-content-header"},(0,V.h)("h2",{className:(0,Dt.default)("-cbwsdk-connect-content-heading",e)},"Scan to connect with our mobile app"),t.onCancel&&(0,V.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:t.onCancel},(0,V.h)(jl.CloseIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,V.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,V.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,V.h)(Jl,{title:ws.title,description:ws.description,theme:e})),(0,V.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,V.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,V.h)(Ul.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,V.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:Dl.LIB_VERSION}),(0,V.h)("input",{type:"hidden",value:r})),(0,V.h)(n,{theme:e}),!t.isConnected&&(0,V.h)("div",{"data-testid":"connecting-spinner",className:(0,Dt.default)("-cbwsdk-connect-content-qr-connecting",e)},(0,V.h)(Vl.Spinner,{size:36,color:e==="dark"?"#FFF":"#000"}),(0,V.h)("p",null,"Connecting...")))))}sr.ConnectContent=ql;function Jl({title:t,description:e,theme:r}){return(0,V.h)("div",{className:(0,Dt.default)("-cbwsdk-connect-item",r)},(0,V.h)("div",null,(0,V.h)(Fl.CoinbaseWalletRound,null)),(0,V.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,V.h)("h3",{className:"-cbwsdk-connect-item-title"},t),(0,V.h)("p",{className:"-cbwsdk-connect-item-description"},e)))}function ba({theme:t}){return(0,V.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,V.h)("li",{className:(0,Dt.default)("-cbwsdk-wallet-steps-item",t)},(0,V.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,V.h)("li",{className:(0,Dt.default)("-cbwsdk-wallet-steps-item",t)},(0,V.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,V.h)("span",null,"Tap ",(0,V.h)("strong",null,"Scan")," "),(0,V.h)("span",{className:(0,Dt.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",t)},(0,V.h)(Hl.QRCodeIcon,{fill:zl(t)})))))}sr.CoinbaseWalletSteps=ba;var Rn={},In={};Object.defineProperty(In,"__esModule",{value:!0});In.ArrowLeftIcon=void 0;const to=Ke;function Gl(t){return(0,to.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},t),(0,to.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"}))}In.ArrowLeftIcon=Gl;var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.LaptopIcon=void 0;const ys=Ke;function Zl(t){return(0,ys.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,ys.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,ys.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"}))}Cn.LaptopIcon=Zl;var An={};Object.defineProperty(An,"__esModule",{value:!0});An.SafeIcon=void 0;const ro=Ke;function Ql(t){return(0,ro.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,ro.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"}))}An.SafeIcon=Ql;var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.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 _a=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Rn,"__esModule",{value:!0});Rn.TryExtensionContent=void 0;const Nt=_a(Lr),Be=Ke,bs=an,Kl=In,Xl=Cn,Yl=An,eu=_a(Gs);function tu({theme:t}){const[e,r]=(0,bs.useState)(!1),n=(0,bs.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,bs.useCallback)(()=>{e?window.location.reload():(n(),r(!0))},[n,e]);return(0,Be.h)("div",{class:(0,Nt.default)("-cbwsdk-try-extension",t)},(0,Be.h)("style",null,eu.default),(0,Be.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Be.h)("h3",{class:(0,Nt.default)("-cbwsdk-try-extension-heading",t)},"Or try the Coinbase Wallet browser extension"),(0,Be.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,Be.h)("button",{class:(0,Nt.default)("-cbwsdk-try-extension-cta",t),onClick:i},e?"Refresh":"Install"),(0,Be.h)("div",null,!e&&(0,Be.h)(Kl.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:t==="light"?"#0052FF":"#588AF5"})))),(0,Be.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Be.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,Be.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Be.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Be.h)("span",{class:(0,Nt.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,Be.h)(Xl.LaptopIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Be.h)("div",{class:(0,Nt.default)("-cbwsdk-try-extension-list-item-copy",t)},"Connect with dapps with just one click on your desktop browser")),(0,Be.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Be.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Be.h)("span",{class:(0,Nt.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,Be.h)(Yl.SafeIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Be.h)("div",{class:(0,Nt.default)("-cbwsdk-try-extension-list-item-copy",t)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Rn.TryExtensionContent=tu;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.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 Ea=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bn,"__esModule",{value:!0});bn.ConnectDialog=void 0;const _s=Ea(Lr),Lt=Ke,Es=an,ru=sr,nu=Rn,su=Ea(Zs),iu=t=>{const{isOpen:e,darkMode:r}=t,[n,i]=(0,Es.useState)(!e),[s,c]=(0,Es.useState)(!e);(0,Es.useEffect)(()=>{const d=[window.setTimeout(()=>{c(!e)},10)];return e?i(!1):d.push(window.setTimeout(()=>{i(!0)},360)),()=>{d.forEach(window.clearTimeout)}},[e]);const u=r?"dark":"light";return(0,Lt.h)("div",{class:(0,_s.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,Lt.h)("style",null,su.default),(0,Lt.h)("div",{class:(0,_s.default)("-cbwsdk-connect-dialog-backdrop",u,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,Lt.h)("div",{class:"-cbwsdk-connect-dialog"},(0,Lt.h)("div",{class:(0,_s.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},t.connectDisabled?null:(0,Lt.h)(ru.ConnectContent,{theme:u,version:t.version,sessionId:t.sessionId,sessionSecret:t.sessionSecret,linkAPIUrl:t.linkAPIUrl,isConnected:t.isConnected,isParentConnection:t.isParentConnection,chainId:t.chainId,onCancel:t.onCancel}),(0,Lt.h)(nu.TryExtensionContent,{theme:u}))))};bn.ConnectDialog=iu;Object.defineProperty(yn,"__esModule",{value:!0});yn.LinkFlow=void 0;const Ss=Ke,ou=bn;class au{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,Ss.render)(null,this.root),(e=this.root.parentElement)===null||e===void 0||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,Ss.render)((0,Ss.h)(ou.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)}}yn.LinkFlow=au;var Qs={},Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(t){var e=x&&x.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=e(Lr),n=Ke,i=an,s=e(Ks),c="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",u="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{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 M=this.nextItemKey++;return this.items.set(M,E),this.render(),()=>{this.items.delete(M),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([E,M])=>(0,n.h)(t.SnackbarInstance,Object.assign({},M,{key:E}))))),this.root)}}t.Snackbar=d;const h=S=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,s.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},S.children));t.SnackbarContainer=h;const y=({autoExpand:S,message:E,menuItems:M})=>{const[k,T]=(0,i.useState)(!0),[O,B]=(0,i.useState)(S??!1);(0,i.useEffect)(()=>{const R=[window.setTimeout(()=>{T(!1)},1),window.setTimeout(()=>{B(!0)},1e4)];return()=>{R.forEach(window.clearTimeout)}});const L=()=>{B(!O)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",k&&"-cbwsdk-snackbar-instance-hidden",O&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:L},(0,n.h)("img",{src:c,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},E),(0,n.h)("div",{class:"-gear-container"},!O&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:u,class:"-gear-icon",title:"Expand"}))),M&&M.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},M.map((R,z)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",R.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:R.onClick,key:z},(0,n.h)("svg",{width:R.svgWidth,height:R.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":R.defaultFillRule,"clip-rule":R.defaultClipRule,d:R.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",R.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},R.info)))))};t.SnackbarInstance=y})(Qs);Object.defineProperty(Ar,"__esModule",{value:!0});Ar.WalletLinkRelayUI=void 0;const cu=Nr,lu=yn,uu=Qs;class du{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new uu.Snackbar({darkMode:e.darkMode}),this.linkFlow=new lu.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,cu.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return(e=this.standalone)!==null&&e!==void 0?e:!1}}Ar.WalletLinkRelayUI=du;Object.defineProperty(Cr,"__esModule",{value:!0});Cr.WalletLinkRelay=void 0;const Jt=Sr,hu=De,Q=A,xt=ur,no=it,kt=dr,fu=mn,Tt=cr,gu=Ar;class Et extends no.RelayAbstract{constructor(e){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=c=>{var u;this.isLinked=c;const d=this.storage.getItem(no.LOCAL_STORAGE_ADDRESSES_KEY);if(c&&(this.session.linked=c),this.isUnlinkedErrorState=!1,d){const h=d.split(" "),y=this.storage.getItem("IsStandaloneSigning")==="true";if(h[0]!==""&&!c&&this.session.linked&&!y){this.isUnlinkedErrorState=!0;const S=this.getSessionIdHash();(u=this.diagnostic)===null||u===void 0||u.log(xt.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:S})}}},this.metadataUpdated=(c,u)=>{this.storage.setItem(c,u)},this.chainUpdated=(c,u)=>{this.chainCallbackParams.chainId===c&&this.chainCallbackParams.jsonRpcUrl===u||(this.chainCallbackParams={chainId:c,jsonRpcUrl:u},this.chainCallback&&this.chainCallback(c,u))},this.accountUpdated=c=>{this.accountsCallback&&this.accountsCallback([c]),Et.accountRequestCallbackIds.size>0&&(Array.from(Et.accountRequestCallbackIds.values()).forEach(u=>{const d={type:"WEB3_RESPONSE",id:u,response:{method:"requestEthereumAccounts",result:[c]}};this.invokeCallback(Object.assign(Object.assign({},d),{id:u}))}),Et.accountRequestCallbackIds.clear())},this.connectedUpdated=c=>{this.ui.setConnected(c)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=(r=e.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const e=kt.Session.load(this.storage)||new kt.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new fu.WalletLinkConnection({session:e,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:c}=this.options,u=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:c,session:e});return i.connect(),{session:e,ui:u,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{var e,r;const n=this.ui.isStandalone();(e=this.diagnostic)===null||e===void 0||e.log(xt.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=kt.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((r=this.diagnostic)===null||r===void 0||r.log(xt.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:kt.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:c,connection:u}=this.subscribe();this._session=s,this.connection=u,this.ui=c,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(e=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(xt.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(e,r){this.appName=e,this.appLogoUrl=r}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,r){this.storage.setItem(e,r)}signEthereumMessage(e,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Q.hexStringFromBuffer)(e,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(e,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Q.hexStringFromBuffer)(e,!0),signature:(0,Q.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,Q.bigIntStringFromBN)(e.weiValue),data:(0,Q.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Q.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,Q.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,Q.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,Q.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,Q.bigIntStringFromBN)(e.weiValue),data:(0,Q.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,Q.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,Q.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,Q.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,Q.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Q.hexStringFromBuffer)(e,!0),chainId:r}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,Q.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,r){return this.sendRequest({method:"generic",params:{action:r,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let r=null;const n=(0,Q.randomBytesHex)(8),i=c=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,c),r==null||r()};return{promise:new Promise((c,u)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,d=>{if(r==null||r(),(0,Tt.isErrorResponse)(d))return u(new Error(d.errorMessage));c(d)}),this.ui.isStandalone()?this.sendRequestStandalone(n,e):this.publishWeb3RequestEvent(n,e)}),cancel:i}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof gu.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,r){var n;const i={type:"WEB3_REQUEST",id:e,request:r},s=kt.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(xt.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?kt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(c=>{var u;(u=this.diagnostic)===null||u===void 0||u.log(xt.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?kt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(c=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:c.message}})})}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e){var r;const{response:n}=e;if((r=this.diagnostic)===null||r===void 0||r.log(xt.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Et.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},e),{id:i}))),Et.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,r,n,i){var s;const c=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,Jt.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:r,errorMessage:c,errorCode:i}})}invokeCallback(e){const r=this.relayEventManager.callbacks.get(e.id);r&&(r(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,Q.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,s)};return{promise:new Promise((s,c)=>{if(this.relayEventManager.callbacks.set(r,u=>{if(this.ui.hideRequestEthereumAccounts(),(0,Tt.isErrorResponse)(u))return c(new Error(u.errorMessage));s(u)}),this.ui.inlineAccountsResponse()){const u=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:d}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:u})}else{const u=Jt.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(u)})}Et.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,e)}),cancel:n}}selectProvider(e){const r={method:"selectProvider",params:{providerOptions:e}},n=(0,Q.randomBytesHex)(8),i=c=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,c)},s=new Promise((c,u)=>{this.relayEventManager.callbacks.set(n,y=>{if((0,Tt.isErrorResponse)(y))return u(new Error(y.errorMessage));c(y)});const d=y=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:hu.ProviderType.Unselected}})},h=y=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:y}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:h,onCancel:d,providerOptions:e})});return{cancel:i,promise:s}}watchAsset(e,r,n,i,s,c){const u={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:i,image:s},chainId:c}};let d=null;const h=(0,Q.randomBytesHex)(8),y=E=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,u.method,E),d==null||d()};this.ui.inlineWatchAsset()||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:y,onResetConnection:this.resetAndReload}));const S=new Promise((E,M)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,Tt.isErrorResponse)(O))return M(new Error(O.errorMessage));E(O)});const k=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!1}})},T=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:T,onCancel:k,type:e,address:r,symbol:n,decimals:i,image:s,chainId:c}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,u)});return{cancel:y,promise:S}}addEthereumChain(e,r,n,i,s,c){const u={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:c}};let d=null;const h=(0,Q.randomBytesHex)(8),y=E=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,u.method,E),d==null||d()};return this.ui.inlineAddEthereumChain(e)||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:y,onResetConnection:this.resetAndReload})),{promise:new Promise((E,M)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,Tt.isErrorResponse)(O))return M(new Error(O.errorMessage));E(O)});const k=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},T=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:O}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:k,onApprove:T,chainId:u.params.chainId,rpcUrls:u.params.rpcUrls,blockExplorerUrls:u.params.blockExplorerUrls,chainName:u.params.chainName,iconUrls:u.params.iconUrls,nativeCurrency:u.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(e)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,u)}),cancel:y}}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})},i=(0,Q.randomBytesHex)(8),s=u=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,u)};return{promise:new Promise((u,d)=>{this.relayEventManager.callbacks.set(i,S=>{if((0,Tt.isErrorResponse)(S)&&S.errorCode)return d(Jt.standardErrors.provider.custom({code:S.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Tt.isErrorResponse)(S))return d(new Error(S.errorMessage));u(S)});const h=S=>{var E;if(S){const M=(E=(0,Jt.getErrorCode)(S))!==null&&E!==void 0?E:Jt.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",S instanceof Error?S:Jt.standardErrors.provider.unsupportedChain(e),M)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},y=S=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:S}}})};this.ui.switchEthereumChain({onCancel:h,onApprove:y,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return kt.Session.hash(this._session.id)}sendRequestStandalone(e,r){const n=s=>{this.handleErrorResponse(e,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}Cr.WalletLinkRelay=Et;Et.accountRequestCallbackIds=new Set;var xr={},Nn={},Sa={};(function(t){var e=x&&x.__createBinding||(Object.create?function(n,i,s,c){c===void 0&&(c=s);var u=Object.getOwnPropertyDescriptor(i,s);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,c,u)}:function(n,i,s,c){c===void 0&&(c=s),n[c]=i[s]}),r=x&&x.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Qs,t)})(Sa);var Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.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 Ma=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.RedirectDialog=void 0;const pu=Ma(Lr),mt=Ke,mu=Nr,vu=Sa,wu=Ma(Xs);class yu{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,mu.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,mt.render)(null,this.root),e&&(0,mt.render)((0,mt.h)(bu,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}}Nn.RedirectDialog=yu;const bu=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,mt.h)(vu.SnackbarContainer,{darkMode:r},(0,mt.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,mt.h)("style",null,wu.default),(0,mt.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,mt.h)("div",{class:(0,pu.default)("-cbwsdk-redirect-dialog-box",s)},(0,mt.h)("p",null,t),(0,mt.h)("button",{onClick:n},e))))};Object.defineProperty(xr,"__esModule",{value:!0});xr.MobileRelayUI=void 0;const _u=Nn;class Eu{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new _u.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}xr.MobileRelayUI=Eu;Object.defineProperty(Ir,"__esModule",{value:!0});Ir.MobileRelay=void 0;const Su=A,Mu=Cr,ku=xr;class Ru extends Mu.WalletLinkRelay{constructor(e){var r;super(e),this._enableMobileWalletLink=(r=e.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const e=(0,Su.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(e,r){if(super.publishWeb3RequestEvent(e,r),!(this._enableMobileWalletLink&&this.ui instanceof ku.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}Ir.MobileRelay=Ru;const Iu=Bc,Cu=un;function ka(t){return Buffer.allocUnsafe(t).fill(0)}function Ra(t,e,r){const n=ka(e);return t=Ln(t),r?t.length"u")throw new Error("Not an array?");if(r=La(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(s in e)i.push(pt(t,e[s]));if(r==="dynamic"){var c=pt("uint256",e.length);i.unshift(c)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([pt("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,jt.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(r=Yt(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return jt.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=Yt(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Pt(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(t.startsWith("int")){if(r=Yt(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Pt(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(t.startsWith("ufixed")){if(r=so(t),n=Pt(e),n<0)throw new Error("Supplied ufixed is negative");return pt("uint256",n.mul(new Ot(2).pow(new Ot(r[1]))))}else if(t.startsWith("fixed"))return r=so(t),pt("int256",Pt(e).mul(new Ot(2).pow(new Ot(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function Tu(t){return t==="string"||t==="bytes"||La(t)==="dynamic"}function Pu(t){return t.lastIndexOf("]")===t.length-1}function $u(t,e){var r=[],n=[],i=32*t.length;for(var s in t){var c=Na(t[s]),u=e[s],d=pt(c,u);Tu(c)?(r.push(pt("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function xa(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(jt.setLengthRight(u,r))}else if(c.startsWith("uint")){if(r=Yt(c),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Pt(u),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(c.startsWith("int")){if(r=Yt(c),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Pt(u),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+c)}return Buffer.concat(i)}function Ou(t,e){return jt.keccak(xa(t,e))}var Bu={rawEncode:$u,solidityPack:xa,soliditySHA3:Ou};const lt=Aa,yr=Bu,Ta={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"]},Ms={encodeData(t,e,r,n=!0){const i=["bytes32"],s=[this.hashType(t,r)];if(n){const c=(u,d,h)=>{if(r[d]!==void 0)return["bytes32",h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":lt.keccak(this.encodeData(d,h,r,n))];if(h===void 0)throw new Error(`missing value for field ${u} of type ${d}`);if(d==="bytes")return["bytes32",lt.keccak(h)];if(d==="string")return typeof h=="string"&&(h=Buffer.from(h,"utf8")),["bytes32",lt.keccak(h)];if(d.lastIndexOf("]")===d.length-1){const y=d.slice(0,d.lastIndexOf("[")),S=h.map(E=>c(u,y,E));return["bytes32",lt.keccak(yr.rawEncode(S.map(([E])=>E),S.map(([,E])=>E)))]}return[d,h]};for(const u of r[t]){const[d,h]=c(u.name,u.type,e[u.name]);i.push(d),s.push(h)}}else for(const c of r[t]){let u=e[c.name];if(u!==void 0)if(c.type==="bytes")i.push("bytes32"),u=lt.keccak(u),s.push(u);else if(c.type==="string")i.push("bytes32"),typeof u=="string"&&(u=Buffer.from(u,"utf8")),u=lt.keccak(u),s.push(u);else if(r[c.type]!==void 0)i.push("bytes32"),u=lt.keccak(this.encodeData(c.type,u,r,n)),s.push(u);else{if(c.type.lastIndexOf("]")===c.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(c.type),s.push(u)}}return yr.rawEncode(i,s)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);r+=i+"("+e[i].map(({name:c,type:u})=>u+" "+c).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,r))!r.includes(i)&&r.push(i);return r},hashStruct(t,e,r,n=!0){return lt.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return lt.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in Ta.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),lt.keccak(Buffer.concat(n))}};var Du={TYPED_MESSAGE_SCHEMA:Ta,TypedDataUtils:Ms,hashForSignTypedDataLegacy:function(t){return ju(t.data)},hashForSignTypedData_v3:function(t){return Ms.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return Ms.hash(t.data)}};function ju(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(s){return s.type==="bytes"?lt.toBuffer(s.value):s.value}),n=t.map(function(s){return s.type}),i=t.map(function(s){if(!s.name)throw e;return s.type+" "+s.name});return yr.soliditySHA3(["bytes32","bytes32"],[yr.soliditySHA3(new Array(t.length).fill("string"),i),yr.soliditySHA3(n,r)])}var ir={};Object.defineProperty(ir,"__esModule",{value:!0});ir.filterFromParam=ir.FilterPolyfill=void 0;const Qt=De,Je=A,Fu=5*60*1e3,$t={jsonrpc:"2.0",id:0};class Hu{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,Qt.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const r=Pa(e),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Je.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,Je.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,Je.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,Je.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,Je.intNumberFromHexString)(e);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Gr())}async getFilterLogs(e){const r=(0,Je.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},$t),{method:"eth_getLogs",params:[io(n)]})):Gr()}makeFilterId(){return(0,Qt.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(e){console.info(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const r=this.logFilters.get(e),n=this.cursors.get(e);if(!n||!r)return Gr();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return Zr();console.info(`Fetching logs from ${n} to ${s} for filter ${e}`);const c=await this.sendAsyncPromise(Object.assign(Object.assign({},$t),{method:"eth_getLogs",params:[io(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(c.result)){const u=c.result.map(h=>(0,Je.intNumberFromHexString)(h.blockNumber||"0x0")),d=Math.max(...u);if(d&&d>n){const h=(0,Qt.IntNumber)(d+1);console.info(`Moving cursor position for filter (${e}) from ${n} to ${h}`),this.cursors.set(e,h)}}return c}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return Gr();const n=await this.getCurrentBlockHeight();if(r>n)return Zr();console.info(`Fetching blocks from ${r} to ${n} for filter (${e})`);const i=(await Promise.all((0,Je.range)(r,n+1).map(c=>this.getBlockHashByNumber((0,Qt.IntNumber)(c))))).filter(c=>!!c),s=(0,Qt.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${e}) from ${r} to ${s}`),this.cursors.set(e,s),Object.assign(Object.assign({},$t),{result:i})}async getPendingTransactionFilterChanges(e){return Promise.resolve(Zr())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,i),i}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)},Fu);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},$t),{method:"eth_blockNumber",params:[]}));return(0,Je.intNumberFromHexString)((0,Je.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},$t),{method:"eth_getBlockByNumber",params:[(0,Je.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Je.ensureHexString)(r.result.hash):null}}ir.FilterPolyfill=Hu;function Pa(t){return{fromBlock:oo(t.fromBlock),toBlock:oo(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}ir.filterFromParam=Pa;function io(t){const e={fromBlock:ao(t.fromBlock),toBlock:ao(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function oo(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,Qt.IntNumber)(0);if((0,Je.isHexString)(t))return(0,Je.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function ao(t){return t==="latest"?t:(0,Je.hexStringFromIntNumber)(t)}function Gr(){return Object.assign(Object.assign({},$t),{error:{code:-32e3,message:"filter not found"}})}function Zr(){return Object.assign(Object.assign({},$t),{result:[]})}var xn={},$a={},Tn={},Ys=Uu;function Uu(t){t=t||{};var e=t.max||Number.MAX_SAFE_INTEGER,r=typeof t.start<"u"?t.start:Math.floor(Math.random()*e);return function(){return r=r%e,r++}}const co=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let i=0;i{e.errorFirst?n.push(function(c,u){if(e.multiArgs){const d=new Array(arguments.length-1);for(let h=1;h{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=i=>{const s=c=>typeof c=="string"?i===c:c.test(i);return e.include?e.include.some(s):!e.exclude.some(s)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):co(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const i in t){const s=t[i];n[i]=typeof s=="function"&&r(i)?co(s,e):s}return n},Tr={},Pr={};Object.defineProperty(Pr,"__esModule",{value:!0});const Wu=ta;function lo(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function zu(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([c]=r),c instanceof Error)throw c;const u=new Error(`Unhandled error.${c?` (${c.message})`:""}`);throw u.context=c,u}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")lo(s,this,r);else{const c=s.length,u=zu(s);for(let d=0;dt+e,uo=["sync","latest"];class Ku extends Gu.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*Zu,this._usePastBlocks=e.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){uo.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 uo.map(e=>this.listenerCount(e)).reduce(Qu)}_shouldUseNewBlock(e){const r=this._currentBlock;if(!r)return!0;const n=ho(e),i=ho(r);return this._usePastBlocks&&ni}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const r=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:r,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}Tr.BaseBlockTracker=Ku;function ho(t){return Number.parseInt(t,16)}var Oa={},Ba={},Ve={};class Da extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:u}=e,d=u.length===0?i:`At path: ${u.join(".")} -- ${i}`;super(s??d),s!=null&&(this.cause=d),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Xu(t){return at(t)&&typeof t[Symbol.iterator]=="function"}function at(t){return typeof t=="object"&&t!=null}function fo(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function je(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Yu(t){const{done:e,value:r}=t.next();return e?void 0:r}function ed(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:u,message:d=`Expected a value of type \`${c}\`${u?` with refinement \`${u}\``:""}, but received: \`${je(n)}\``}=t;return{value:n,type:c,refinement:u,key:i[i.length-1],path:i,branch:s,...t,message:d}}function*Os(t,e,r,n){Xu(t)||(t=[t]);for(const i of t){const s=ed(i,e,r,n);s&&(yield s)}}function*ei(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,u={path:n,branch:i};if(s&&(t=e.coercer(t,u),c&&e.type!=="type"&&at(e.schema)&&at(t)&&!Array.isArray(t)))for(const h in t)e.schema[h]===void 0&&delete t[h];let d="valid";for(const h of e.validator(t,u))h.explanation=r.message,d="not_valid",yield[h,void 0];for(let[h,y,S]of e.entries(t,u)){const E=ei(y,S,{path:h===void 0?n:[...n,h],branch:h===void 0?i:[...i,y],coerce:s,mask:c,message:r.message});for(const M of E)M[0]?(d=M[0].refinement!=null?"not_refined":"not_valid",yield[M[0],void 0]):s&&(y=M[1],h===void 0?t=y:t instanceof Map?t.set(h,y):t instanceof Set?t.add(y):at(t)&&(y!==void 0||h in t)&&(t[h]=y))}if(d!=="not_valid")for(const h of e.refiner(t,u))h.explanation=r.message,d="not_refined",yield[h,void 0];d==="valid"&&(yield[void 0,t])}class ee{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=d=>d,entries:u=function*(){}}=e;this.type=r,this.schema=n,this.entries=u,this.coercer=c,i?this.validator=(d,h)=>{const y=i(d,h);return Os(y,h,this,d)}:this.validator=()=>[],s?this.refiner=(d,h)=>{const y=s(d,h);return Os(y,h,this,d)}:this.refiner=()=>[]}assert(e,r){return ja(e,this,r)}create(e,r){return Fa(e,this,r)}is(e){return ti(e,this)}mask(e,r){return Ha(e,this,r)}validate(e,r={}){return hr(e,this,r)}}function ja(t,e,r){const n=hr(t,e,{message:r});if(n[0])throw n[0]}function Fa(t,e,r){const n=hr(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Ha(t,e,r){const n=hr(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function ti(t,e){return!hr(t,e)[0]}function hr(t,e,r={}){const n=ei(t,e,r),i=Yu(n);return i[0]?[new Da(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function td(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Or(n):$r(n)}function Xe(t,e){return new ee({type:t,schema:null,validator:e})}function rd(t,e){return new ee({...t,refiner:(r,n)=>r===void 0||t.refiner(r,n),validator(r,n){return r===void 0?!0:(e(r,n),t.validator(r,n))}})}function nd(t){return new ee({type:"dynamic",schema:null,*entries(e,r){yield*t(e,r).entries(e,r)},validator(e,r){return t(e,r).validator(e,r)},coercer(e,r){return t(e,r).coercer(e,r)},refiner(e,r){return t(e,r).refiner(e,r)}})}function sd(t){let e;return new ee({type:"lazy",schema:null,*entries(r,n){e??(e=t()),yield*e.entries(r,n)},validator(r,n){return e??(e=t()),e.validator(r,n)},coercer(r,n){return e??(e=t()),e.coercer(r,n)},refiner(r,n){return e??(e=t()),e.refiner(r,n)}})}function id(t,e){const{schema:r}=t,n={...r};for(const i of e)delete n[i];switch(t.type){case"type":return Or(n);default:return $r(n)}}function od(t){const e=t instanceof ee,r=e?{...t.schema}:{...t};for(const n in r)r[n]=Ua(r[n]);return e&&t.type==="type"?Or(r):$r(r)}function ad(t,e){const{schema:r}=t,n={};for(const i of e)n[i]=r[i];switch(t.type){case"type":return Or(n);default:return $r(n)}}function cd(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Xe(t,e)}function ld(){return Xe("any",()=>!0)}function ud(t){return new ee({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${je(e)}`}})}function dd(){return Xe("bigint",t=>typeof t=="bigint")}function hd(){return Xe("boolean",t=>typeof t=="boolean")}function fd(){return Xe("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${je(t)}`)}function gd(t){const e={},r=t.map(n=>je(n)).join();for(const n of t)e[n]=n;return new ee({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${je(n)}`}})}function pd(){return Xe("func",t=>typeof t=="function"||`Expected a function, but received: ${je(t)}`)}function md(t){return Xe("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${je(e)}`)}function vd(){return Xe("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${je(t)}`)}function wd(t){return new ee({type:"intersection",schema:null,*entries(e,r){for(const n of t)yield*n.entries(e,r)},*validator(e,r){for(const n of t)yield*n.validator(e,r)},*refiner(e,r){for(const n of t)yield*n.refiner(e,r)}})}function yd(t){const e=je(t),r=typeof t;return new ee({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${je(n)}`}})}function bd(t,e){return new ee({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,t],yield[n,i,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${je(r)}`}})}function ri(){return Xe("never",()=>!1)}function _d(t){return new ee({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function Ed(){return Xe("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${je(t)}`)}function $r(t){const e=t?Object.keys(t):[],r=ri();return new ee({type:"object",schema:t||null,*entries(n){if(t&&at(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return at(n)||`Expected an object, but received: ${je(n)}`},coercer(n){return at(n)?{...n}:n}})}function Ua(t){return new ee({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Sd(t,e){return new ee({type:"record",schema:null,*entries(r){if(at(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return at(r)||`Expected an object, but received: ${je(r)}`}})}function Md(){return Xe("regexp",t=>t instanceof RegExp)}function kd(t){return new ee({type:"set",schema:null,*entries(e){if(t&&e instanceof Set)for(const r of e)yield[r,r,t]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||`Expected a \`Set\` object, but received: ${je(e)}`}})}function Va(){return Xe("string",t=>typeof t=="string"||`Expected a string, but received: ${je(t)}`)}function Rd(t){const e=ri();return new ee({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;ir.type).join(" | ");return new ee({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=ei(r,s,n),[u]=c;if(u[0])for(const[d]of c)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${je(r)}`,...i]}})}function Wa(){return Xe("unknown",()=>!0)}function ni(t,e,r){return new ee({...t,coercer:(n,i)=>ti(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}function Cd(t,e,r={}){return ni(t,Wa(),n=>{const i=typeof e=="function"?e():e;if(n===void 0)return i;if(!r.strict&&fo(n)&&fo(i)){const s={...n};let c=!1;for(const u in i)s[u]===void 0&&(s[u]=i[u],c=!0);if(c)return s}return n})}function Ad(t){return ni(t,Va(),e=>e.trim())}function Nd(t){return Ut(t,"empty",e=>{const r=za(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function za(t){return t instanceof Map||t instanceof Set?t.size:t.length}function Ld(t,e,r={}){const{exclusive:n}=r;return Ut(t,"max",i=>n?in?i>e:i>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${i}\``)}function Td(t){return Ut(t,"nonempty",e=>za(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function Pd(t,e){return Ut(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function $d(t,e,r=e){const n=`Expected a ${t.type}`,i=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return Ut(t,"size",s=>{if(typeof s=="number"||s instanceof Date)return e<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:c}=s;return e<=c&&c<=r||`${n} with a size ${i} but received one with a size of \`${c}\``}else{const{length:c}=s;return e<=c&&c<=r||`${n} with a length ${i} but received one with a length of \`${c}\``}})}function Ut(t,e,r){return new ee({...t,*refiner(n,i){yield*t.refiner(n,i);const s=r(n,i),c=Os(s,i,t,n);for(const u of c)yield{...u,refinement:e}}})}const Od=Object.freeze(Object.defineProperty({__proto__:null,Struct:ee,StructError:Da,any:ld,array:ud,assert:ja,assign:td,bigint:dd,boolean:hd,coerce:ni,create:Fa,date:fd,defaulted:Cd,define:Xe,deprecated:rd,dynamic:nd,empty:Nd,enums:gd,func:pd,instance:md,integer:vd,intersection:wd,is:ti,lazy:sd,literal:yd,map:bd,mask:Ha,max:Ld,min:xd,never:ri,nonempty:Td,nullable:_d,number:Ed,object:$r,omit:id,optional:Ua,partial:od,pattern:Pd,pick:ad,record:Sd,refine:Ut,regexp:Md,set:kd,size:$d,string:Va,struct:cd,trimmed:Ad,tuple:Rd,type:Or,union:Id,unknown:Wa,validate:hr},Symbol.toStringTag,{value:"Module"})),Vt=Hs(Od);Object.defineProperty(Ve,"__esModule",{value:!0});Ve.assertExhaustive=Ve.assertStruct=Ve.assert=Ve.AssertionError=void 0;const Bd=Vt;function Dd(t){return typeof t=="object"&&t!==null&&"message"in t}function jd(t){var e,r;return typeof((r=(e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.name)=="string"}function Fd(t){const e=Dd(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function qa(t,e){return jd(t)?new t({message:e}):t({message:e})}class si extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}Ve.AssertionError=si;function Hd(t,e="Assertion failed.",r=si){if(!t)throw e instanceof Error?e:qa(r,e)}Ve.assert=Hd;function Ud(t,e,r="Assertion failed",n=si){try{(0,Bd.assert)(t,e)}catch(i){throw qa(n,`${r}: ${Fd(i)}.`)}}Ve.assertStruct=Ud;function Vd(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}Ve.assertExhaustive=Vd;var Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.base64=void 0;const Wd=Vt,zd=Ve,qd=(t,e={})=>{var r,n;const i=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let c;s==="base64"?c=String.raw`[A-Za-z0-9+\/]`:((0,zd.assert)(s==="base64url"),c=String.raw`[-_A-Za-z0-9]`);let u;return i?u=new RegExp(`^(?:${c}{4})*(?:${c}{3}=|${c}{2}==)?$`,"u"):u=new RegExp(`^(?:${c}{4})*(?:${c}{2,3}|${c}{3}=|${c}{2}==)?$`,"u"),(0,Wd.pattern)(t,u)};Br.base64=qd;var W={},Dr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.remove0x=t.add0x=t.assertIsStrictHexString=t.assertIsHexString=t.isStrictHexString=t.isHexString=t.StrictHexStruct=t.HexStruct=void 0;const e=Vt,r=Ve;t.HexStruct=(0,e.pattern)((0,e.string)(),/^(?:0x)?[0-9a-f]+$/iu),t.StrictHexStruct=(0,e.pattern)((0,e.string)(),/^0x[0-9a-f]+$/iu);function n(h){return(0,e.is)(h,t.HexStruct)}t.isHexString=n;function i(h){return(0,e.is)(h,t.StrictHexStruct)}t.isStrictHexString=i;function s(h){(0,r.assert)(n(h),"Value must be a hexadecimal string.")}t.assertIsHexString=s;function c(h){(0,r.assert)(i(h),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=c;function u(h){return h.startsWith("0x")?h:h.startsWith("0X")?`0x${h.substring(2)}`:`0x${h}`}t.add0x=u;function d(h){return h.startsWith("0x")||h.startsWith("0X")?h.substring(2):h}t.remove0x=d})(Dr);Object.defineProperty(W,"__esModule",{value:!0});W.createDataView=W.concatBytes=W.valueToBytes=W.stringToBytes=W.numberToBytes=W.signedBigIntToBytes=W.bigIntToBytes=W.hexToBytes=W.bytesToString=W.bytesToNumber=W.bytesToSignedBigInt=W.bytesToBigInt=W.bytesToHex=W.assertIsBytes=W.isBytes=void 0;const tt=Ve,Bs=Dr,go=48,po=58,mo=87;function Jd(){const t=[];return()=>{if(t.length===0)for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return t}}const Gd=Jd();function ii(t){return t instanceof Uint8Array}W.isBytes=ii;function fr(t){(0,tt.assert)(ii(t),"Value must be a Uint8Array.")}W.assertIsBytes=fr;function Ja(t){if(fr(t),t.length===0)return"0x";const e=Gd(),r=new Array(t.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const e=t.toString(16);return Pn(e)}W.bigIntToBytes=Za;function Xd(t,e){(0,tt.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function Yd(t,e){(0,tt.assert)(typeof t=="bigint","Value must be a bigint."),(0,tt.assert)(typeof e=="number","Byte length must be a number."),(0,tt.assert)(e>0,"Byte length must be greater than 0."),(0,tt.assert)(Xd(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let i=0;i>=BigInt(8);return n.reverse()}W.signedBigIntToBytes=Yd;function Qa(t){(0,tt.assert)(typeof t=="number","Value must be a number."),(0,tt.assert)(t>=0,"Value must be a non-negative number."),(0,tt.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return Pn(e)}W.numberToBytes=Qa;function Ka(t){return(0,tt.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}W.stringToBytes=Ka;function Xa(t){if(typeof t=="bigint")return Za(t);if(typeof t=="number")return Qa(t);if(typeof t=="string")return t.startsWith("0x")?Pn(t):Ka(t);if(ii(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}W.valueToBytes=Xa;function eh(t){const e=new Array(t.length);let r=0;for(let i=0;ie.call(r,n,i,this))}get(e){return Ge(this,ct,"f").get(e)}has(e){return Ge(this,ct,"f").has(e)}keys(){return Ge(this,ct,"f").keys()}values(){return Ge(this,ct,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}or.FrozenMap=oi;class ai{constructor(e){ft.set(this,void 0),tc(this,ft,new Set(e),"f"),Object.freeze(this)}get size(){return Ge(this,ft,"f").size}[(ft=new WeakMap,Symbol.iterator)](){return Ge(this,ft,"f")[Symbol.iterator]()}entries(){return Ge(this,ft,"f").entries()}forEach(e,r){return Ge(this,ft,"f").forEach((n,i,s)=>e.call(r,n,i,this))}has(e){return Ge(this,ft,"f").has(e)}keys(){return Ge(this,ft,"f").keys()}values(){return Ge(this,ft,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}or.FrozenSet=ai;Object.freeze(oi);Object.freeze(oi.prototype);Object.freeze(ai);Object.freeze(ai.prototype);var rc={};Object.defineProperty(rc,"__esModule",{value:!0});var nc={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getJsonRpcIdValidator=t.assertIsJsonRpcError=t.isJsonRpcError=t.assertIsJsonRpcFailure=t.isJsonRpcFailure=t.assertIsJsonRpcSuccess=t.isJsonRpcSuccess=t.assertIsJsonRpcResponse=t.isJsonRpcResponse=t.assertIsPendingJsonRpcResponse=t.isPendingJsonRpcResponse=t.JsonRpcResponseStruct=t.JsonRpcFailureStruct=t.JsonRpcSuccessStruct=t.PendingJsonRpcResponseStruct=t.assertIsJsonRpcRequest=t.isJsonRpcRequest=t.assertIsJsonRpcNotification=t.isJsonRpcNotification=t.JsonRpcNotificationStruct=t.JsonRpcRequestStruct=t.JsonRpcParamsStruct=t.JsonRpcErrorStruct=t.JsonRpcIdStruct=t.JsonRpcVersionStruct=t.jsonrpc2=t.getJsonSize=t.isValidJson=t.JsonStruct=t.UnsafeJsonStruct=void 0;const e=Vt,r=Ve,n=()=>(0,e.define)("finite number",C=>(0,e.is)(C,(0,e.number)())&&Number.isFinite(C));t.UnsafeJsonStruct=(0,e.union)([(0,e.literal)(null),(0,e.boolean)(),n(),(0,e.string)(),(0,e.array)((0,e.lazy)(()=>t.UnsafeJsonStruct)),(0,e.record)((0,e.string)(),(0,e.lazy)(()=>t.UnsafeJsonStruct))]),t.JsonStruct=(0,e.define)("Json",(C,P)=>{function J(We,Qe){const H=[...Qe.validator(We,P)];return H.length>0?H:!0}try{const We=J(C,t.UnsafeJsonStruct);return We!==!0?We:J(JSON.parse(JSON.stringify(C)),t.UnsafeJsonStruct)}catch(We){return We instanceof RangeError?"Circular reference detected":!1}});function i(C){return(0,e.is)(C,t.JsonStruct)}t.isValidJson=i;function s(C){(0,r.assertStruct)(C,t.JsonStruct,"Invalid JSON value");const P=JSON.stringify(C);return new TextEncoder().encode(P).byteLength}t.getJsonSize=s,t.jsonrpc2="2.0",t.JsonRpcVersionStruct=(0,e.literal)(t.jsonrpc2),t.JsonRpcIdStruct=(0,e.nullable)((0,e.union)([(0,e.number)(),(0,e.string)()])),t.JsonRpcErrorStruct=(0,e.object)({code:(0,e.integer)(),message:(0,e.string)(),data:(0,e.optional)(t.JsonStruct),stack:(0,e.optional)((0,e.string)())}),t.JsonRpcParamsStruct=(0,e.optional)((0,e.union)([(0,e.record)((0,e.string)(),t.JsonStruct),(0,e.array)(t.JsonStruct)])),t.JsonRpcRequestStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,method:(0,e.string)(),params:t.JsonRpcParamsStruct}),t.JsonRpcNotificationStruct=(0,e.omit)(t.JsonRpcRequestStruct,["id"]);function c(C){return(0,e.is)(C,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=c;function u(C,P){(0,r.assertStruct)(C,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",P)}t.assertIsJsonRpcNotification=u;function d(C){return(0,e.is)(C,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=d;function h(C,P){(0,r.assertStruct)(C,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",P)}t.assertIsJsonRpcRequest=h,t.PendingJsonRpcResponseStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:(0,e.optional)((0,e.unknown)()),error:(0,e.optional)(t.JsonRpcErrorStruct)}),t.JsonRpcSuccessStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:t.JsonStruct}),t.JsonRpcFailureStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,error:t.JsonRpcErrorStruct}),t.JsonRpcResponseStruct=(0,e.union)([t.JsonRpcSuccessStruct,t.JsonRpcFailureStruct]);function y(C){return(0,e.is)(C,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=y;function S(C,P){(0,r.assertStruct)(C,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",P)}t.assertIsPendingJsonRpcResponse=S;function E(C){return(0,e.is)(C,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=E;function M(C,P){(0,r.assertStruct)(C,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",P)}t.assertIsJsonRpcResponse=M;function k(C){return(0,e.is)(C,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=k;function T(C,P){(0,r.assertStruct)(C,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",P)}t.assertIsJsonRpcSuccess=T;function O(C){return(0,e.is)(C,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=O;function B(C,P){(0,r.assertStruct)(C,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",P)}t.assertIsJsonRpcFailure=B;function L(C){return(0,e.is)(C,t.JsonRpcErrorStruct)}t.isJsonRpcError=L;function R(C,P){(0,r.assertStruct)(C,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",P)}t.assertIsJsonRpcError=R;function z(C){const{permitEmptyString:P,permitFractions:J,permitNull:We}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},C);return Y=>!!(typeof Y=="number"&&(J||Number.isInteger(Y))||typeof Y=="string"&&(P||Y.length>0)||We&&Y===null)}t.getJsonRpcIdValidator=z})(nc);var sc={};Object.defineProperty(sc,"__esModule",{value:!0});var ar={},hh=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ar,"__esModule",{value:!0});ar.createModuleLogger=ar.createProjectLogger=void 0;const fh=hh(xc),gh=(0,fh.default)("metamask");function ph(t){return gh.extend(t)}ar.createProjectLogger=ph;function mh(t,e){return t.extend(e)}ar.createModuleLogger=mh;var ic={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateNumberSize=t.calculateStringSize=t.isASCII=t.isPlainObject=t.ESCAPE_CHARACTERS_REGEXP=t.JsonSize=t.hasProperty=t.isObject=t.isNullOrUndefined=t.isNonEmptyArray=void 0;function e(h){return Array.isArray(h)&&h.length>0}t.isNonEmptyArray=e;function r(h){return h==null}t.isNullOrUndefined=r;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}t.isObject=n;const i=(h,y)=>Object.hasOwnProperty.call(h,y);t.hasProperty=i,function(h){h[h.Null=4]="Null",h[h.Comma=1]="Comma",h[h.Wrapper=1]="Wrapper",h[h.True=4]="True",h[h.False=5]="False",h[h.Quote=1]="Quote",h[h.Colon=1]="Colon",h[h.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(h){if(typeof h!="object"||h===null)return!1;try{let y=h;for(;Object.getPrototypeOf(y)!==null;)y=Object.getPrototypeOf(y);return Object.getPrototypeOf(h)===y}catch{return!1}}t.isPlainObject=s;function c(h){return h.charCodeAt(0)<=127}t.isASCII=c;function u(h){var y;return h.split("").reduce((E,M)=>c(M)?E+1:E+2,0)+((y=h.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&y!==void 0?y:[]).length}t.calculateStringSize=u;function d(h){return h.toString().length}t.calculateNumberSize=d})(ic);var bt={};Object.defineProperty(bt,"__esModule",{value:!0});bt.hexToBigInt=bt.hexToNumber=bt.bigIntToHex=bt.numberToHex=void 0;const er=Ve,_r=Dr,vh=t=>((0,er.assert)(typeof t=="number","Value must be a number."),(0,er.assert)(t>=0,"Value must be a non-negative number."),(0,er.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,_r.add0x)(t.toString(16)));bt.numberToHex=vh;const wh=t=>((0,er.assert)(typeof t=="bigint","Value must be a bigint."),(0,er.assert)(t>=0,"Value must be a non-negative bigint."),(0,_r.add0x)(t.toString(16)));bt.bigIntToHex=wh;const yh=t=>{(0,_r.assertIsHexString)(t);const e=parseInt(t,16);return(0,er.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};bt.hexToNumber=yh;const bh=t=>((0,_r.assertIsHexString)(t),BigInt((0,_r.add0x)(t)));bt.hexToBigInt=bh;var oc={};Object.defineProperty(oc,"__esModule",{value:!0});var ac={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=s=>Number.isInteger(s)&&s>=0,r=(s,c)=>{if(!e(s))throw new Error(`"${c}" must be a non-negative integer. Received: "${s}".`)};function n(s,c){return r(s,"count"),s*c}t.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}t.timeSince=i})(ac);var cc={};Object.defineProperty(cc,"__esModule",{value:!0});var lc={},Ds={exports:{}};const _h="2.0.0",uc=256,Eh=Number.MAX_SAFE_INTEGER||9007199254740991,Sh=16,Mh=uc-6,kh=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Bn={MAX_LENGTH:uc,MAX_SAFE_COMPONENT_LENGTH:Sh,MAX_SAFE_BUILD_LENGTH:Mh,MAX_SAFE_INTEGER:Eh,RELEASE_TYPES:kh,SEMVER_SPEC_VERSION:_h,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},ks={};const Rh=typeof process=="object"&&ks&&ks.NODE_DEBUG&&/\bsemver\b/i.test(ks.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var Dn=Rh;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Bn,s=Dn;e=t.exports={};const c=e.re=[],u=e.safeRe=[],d=e.src=[],h=e.t={};let y=0;const S="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",i],[S,n]],M=T=>{for(const[O,B]of E)T=T.split(`${O}*`).join(`${O}{0,${B}}`).split(`${O}+`).join(`${O}{1,${B}}`);return T},k=(T,O,B)=>{const L=M(O),R=y++;s(T,R,O),h[T]=R,d[R]=O,c[R]=new RegExp(O,B?"g":void 0),u[R]=new RegExp(L,B?"g":void 0)};k("NUMERICIDENTIFIER","0|[1-9]\\d*"),k("NUMERICIDENTIFIERLOOSE","\\d+"),k("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${S}*`),k("MAINVERSION",`(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})`),k("MAINVERSIONLOOSE",`(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})`),k("PRERELEASEIDENTIFIER",`(?:${d[h.NUMERICIDENTIFIER]}|${d[h.NONNUMERICIDENTIFIER]})`),k("PRERELEASEIDENTIFIERLOOSE",`(?:${d[h.NUMERICIDENTIFIERLOOSE]}|${d[h.NONNUMERICIDENTIFIER]})`),k("PRERELEASE",`(?:-(${d[h.PRERELEASEIDENTIFIER]}(?:\\.${d[h.PRERELEASEIDENTIFIER]})*))`),k("PRERELEASELOOSE",`(?:-?(${d[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[h.PRERELEASEIDENTIFIERLOOSE]})*))`),k("BUILDIDENTIFIER",`${S}+`),k("BUILD",`(?:\\+(${d[h.BUILDIDENTIFIER]}(?:\\.${d[h.BUILDIDENTIFIER]})*))`),k("FULLPLAIN",`v?${d[h.MAINVERSION]}${d[h.PRERELEASE]}?${d[h.BUILD]}?`),k("FULL",`^${d[h.FULLPLAIN]}$`),k("LOOSEPLAIN",`[v=\\s]*${d[h.MAINVERSIONLOOSE]}${d[h.PRERELEASELOOSE]}?${d[h.BUILD]}?`),k("LOOSE",`^${d[h.LOOSEPLAIN]}$`),k("GTLT","((?:<|>)?=?)"),k("XRANGEIDENTIFIERLOOSE",`${d[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),k("XRANGEIDENTIFIER",`${d[h.NUMERICIDENTIFIER]}|x|X|\\*`),k("XRANGEPLAIN",`[v=\\s]*(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:${d[h.PRERELEASE]})?${d[h.BUILD]}?)?)?`),k("XRANGEPLAINLOOSE",`[v=\\s]*(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:${d[h.PRERELEASELOOSE]})?${d[h.BUILD]}?)?)?`),k("XRANGE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAIN]}$`),k("XRANGELOOSE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAINLOOSE]}$`),k("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),k("COERCE",`${d[h.COERCEPLAIN]}(?:$|[^\\d])`),k("COERCEFULL",d[h.COERCEPLAIN]+`(?:${d[h.PRERELEASE]})?(?:${d[h.BUILD]})?(?:$|[^\\d])`),k("COERCERTL",d[h.COERCE],!0),k("COERCERTLFULL",d[h.COERCEFULL],!0),k("LONETILDE","(?:~>?)"),k("TILDETRIM",`(\\s*)${d[h.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",k("TILDE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAIN]}$`),k("TILDELOOSE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAINLOOSE]}$`),k("LONECARET","(?:\\^)"),k("CARETTRIM",`(\\s*)${d[h.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",k("CARET",`^${d[h.LONECARET]}${d[h.XRANGEPLAIN]}$`),k("CARETLOOSE",`^${d[h.LONECARET]}${d[h.XRANGEPLAINLOOSE]}$`),k("COMPARATORLOOSE",`^${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]})$|^$`),k("COMPARATOR",`^${d[h.GTLT]}\\s*(${d[h.FULLPLAIN]})$|^$`),k("COMPARATORTRIM",`(\\s*)${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]}|${d[h.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",k("HYPHENRANGE",`^\\s*(${d[h.XRANGEPLAIN]})\\s+-\\s+(${d[h.XRANGEPLAIN]})\\s*$`),k("HYPHENRANGELOOSE",`^\\s*(${d[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[h.XRANGEPLAINLOOSE]})\\s*$`),k("STAR","(<|>)?=?\\s*\\*"),k("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),k("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(Ds,Ds.exports);var jr=Ds.exports;const Ih=Object.freeze({loose:!0}),Ch=Object.freeze({}),Ah=t=>t?typeof t!="object"?Ih:t:Ch;var ci=Ah;const wo=/^[0-9]+$/,dc=(t,e)=>{const r=wo.test(t),n=wo.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tdc(e,t);var hc={compareIdentifiers:dc,rcompareIdentifiers:Nh};const Qr=Dn,{MAX_LENGTH:yo,MAX_SAFE_INTEGER:Kr}=Bn,{safeRe:bo,t:_o}=jr,Lh=ci,{compareIdentifiers:Gt}=hc;let xh=class gt{constructor(e,r){if(r=Lh(r),e instanceof gt){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>yo)throw new TypeError(`version is longer than ${yo} characters`);Qr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?bo[_o.LOOSE]:bo[_o.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Kr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Kr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Kr||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Gt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var Ze=xh;const Eo=Ze,Th=(t,e,r=!1)=>{if(t instanceof Eo)return t;try{return new Eo(t,e)}catch(n){if(!r)return null;throw n}};var gr=Th;const Ph=gr,$h=(t,e)=>{const r=Ph(t,e);return r?r.version:null};var Oh=$h;const Bh=gr,Dh=(t,e)=>{const r=Bh(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var jh=Dh;const So=Ze,Fh=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new So(t instanceof So?t.version:t,r).inc(e,n,i).version}catch{return null}};var Hh=Fh;const Mo=gr,Uh=(t,e)=>{const r=Mo(t,null,!0),n=Mo(e,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,c=s?r:n,u=s?n:r,d=!!c.prerelease.length;if(!!u.prerelease.length&&!d)return!u.patch&&!u.minor?"major":c.patch?"patch":c.minor?"minor":"major";const y=d?"pre":"";return r.major!==n.major?y+"major":r.minor!==n.minor?y+"minor":r.patch!==n.patch?y+"patch":"prerelease"};var Vh=Uh;const Wh=Ze,zh=(t,e)=>new Wh(t,e).major;var qh=zh;const Jh=Ze,Gh=(t,e)=>new Jh(t,e).minor;var Zh=Gh;const Qh=Ze,Kh=(t,e)=>new Qh(t,e).patch;var Xh=Kh;const Yh=gr,ef=(t,e)=>{const r=Yh(t,e);return r&&r.prerelease.length?r.prerelease:null};var tf=ef;const ko=Ze,rf=(t,e,r)=>new ko(t,r).compare(new ko(e,r));var ut=rf;const nf=ut,sf=(t,e,r)=>nf(e,t,r);var of=sf;const af=ut,cf=(t,e)=>af(t,e,!0);var lf=cf;const Ro=Ze,uf=(t,e,r)=>{const n=new Ro(t,r),i=new Ro(e,r);return n.compare(i)||n.compareBuild(i)};var li=uf;const df=li,hf=(t,e)=>t.sort((r,n)=>df(r,n,e));var ff=hf;const gf=li,pf=(t,e)=>t.sort((r,n)=>gf(n,r,e));var mf=pf;const vf=ut,wf=(t,e,r)=>vf(t,e,r)>0;var jn=wf;const yf=ut,bf=(t,e,r)=>yf(t,e,r)<0;var ui=bf;const _f=ut,Ef=(t,e,r)=>_f(t,e,r)===0;var fc=Ef;const Sf=ut,Mf=(t,e,r)=>Sf(t,e,r)!==0;var gc=Mf;const kf=ut,Rf=(t,e,r)=>kf(t,e,r)>=0;var di=Rf;const If=ut,Cf=(t,e,r)=>If(t,e,r)<=0;var hi=Cf;const Af=fc,Nf=gc,Lf=jn,xf=di,Tf=ui,Pf=hi,$f=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Af(t,r,n);case"!=":return Nf(t,r,n);case">":return Lf(t,r,n);case">=":return xf(t,r,n);case"<":return Tf(t,r,n);case"<=":return Pf(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var pc=$f;const Of=Ze,Bf=gr,{safeRe:Xr,t:Yr}=jr,Df=(t,e)=>{if(t instanceof Of)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Xr[Yr.COERCEFULL]:Xr[Yr.COERCE]);else{const d=e.includePrerelease?Xr[Yr.COERCERTLFULL]:Xr[Yr.COERCERTL];let h;for(;(h=d.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),d.lastIndex=h.index+h[1].length+h[2].length;d.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",c=e.includePrerelease&&r[5]?`-${r[5]}`:"",u=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Bf(`${n}.${i}.${s}${c}${u}`,e)};var jf=Df;class Ff{constructor(){this.max=1e3,this.map=new Map}get(e){const r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}}var Hf=Ff,Rs,Io;function dt(){if(Io)return Rs;Io=1;const t=/\s+/g;class e{constructor(l,f){if(f=i(f),l instanceof e)return l.loose===!!f.loose&&l.includePrerelease===!!f.includePrerelease?l:new e(l.raw,f);if(l instanceof s)return this.raw=l.value,this.set=[[l]],this.formatted=void 0,this;if(this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease,this.raw=l.trim().replace(t," "),this.set=this.raw.split("||").map(g=>this.parseRange(g.trim())).filter(g=>g.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const g=this.set[0];if(this.set=this.set.filter(m=>!T(m[0])),this.set.length===0)this.set=[g];else if(this.set.length>1){for(const m of this.set)if(m.length===1&&O(m[0])){this.set=[m];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let l=0;l0&&(this.formatted+="||");const f=this.set[l];for(let g=0;g0&&(this.formatted+=" "),this.formatted+=f[g].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(l){const g=((this.options.includePrerelease&&M)|(this.options.loose&&k))+":"+l,m=n.get(g);if(m)return m;const w=this.options.loose,_=w?d[h.HYPHENRANGELOOSE]:d[h.HYPHENRANGE];l=l.replace(_,q(this.options.includePrerelease)),c("hyphen replace",l),l=l.replace(d[h.COMPARATORTRIM],y),c("comparator trim",l),l=l.replace(d[h.TILDETRIM],S),c("tilde trim",l),l=l.replace(d[h.CARETTRIM],E),c("caret trim",l);let p=l.split(" ").map(I=>L(I,this.options)).join(" ").split(/\s+/).map(I=>H(I,this.options));w&&(p=p.filter(I=>(c("loose invalid filter",I,this.options),!!I.match(d[h.COMPARATORLOOSE])))),c("range list",p);const a=new Map,v=p.map(I=>new s(I,this.options));for(const I of v){if(T(I))return[I];a.set(I.value,I)}a.size>1&&a.has("")&&a.delete("");const N=[...a.values()];return n.set(g,N),N}intersects(l,f){if(!(l instanceof e))throw new TypeError("a Range is required");return this.set.some(g=>B(g,f)&&l.set.some(m=>B(m,f)&&g.every(w=>m.every(_=>w.intersects(_,f)))))}test(l){if(!l)return!1;if(typeof l=="string")try{l=new u(l,this.options)}catch{return!1}for(let f=0;fo.value==="<0.0.0-0",O=o=>o.value==="",B=(o,l)=>{let f=!0;const g=o.slice();let m=g.pop();for(;f&&g.length;)f=g.every(w=>m.intersects(w,l)),m=g.pop();return f},L=(o,l)=>(c("comp",o,l),o=P(o,l),c("caret",o),o=z(o,l),c("tildes",o),o=We(o,l),c("xrange",o),o=Y(o,l),c("stars",o),o),R=o=>!o||o.toLowerCase()==="x"||o==="*",z=(o,l)=>o.trim().split(/\s+/).map(f=>C(f,l)).join(" "),C=(o,l)=>{const f=l.loose?d[h.TILDELOOSE]:d[h.TILDE];return o.replace(f,(g,m,w,_,p)=>{c("tilde",o,g,m,w,_,p);let a;return R(m)?a="":R(w)?a=`>=${m}.0.0 <${+m+1}.0.0-0`:R(_)?a=`>=${m}.${w}.0 <${m}.${+w+1}.0-0`:p?(c("replaceTilde pr",p),a=`>=${m}.${w}.${_}-${p} <${m}.${+w+1}.0-0`):a=`>=${m}.${w}.${_} <${m}.${+w+1}.0-0`,c("tilde return",a),a})},P=(o,l)=>o.trim().split(/\s+/).map(f=>J(f,l)).join(" "),J=(o,l)=>{c("caret",o,l);const f=l.loose?d[h.CARETLOOSE]:d[h.CARET],g=l.includePrerelease?"-0":"";return o.replace(f,(m,w,_,p,a)=>{c("caret",o,m,w,_,p,a);let v;return R(w)?v="":R(_)?v=`>=${w}.0.0${g} <${+w+1}.0.0-0`:R(p)?w==="0"?v=`>=${w}.${_}.0${g} <${w}.${+_+1}.0-0`:v=`>=${w}.${_}.0${g} <${+w+1}.0.0-0`:a?(c("replaceCaret pr",a),w==="0"?_==="0"?v=`>=${w}.${_}.${p}-${a} <${w}.${_}.${+p+1}-0`:v=`>=${w}.${_}.${p}-${a} <${w}.${+_+1}.0-0`:v=`>=${w}.${_}.${p}-${a} <${+w+1}.0.0-0`):(c("no pr"),w==="0"?_==="0"?v=`>=${w}.${_}.${p}${g} <${w}.${_}.${+p+1}-0`:v=`>=${w}.${_}.${p}${g} <${w}.${+_+1}.0-0`:v=`>=${w}.${_}.${p} <${+w+1}.0.0-0`),c("caret return",v),v})},We=(o,l)=>(c("replaceXRanges",o,l),o.split(/\s+/).map(f=>Qe(f,l)).join(" ")),Qe=(o,l)=>{o=o.trim();const f=l.loose?d[h.XRANGELOOSE]:d[h.XRANGE];return o.replace(f,(g,m,w,_,p,a)=>{c("xRange",o,g,m,w,_,p,a);const v=R(w),N=v||R(_),I=N||R(p),$=I;return m==="="&&$&&(m=""),a=l.includePrerelease?"-0":"",v?m===">"||m==="<"?g="<0.0.0-0":g="*":m&&$?(N&&(_=0),p=0,m===">"?(m=">=",N?(w=+w+1,_=0,p=0):(_=+_+1,p=0)):m==="<="&&(m="<",N?w=+w+1:_=+_+1),m==="<"&&(a="-0"),g=`${m+w}.${_}.${p}${a}`):N?g=`>=${w}.0.0${a} <${+w+1}.0.0-0`:I&&(g=`>=${w}.${_}.0${a} <${w}.${+_+1}.0-0`),c("xRange return",g),g})},Y=(o,l)=>(c("replaceStars",o,l),o.trim().replace(d[h.STAR],"")),H=(o,l)=>(c("replaceGTE0",o,l),o.trim().replace(d[l.includePrerelease?h.GTE0PRE:h.GTE0],"")),q=o=>(l,f,g,m,w,_,p,a,v,N,I,$)=>(R(g)?f="":R(m)?f=`>=${g}.0.0${o?"-0":""}`:R(w)?f=`>=${g}.${m}.0${o?"-0":""}`:_?f=`>=${f}`:f=`>=${f}${o?"-0":""}`,R(v)?a="":R(N)?a=`<${+v+1}.0.0-0`:R(I)?a=`<${v}.${+N+1}.0-0`:$?a=`<=${v}.${N}.${I}-${$}`:o?a=`<${v}.${N}.${+I+1}-0`:a=`<=${a}`,`${f} ${a}`.trim()),b=(o,l,f)=>{for(let g=0;g0){const m=o[g].semver;if(m.major===l.major&&m.minor===l.minor&&m.patch===l.patch)return!0}return!1}return!0};return Rs}var Is,Co;function Fn(){if(Co)return Is;Co=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(y,S){if(S=r(S),y instanceof e){if(y.loose===!!S.loose)return y;y=y.value}y=y.trim().split(/\s+/).join(" "),c("comparator",y,S),this.options=S,this.loose=!!S.loose,this.parse(y),this.semver===t?this.value="":this.value=this.operator+this.semver.version,c("comp",this)}parse(y){const S=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],E=y.match(S);if(!E)throw new TypeError(`Invalid comparator: ${y}`);this.operator=E[1]!==void 0?E[1]:"",this.operator==="="&&(this.operator=""),E[2]?this.semver=new u(E[2],this.options.loose):this.semver=t}toString(){return this.value}test(y){if(c("Comparator.test",y,this.options.loose),this.semver===t||y===t)return!0;if(typeof y=="string")try{y=new u(y,this.options)}catch{return!1}return s(y,this.operator,this.semver,this.options)}intersects(y,S){if(!(y instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(y.value,S).test(this.value):y.operator===""?y.value===""?!0:new d(this.value,S).test(y.semver):(S=r(S),S.includePrerelease&&(this.value==="<0.0.0-0"||y.value==="<0.0.0-0")||!S.includePrerelease&&(this.value.startsWith("<0.0.0")||y.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&y.operator.startsWith(">")||this.operator.startsWith("<")&&y.operator.startsWith("<")||this.semver.version===y.semver.version&&this.operator.includes("=")&&y.operator.includes("=")||s(this.semver,"<",y.semver,S)&&this.operator.startsWith(">")&&y.operator.startsWith("<")||s(this.semver,">",y.semver,S)&&this.operator.startsWith("<")&&y.operator.startsWith(">")))}}Is=e;const r=ci,{safeRe:n,t:i}=jr,s=pc,c=Dn,u=Ze,d=dt();return Is}const Uf=dt(),Vf=(t,e,r)=>{try{e=new Uf(e,r)}catch{return!1}return e.test(t)};var Hn=Vf;const Wf=dt(),zf=(t,e)=>new Wf(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var qf=zf;const Jf=Ze,Gf=dt(),Zf=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Gf(e,r)}catch{return null}return t.forEach(c=>{s.test(c)&&(!n||i.compare(c)===-1)&&(n=c,i=new Jf(n,r))}),n};var Qf=Zf;const Kf=Ze,Xf=dt(),Yf=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Xf(e,r)}catch{return null}return t.forEach(c=>{s.test(c)&&(!n||i.compare(c)===1)&&(n=c,i=new Kf(n,r))}),n};var e0=Yf;const Cs=Ze,t0=dt(),Ao=jn,r0=(t,e)=>{t=new t0(t,e);let r=new Cs("0.0.0");if(t.test(r)||(r=new Cs("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{const u=new Cs(c.semver.version);switch(c.operator){case">":u.prerelease.length===0?u.patch++:u.prerelease.push(0),u.raw=u.format();case"":case">=":(!s||Ao(u,s))&&(s=u);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${c.operator}`)}}),s&&(!r||Ao(r,s))&&(r=s)}return r&&t.test(r)?r:null};var n0=r0;const s0=dt(),i0=(t,e)=>{try{return new s0(t,e).range||"*"}catch{return null}};var o0=i0;const a0=Ze,mc=Fn(),{ANY:c0}=mc,l0=dt(),u0=Hn,No=jn,Lo=ui,d0=hi,h0=di,f0=(t,e,r,n)=>{t=new a0(t,n),e=new l0(e,n);let i,s,c,u,d;switch(r){case">":i=No,s=d0,c=Lo,u=">",d=">=";break;case"<":i=Lo,s=h0,c=No,u="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(u0(t,e,n))return!1;for(let h=0;h{M.semver===c0&&(M=new mc(">=0.0.0")),S=S||M,E=E||M,i(M.semver,S.semver,n)?S=M:c(M.semver,E.semver,n)&&(E=M)}),S.operator===u||S.operator===d||(!E.operator||E.operator===u)&&s(t,E.semver))return!1;if(E.operator===d&&c(t,E.semver))return!1}return!0};var fi=f0;const g0=fi,p0=(t,e,r)=>g0(t,e,">",r);var m0=p0;const v0=fi,w0=(t,e,r)=>v0(t,e,"<",r);var y0=w0;const xo=dt(),b0=(t,e,r)=>(t=new xo(t,r),e=new xo(e,r),t.intersects(e,r));var _0=b0;const E0=Hn,S0=ut;var M0=(t,e,r)=>{const n=[];let i=null,s=null;const c=t.sort((y,S)=>S0(y,S,r));for(const y of c)E0(y,e,r)?(s=y,i||(i=y)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const u=[];for(const[y,S]of n)y===S?u.push(y):!S&&y===c[0]?u.push("*"):S?y===c[0]?u.push(`<=${S}`):u.push(`${y} - ${S}`):u.push(`>=${y}`);const d=u.join(" || "),h=typeof e.raw=="string"?e.raw:String(e);return d.length{if(t===e)return!0;t=new To(t,r),e=new To(e,r);let n=!1;e:for(const i of t.set){for(const s of e.set){const c=I0(i,s,r);if(n=n||c!==null,c)continue e}if(n)return!1}return!0},R0=[new gi(">=0.0.0-0")],Po=[new gi(">=0.0.0")],I0=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===As){if(e.length===1&&e[0].semver===As)return!0;r.includePrerelease?t=R0:t=Po}if(e.length===1&&e[0].semver===As){if(r.includePrerelease)return!0;e=Po}const n=new Set;let i,s;for(const M of t)M.operator===">"||M.operator===">="?i=$o(i,M,r):M.operator==="<"||M.operator==="<="?s=Oo(s,M,r):n.add(M.semver);if(n.size>1)return null;let c;if(i&&s){if(c=pi(i.semver,s.semver,r),c>0)return null;if(c===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const M of n){if(i&&!mr(M,String(i),r)||s&&!mr(M,String(s),r))return null;for(const k of e)if(!mr(M,String(k),r))return!1;return!0}let u,d,h,y,S=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,E=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;S&&S.prerelease.length===1&&s.operator==="<"&&S.prerelease[0]===0&&(S=!1);for(const M of e){if(y=y||M.operator===">"||M.operator===">=",h=h||M.operator==="<"||M.operator==="<=",i){if(E&&M.semver.prerelease&&M.semver.prerelease.length&&M.semver.major===E.major&&M.semver.minor===E.minor&&M.semver.patch===E.patch&&(E=!1),M.operator===">"||M.operator===">="){if(u=$o(i,M,r),u===M&&u!==i)return!1}else if(i.operator===">="&&!mr(i.semver,String(M),r))return!1}if(s){if(S&&M.semver.prerelease&&M.semver.prerelease.length&&M.semver.major===S.major&&M.semver.minor===S.minor&&M.semver.patch===S.patch&&(S=!1),M.operator==="<"||M.operator==="<="){if(d=Oo(s,M,r),d===M&&d!==s)return!1}else if(s.operator==="<="&&!mr(s.semver,String(M),r))return!1}if(!M.operator&&(s||i)&&c!==0)return!1}return!(i&&h&&!s&&c!==0||s&&y&&!i&&c!==0||E||S)},$o=(t,e,r)=>{if(!t)return e;const n=pi(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Oo=(t,e,r)=>{if(!t)return e;const n=pi(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var C0=k0;const Ns=jr,Bo=Bn,A0=Ze,Do=hc,N0=gr,L0=Oh,x0=jh,T0=Hh,P0=Vh,$0=qh,O0=Zh,B0=Xh,D0=tf,j0=ut,F0=of,H0=lf,U0=li,V0=ff,W0=mf,z0=jn,q0=ui,J0=fc,G0=gc,Z0=di,Q0=hi,K0=pc,X0=jf,Y0=Fn(),e1=dt(),t1=Hn,r1=qf,n1=Qf,s1=e0,i1=n0,o1=o0,a1=fi,c1=m0,l1=y0,u1=_0,d1=M0,h1=C0;var f1={parse:N0,valid:L0,clean:x0,inc:T0,diff:P0,major:$0,minor:O0,patch:B0,prerelease:D0,compare:j0,rcompare:F0,compareLoose:H0,compareBuild:U0,sort:V0,rsort:W0,gt:z0,lt:q0,eq:J0,neq:G0,gte:Z0,lte:Q0,cmp:K0,coerce:X0,Comparator:Y0,Range:e1,satisfies:t1,toComparators:r1,maxSatisfying:n1,minSatisfying:s1,minVersion:i1,validRange:o1,outside:a1,gtr:c1,ltr:l1,intersects:u1,simplifyRange:d1,subset:h1,SemVer:A0,re:Ns.re,src:Ns.src,tokens:Ns.t,SEMVER_SPEC_VERSION:Bo.SEMVER_SPEC_VERSION,RELEASE_TYPES:Bo.RELEASE_TYPES,compareIdentifiers:Do.compareIdentifiers,rcompareIdentifiers:Do.rcompareIdentifiers};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.satisfiesVersionRange=t.gtRange=t.gtVersion=t.assertIsSemVerRange=t.assertIsSemVerVersion=t.isValidSemVerRange=t.isValidSemVerVersion=t.VersionRangeStruct=t.VersionStruct=void 0;const e=f1,r=Vt,n=Ve;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",S=>(0,e.valid)(S)===null?`Expected SemVer version, got "${S}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",S=>(0,e.validRange)(S)===null?`Expected SemVer range, got "${S}"`:!0);function i(S){return(0,r.is)(S,t.VersionStruct)}t.isValidSemVerVersion=i;function s(S){return(0,r.is)(S,t.VersionRangeStruct)}t.isValidSemVerRange=s;function c(S){(0,n.assertStruct)(S,t.VersionStruct)}t.assertIsSemVerVersion=c;function u(S){(0,n.assertStruct)(S,t.VersionRangeStruct)}t.assertIsSemVerRange=u;function d(S,E){return(0,e.gt)(S,E)}t.gtVersion=d;function h(S,E){return(0,e.gtr)(S,E)}t.gtRange=h;function y(S,E){return(0,e.satisfies)(S,E,{includePrerelease:!0})}t.satisfiesVersionRange=y})(lc);(function(t){var e=x&&x.__createBinding||(Object.create?function(n,i,s,c){c===void 0&&(c=s);var u=Object.getOwnPropertyDescriptor(i,s);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,c,u)}:function(n,i,s,c){c===void 0&&(c=s),n[c]=i[s]}),r=x&&x.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Ve,t),r(Br,t),r(W,t),r($n,t),r(yt,t),r(or,t),r(rc,t),r(Dr,t),r(nc,t),r(sc,t),r(ar,t),r(ic,t),r(bt,t),r(oc,t),r(ac,t),r(cc,t),r(lc,t)})(Ba);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=Ba;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(Oa);var vc=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.PollingBlockTracker=void 0;const g1=vc(Ys),p1=vc(Vu),m1=Tr,jo=Oa,Fo=(0,jo.createModuleLogger)(jo.projectLogger,"polling-block-tracker"),v1=(0,g1.default)(),w1=1e3;class y1 extends m1.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*w1,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=e.keepEventLoopActive===void 0?!0:e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const r=Ho(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: ${(e=r.stack)!==null&&e!==void 0?e:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Ho(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:v1(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),Fo("Making request",e);const r=await(0,p1.default)(n=>this._provider.sendAsync(e,n))();if(Fo("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: ${r.error.message}`);return r.result}}Tn.PollingBlockTracker=y1;function Ho(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}var Un={},b1=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.SubscribeBlockTracker=void 0;const _1=b1(Ys),E1=Tr,S1=(0,_1.default)();class M1 extends E1.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:S1(),method:e,params:r,jsonrpc:"2.0"},(s,c)=>{s?i(s):n(c.result)})})}_handleSubData(e,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}Un.SubscribeBlockTracker=M1;(function(t){var e=x&&x.__createBinding||(Object.create?function(n,i,s,c){c===void 0&&(c=s),Object.defineProperty(n,c,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,c){c===void 0&&(c=s),n[c]=i[s]}),r=x&&x.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(t,"__esModule",{value:!0}),r(Tn,t),r(Un,t)})($a);var mi={},Vn={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.getUniqueId=void 0;const wc=4294967295;let Ls=Math.floor(Math.random()*wc);function k1(){return Ls=(Ls+1)%wc,Ls}Fr.getUniqueId=k1;Object.defineProperty(Vn,"__esModule",{value:!0});Vn.createIdRemapMiddleware=void 0;const R1=Fr;function I1(){return(t,e,r,n)=>{const i=t.id,s=R1.getUniqueId();t.id=s,e.id=s,r(c=>{t.id=i,e.id=i,c()})}}Vn.createIdRemapMiddleware=I1;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.createAsyncMiddleware=void 0;function C1(t){return async(e,r,n,i)=>{let s;const c=new Promise(y=>{s=y});let u=null,d=!1;const h=async()=>{d=!0,n(y=>{u=y,s()}),await c};try{await t(e,r,h),d?(await c,u(null)):i(null)}catch(y){u?u(y):i(y)}}}Wn.createAsyncMiddleware=C1;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});zn.createScaffoldMiddleware=void 0;function A1(t){return(e,r,n,i)=>{const s=t[e.method];return s===void 0?n():typeof s=="function"?s(e,r,n,i):(r.result=s,i())}}zn.createScaffoldMiddleware=A1;var Hr={},vi={};Object.defineProperty(vi,"__esModule",{value:!0});const N1=ta;function Uo(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function L1(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([c]=r),c instanceof Error)throw c;const u=new Error(`Unhandled error.${c?` (${c.message})`:""}`);throw u.context=c,u}const s=i[e];if(s===void 0)return!1;if(typeof s=="function")Uo(s,this,r);else{const c=s.length,u=L1(s);for(let d=0;d"u"&&(n=_c()),js(t,"",0,[],void 0,0,n);var i;try{Bt.length===0?i=JSON.stringify(t,e,r):i=JSON.stringify(t,Sc(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ft.length!==0;){var s=Ft.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function tr(t,e,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:t}),Ft.push([n,r,e,i])):Bt.push([e,r,t]):(n[r]=t,Ft.push([n,r,e]))}function js(t,e,r,n,i,s,c){s+=1;var u;if(typeof t=="object"&&t!==null){for(u=0;uc.depthLimit){tr(sn,t,e,i);return}if(typeof c.edgesLimit<"u"&&r+1>c.edgesLimit){tr(sn,t,e,i);return}if(n.push(t),Array.isArray(t))for(u=0;ue?1:0}function Ec(t,e,r,n){typeof n>"u"&&(n=_c());var i=Fs(t,"",0,[],void 0,0,n)||t,s;try{Bt.length===0?s=JSON.stringify(i,e,r):s=JSON.stringify(i,Sc(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;Ft.length!==0;){var c=Ft.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function Fs(t,e,r,n,i,s,c){s+=1;var u;if(typeof t=="object"&&t!==null){for(u=0;uc.depthLimit){tr(sn,t,e,i);return}if(typeof c.edgesLimit<"u"&&r+1>c.edgesLimit){tr(sn,t,e,i);return}if(n.push(t),Array.isArray(t))for(u=0;u0)for(var n=0;n=1e3&&t<=4999}function D1(t,e){if(e!=="[Circular]")return e}var wi={},At={};Object.defineProperty(At,"__esModule",{value:!0});At.errorValues=At.errorCodes=void 0;At.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}};At.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=At,r=Ct,n=e.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:c(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function c(E,M=i){if(Number.isInteger(E)){const k=E.toString();if(S(e.errorValues,k))return e.errorValues[k].message;if(h(E))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return M}t.getMessageFromCode=c;function u(E){if(!Number.isInteger(E))return!1;const M=E.toString();return!!(e.errorValues[M]||h(E))}t.isValidCode=u;function d(E,{fallbackError:M=s,shouldIncludeStack:k=!1}={}){var T,O;if(!M||!Number.isInteger(M.code)||typeof M.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(E instanceof r.EthereumRpcError)return E.serialize();const B={};if(E&&typeof E=="object"&&!Array.isArray(E)&&S(E,"code")&&u(E.code)){const R=E;B.code=R.code,R.message&&typeof R.message=="string"?(B.message=R.message,S(R,"data")&&(B.data=R.data)):(B.message=c(B.code),B.data={originalError:y(E)})}else{B.code=M.code;const R=(T=E)===null||T===void 0?void 0:T.message;B.message=R&&typeof R=="string"?R:M.message,B.data={originalError:y(E)}}const L=(O=E)===null||O===void 0?void 0:O.stack;return k&&E&&L&&typeof L=="string"&&(B.stack=L),B}t.serializeError=d;function h(E){return E>=-32099&&E<=-32e3}function y(E){return E&&typeof E=="object"&&!Array.isArray(E)?Object.assign({},E):E}function S(E,M){return Object.prototype.hasOwnProperty.call(E,M)}})(wi);var qn={};Object.defineProperty(qn,"__esModule",{value:!0});qn.ethErrors=void 0;const yi=Ct,kc=wi,qe=At;qn.ethErrors={rpc:{parse:t=>nt(qe.errorCodes.rpc.parse,t),invalidRequest:t=>nt(qe.errorCodes.rpc.invalidRequest,t),invalidParams:t=>nt(qe.errorCodes.rpc.invalidParams,t),methodNotFound:t=>nt(qe.errorCodes.rpc.methodNotFound,t),internal:t=>nt(qe.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return nt(e,t)},invalidInput:t=>nt(qe.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>nt(qe.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>nt(qe.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>nt(qe.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>nt(qe.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>nt(qe.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>vr(qe.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>vr(qe.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>vr(qe.errorCodes.provider.unsupportedMethod,t),disconnected:t=>vr(qe.errorCodes.provider.disconnected,t),chainDisconnected:t=>vr(qe.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new yi.EthereumProviderError(e,r,n)}}};function nt(t,e){const[r,n]=Rc(e);return new yi.EthereumRpcError(t,r||kc.getMessageFromCode(t),n)}function vr(t,e){const[r,n]=Rc(e);return new yi.EthereumProviderError(t,r||kc.getMessageFromCode(t),n)}function Rc(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=Ct;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=wi;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=qn;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=At;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(yc);var j1=x&&x.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.JsonRpcEngine=void 0;const F1=j1(vi),st=yc;class _t extends F1.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?r?this._handleBatch(e,r):this._handleBatch(e):r?this._handle(e,r):this._promiseHandle(e)}asMiddleware(){return async(e,r,n,i)=>{try{const[s,c,u]=await _t._runAllMiddleware(e,r,this._middleware);return c?(await _t._runReturnHandlers(u),i(s)):n(async d=>{try{await _t._runReturnHandlers(u)}catch(h){return d(h)}return d()})}catch(s){return i(s)}}}async _handleBatch(e,r){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(e){return new Promise(r=>{this._handle(e,(n,i)=>{r(i)})})}async _handle(e,r){if(!e||Array.isArray(e)||typeof e!="object"){const c=new st.EthereumRpcError(st.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof e}`,{request:e});return r(c,{id:void 0,jsonrpc:"2.0",error:c})}if(typeof e.method!="string"){const c=new st.EthereumRpcError(st.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof e.method}`,{request:e});return r(c,{id:e.id,jsonrpc:"2.0",error:c})}const n=Object.assign({},e),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(c){s=c}return s&&(delete i.result,i.error||(i.error=st.serializeError(s))),r(s,i)}async _processRequest(e,r){const[n,i,s]=await _t._runAllMiddleware(e,r,this._middleware);if(_t._checkForCompletion(e,r,i),await _t._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(e,r,n){const i=[];let s=null,c=!1;for(const u of n)if([s,c]=await _t._runMiddleware(e,r,u,i),c)break;return[s,c,i.reverse()]}static _runMiddleware(e,r,n,i){return new Promise(s=>{const c=d=>{const h=d||r.error;h&&(r.error=st.serializeError(h)),s([h,!0])},u=d=>{r.error?c(r.error):(d&&(typeof d!="function"&&c(new st.EthereumRpcError(st.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof d}" for request: diff --git a/buddybook/assets/index-B-6Lwopd.js b/buddybook/assets/index-CP6_TFKv.js similarity index 95% rename from buddybook/assets/index-B-6Lwopd.js rename to buddybook/assets/index-CP6_TFKv.js index da539c3..ae27253 100644 --- a/buddybook/assets/index-B-6Lwopd.js +++ b/buddybook/assets/index-CP6_TFKv.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D2uqR4Ry.js","assets/hooks.module-D7M4pAco.js","assets/events-BzDGR98G.js","assets/inherits_browser-BwZ6FBWK.js","assets/index-FH8NN1-S.js","assets/index-Dz_NkDRB.js","assets/index.es-KLKTVizS.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-BNMaGkP5.js","./hooks.module-ClmD75_J.js","./events-0WpuQ3DP.js","./inherits_browser-C53US4G5.js","./index-BSVGFq6n.js","./index-D0eaAjbe.js","./index.es-DaAD1bdq.js"])))=>i.map(i=>d[i]); var lu=Object.defineProperty;var Fs=et=>{throw TypeError(et)};var uu=(et,o,tt)=>o in et?lu(et,o,{enumerable:!0,configurable:!0,writable:!0,value:tt}):et[o]=tt;var wt=(et,o,tt)=>uu(et,typeof o!="symbol"?o+"":o,tt),as=(et,o,tt)=>o.has(et)||Fs("Cannot "+tt);var Lt=(et,o,tt)=>(as(et,o,"read from private field"),tt?tt.call(et):o.get(et)),hr=(et,o,tt)=>o.has(et)?Fs("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(et):o.set(et,tt),ur=(et,o,tt,rt)=>(as(et,o,"write to private field"),rt?rt.call(et,tt):o.set(et,tt),tt),fr=(et,o,tt)=>(as(et,o,"access private method"),tt);var Cn=(et,o,tt,rt)=>({set _(nt){ur(et,o,nt,tt)},get _(){return Lt(et,o,rt)}});function _mergeNamespaces(et,o){for(var tt=0;ttrt[nt]})}}}return Object.freeze(Object.defineProperty(et,Symbol.toStringTag,{value:"Module"}))}(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const nt of document.querySelectorAll('link[rel="modulepreload"]'))rt(nt);new MutationObserver(nt=>{for(const ot of nt)if(ot.type==="childList")for(const it of ot.addedNodes)it.tagName==="LINK"&&it.rel==="modulepreload"&&rt(it)}).observe(document,{childList:!0,subtree:!0});function tt(nt){const ot={};return nt.integrity&&(ot.integrity=nt.integrity),nt.referrerPolicy&&(ot.referrerPolicy=nt.referrerPolicy),nt.crossOrigin==="use-credentials"?ot.credentials="include":nt.crossOrigin==="anonymous"?ot.credentials="omit":ot.credentials="same-origin",ot}function rt(nt){if(nt.ep)return;nt.ep=!0;const ot=tt(nt);fetch(nt.href,ot)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(et){return et&&et.__esModule&&Object.prototype.hasOwnProperty.call(et,"default")?et.default:et}function getAugmentedNamespace(et){if(et.__esModule)return et;var o=et.default;if(typeof o=="function"){var tt=function rt(){return this instanceof rt?Reflect.construct(o,arguments,this.constructor):o.apply(this,arguments)};tt.prototype=o.prototype}else tt={};return Object.defineProperty(tt,"__esModule",{value:!0}),Object.keys(et).forEach(function(rt){var nt=Object.getOwnPropertyDescriptor(et,rt);Object.defineProperty(tt,rt,nt.get?nt:{enumerable:!0,get:function(){return et[rt]}})}),tt}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js @@ -52,7 +52,7 @@ Error generating stack: `+ot.message+` `),{docsPath:tt,name:"InvalidAbiDecodingType"})}}class InvalidArrayError extends BaseError$3{constructor(o){super([`Value "${o}" is not a valid array.`].join(` `),{name:"InvalidArrayError"})}}class InvalidDefinitionTypeError extends BaseError$3{constructor(o){super([`"${o}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(` `),{name:"InvalidDefinitionTypeError"})}}function concat$6(et){return typeof et[0]=="string"?concatHex(et):concatBytes$3(et)}function concatBytes$3(et){let o=0;for(const nt of et)o+=nt.length;const tt=new Uint8Array(o);let rt=0;for(const nt of et)tt.set(nt,rt),rt+=nt.length;return tt}function concatHex(et){return`0x${et.reduce((o,tt)=>o+tt.replace("0x",""),"")}`}class InvalidAddressError extends BaseError$3{constructor({address:o}){super(`Address "${o}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class LruMap extends Map{constructor(o){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=o}get(o){const tt=super.get(o);return super.has(o)&&tt!==void 0&&(this.delete(o),super.set(o,tt)),tt}set(o,tt){if(super.set(o,tt),this.maxSize&&this.size>this.maxSize){const rt=this.keys().next().value;rt&&this.delete(rt)}return this}}function number$4(et){if(!Number.isSafeInteger(et)||et<0)throw new Error(`positive integer expected, not ${et}`)}function isBytes$3(et){return et instanceof Uint8Array||et!=null&&typeof et=="object"&&et.constructor.name==="Uint8Array"}function bytes$1(et,...o){if(!isBytes$3(et))throw new Error("Uint8Array expected");if(o.length>0&&!o.includes(et.length))throw new Error(`Uint8Array expected of length ${o}, not of length=${et.length}`)}function hash$1(et){if(typeof et!="function"||typeof et.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$4(et.outputLen),number$4(et.blockLen)}function exists$1(et,o=!0){if(et.destroyed)throw new Error("Hash instance has been destroyed");if(o&&et.finished)throw new Error("Hash#digest() has already been called")}function output$1(et,o){bytes$1(et);const tt=o.outputLen;if(et.length>_32n&U32_MASK64)}:{h:Number(et>>_32n&U32_MASK64)|0,l:Number(et&U32_MASK64)|0}}function split$1(et,o=!1){let tt=new Uint32Array(et.length),rt=new Uint32Array(et.length);for(let nt=0;ntBigInt(et>>>0)<<_32n|BigInt(o>>>0),shrSH=(et,o,tt)=>et>>>tt,shrSL=(et,o,tt)=>et<<32-tt|o>>>tt,rotrSH=(et,o,tt)=>et>>>tt|o<<32-tt,rotrSL=(et,o,tt)=>et<<32-tt|o>>>tt,rotrBH=(et,o,tt)=>et<<64-tt|o>>>tt-32,rotrBL=(et,o,tt)=>et>>>tt-32|o<<64-tt,rotr32H=(et,o)=>o,rotr32L=(et,o)=>et,rotlSH=(et,o,tt)=>et<>>32-tt,rotlSL=(et,o,tt)=>o<>>32-tt,rotlBH=(et,o,tt)=>o<>>64-tt,rotlBL=(et,o,tt)=>et<>>64-tt;function add(et,o,tt,rt){const nt=(o>>>0)+(rt>>>0);return{h:et+tt+(nt/2**32|0)|0,l:nt|0}}const add3L=(et,o,tt)=>(et>>>0)+(o>>>0)+(tt>>>0),add3H=(et,o,tt,rt)=>o+tt+rt+(et/2**32|0)|0,add4L=(et,o,tt,rt)=>(et>>>0)+(o>>>0)+(tt>>>0)+(rt>>>0),add4H=(et,o,tt,rt,nt)=>o+tt+rt+nt+(et/2**32|0)|0,add5L=(et,o,tt,rt,nt)=>(et>>>0)+(o>>>0)+(tt>>>0)+(rt>>>0)+(nt>>>0),add5H=(et,o,tt,rt,nt,ot)=>o+tt+rt+nt+ot+(et/2**32|0)|0,u64={fromBig,split:split$1,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u32$1=et=>new Uint32Array(et.buffer,et.byteOffset,Math.floor(et.byteLength/4)),createView$1=et=>new DataView(et.buffer,et.byteOffset,et.byteLength),rotr=(et,o)=>et<<32-o|et>>>o,isLE$1=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=et=>et<<24&4278190080|et<<8&16711680|et>>>8&65280|et>>>24&255;function byteSwap32(et){for(let o=0;oet().update(toBytes$2(rt)).digest(),tt=et();return o.outputLen=tt.outputLen,o.blockLen=tt.blockLen,o.create=()=>et(),o}function randomBytes$1(et=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(et));if(crypto$2&&typeof crypto$2.randomBytes=="function")return crypto$2.randomBytes(et);throw new Error("crypto.getRandomValues must be defined")}const SHA3_PI=[],SHA3_ROTL=[],_SHA3_IOTA=[],_0n$7=BigInt(0),_1n$9=BigInt(1),_2n$6=BigInt(2),_7n=BigInt(7),_256n=BigInt(256),_0x71n=BigInt(113);for(let et=0,o=_1n$9,tt=1,rt=0;et<24;et++){[tt,rt]=[rt,(2*tt+3*rt)%5],SHA3_PI.push(2*(5*rt+tt)),SHA3_ROTL.push((et+1)*(et+2)/2%64);let nt=_0n$7;for(let ot=0;ot<7;ot++)o=(o<<_1n$9^(o>>_7n)*_0x71n)%_256n,o&_2n$6&&(nt^=_1n$9<<(_1n$9<tt>32?rotlBH(et,o,tt):rotlSH(et,o,tt),rotlL=(et,o,tt)=>tt>32?rotlBL(et,o,tt):rotlSL(et,o,tt);function keccakP(et,o=24){const tt=new Uint32Array(10);for(let rt=24-o;rt<24;rt++){for(let it=0;it<10;it++)tt[it]=et[it]^et[it+10]^et[it+20]^et[it+30]^et[it+40];for(let it=0;it<10;it+=2){const st=(it+8)%10,at=(it+2)%10,ct=tt[at],lt=tt[at+1],dt=rotlH(ct,lt,1)^tt[st],ht=rotlL(ct,lt,1)^tt[st+1];for(let mt=0;mt<50;mt+=10)et[it+mt]^=dt,et[it+mt+1]^=ht}let nt=et[2],ot=et[3];for(let it=0;it<24;it++){const st=SHA3_ROTL[it],at=rotlH(nt,ot,st),ct=rotlL(nt,ot,st),lt=SHA3_PI[it];nt=et[lt],ot=et[lt+1],et[lt]=at,et[lt+1]=ct}for(let it=0;it<50;it+=10){for(let st=0;st<10;st++)tt[st]=et[it+st];for(let st=0;st<10;st++)et[it+st]^=~tt[(st+2)%10]&tt[(st+4)%10]}et[0]^=SHA3_IOTA_H[rt],et[1]^=SHA3_IOTA_L[rt]}tt.fill(0)}class Keccak extends Hash{constructor(o,tt,rt,nt=!1,ot=24){if(super(),this.blockLen=o,this.suffix=tt,this.outputLen=rt,this.enableXOF=nt,this.rounds=ot,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$4(rt),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32$1(this.state)}keccak(){isLE$1||byteSwap32(this.state32),keccakP(this.state32,this.rounds),isLE$1||byteSwap32(this.state32),this.posOut=0,this.pos=0}update(o){exists$1(this);const{blockLen:tt,state:rt}=this;o=toBytes$2(o);const nt=o.length;for(let ot=0;ot=rt&&this.keccak();const it=Math.min(rt-this.posOut,ot-nt);o.set(tt.subarray(this.posOut,this.posOut+it),nt),this.posOut+=it,nt+=it}return o}xofInto(o){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(o)}xof(o){return number$4(o),this.xofInto(new Uint8Array(o))}digestInto(o){if(output$1(o,this),this.finished)throw new Error("digest() was already called");return this.writeInto(o),this.destroy(),o}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(o){const{blockLen:tt,suffix:rt,outputLen:nt,rounds:ot,enableXOF:it}=this;return o||(o=new Keccak(tt,rt,nt,it,ot)),o.state32.set(this.state32),o.pos=this.pos,o.posOut=this.posOut,o.finished=this.finished,o.rounds=ot,o.suffix=rt,o.outputLen=nt,o.enableXOF=it,o.destroyed=this.destroyed,o}}const gen=(et,o,tt)=>wrapConstructor(()=>new Keccak(o,et,tt)),keccak_256=gen(1,136,256/8);function keccak256$1(et,o){const tt=o||"hex",rt=keccak_256(isHex(et,{strict:!1})?toBytes$3(et):et);return tt==="bytes"?rt:toHex(rt)}const checksumAddressCache=new LruMap(8192);function checksumAddress(et,o){if(checksumAddressCache.has(`${et}.${o}`))return checksumAddressCache.get(`${et}.${o}`);const tt=o?`${o}${et.toLowerCase()}`:et.substring(2).toLowerCase(),rt=keccak256$1(stringToBytes(tt),"bytes"),nt=(o?tt.substring(`${o}0x`.length):tt).split("");for(let it=0;it<40;it+=2)rt[it>>1]>>4>=8&&nt[it]&&(nt[it]=nt[it].toUpperCase()),(rt[it>>1]&15)>=8&&nt[it+1]&&(nt[it+1]=nt[it+1].toUpperCase());const ot=`0x${nt.join("")}`;return checksumAddressCache.set(`${et}.${o}`,ot),ot}function getAddress(et,o){if(!isAddress(et,{strict:!1}))throw new InvalidAddressError({address:et});return checksumAddress(et,o)}const addressRegex=/^0x[a-fA-F0-9]{40}$/,isAddressCache=new LruMap(8192);function isAddress(et,o){const{strict:tt=!0}=o??{},rt=`${et}.${tt}`;if(isAddressCache.has(rt))return isAddressCache.get(rt);const nt=addressRegex.test(et)?et.toLowerCase()===et?!0:tt?checksumAddress(et)===et:!0:!1;return isAddressCache.set(rt,nt),nt}function slice(et,o,tt,{strict:rt}={}){return isHex(et,{strict:!1})?sliceHex(et,o,tt,{strict:rt}):sliceBytes(et,o,tt,{strict:rt})}function assertStartOffset(et,o){if(typeof o=="number"&&o>0&&o>size$2(et)-1)throw new SliceOffsetOutOfBoundsError({offset:o,position:"start",size:size$2(et)})}function assertEndOffset(et,o,tt){if(typeof o=="number"&&typeof tt=="number"&&size$2(et)!==tt-o)throw new SliceOffsetOutOfBoundsError({offset:tt,position:"end",size:size$2(et)})}function sliceBytes(et,o,tt,{strict:rt}={}){assertStartOffset(et,o);const nt=et.slice(o,tt);return rt&&assertEndOffset(nt,o,tt),nt}function sliceHex(et,o,tt,{strict:rt}={}){assertStartOffset(et,o);const nt=`0x${et.replace("0x","").slice((o??0)*2,(tt??et.length)*2)}`;return rt&&assertEndOffset(nt,o,tt),nt}function encodeAbiParameters(et,o){if(et.length!==o.length)throw new AbiEncodingLengthMismatchError({expectedLength:et.length,givenLength:o.length});const tt=prepareParams({params:et,values:o}),rt=encodeParams(tt);return rt.length===0?"0x":rt}function prepareParams({params:et,values:o}){const tt=[];for(let rt=0;rt0?concat$6([st,it]):st}}if(nt)return{dynamic:!0,encoded:it}}return{dynamic:!1,encoded:concat$6(ot.map(({encoded:it})=>it))}}function encodeBytes(et,{param:o}){const[,tt]=o.type.split("bytes"),rt=size$2(et);if(!tt){let nt=et;return rt%32!==0&&(nt=padHex(nt,{dir:"right",size:Math.ceil((et.length-2)/2/32)*32})),{dynamic:!0,encoded:concat$6([padHex(numberToHex(rt,{size:32})),nt])}}if(rt!==Number.parseInt(tt))throw new AbiEncodingBytesSizeMismatchError({expectedSize:Number.parseInt(tt),value:et});return{dynamic:!1,encoded:padHex(et,{dir:"right"})}}function encodeBool(et){if(typeof et!="boolean")throw new BaseError$3(`Invalid boolean value: "${et}" (type: ${typeof et}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:padHex(boolToHex(et))}}function encodeNumber(et,{signed:o}){return{dynamic:!1,encoded:numberToHex(et,{size:32,signed:o})}}function encodeString(et){const o=stringToHex(et),tt=Math.ceil(size$2(o)/32),rt=[];for(let nt=0;ntnt))}}function getArrayComponents(et){const o=et.match(/^(.*)\[(\d+)?\]$/);return o?[o[2]?Number(o[2]):null,o[1]]:void 0}const docsPath$2="/docs/contract/encodeDeployData";function encodeDeployData(et){const{abi:o,args:tt,bytecode:rt}=et;if(!tt||tt.length===0)return rt;const nt=o.find(it=>"type"in it&&it.type==="constructor");if(!nt)throw new AbiConstructorNotFoundError({docsPath:docsPath$2});if(!("inputs"in nt))throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});if(!nt.inputs||nt.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$2});const ot=encodeAbiParameters(nt.inputs,tt);return concatHex([rt,ot])}function parseAccount(et){return typeof et=="string"?{address:et,type:"json-rpc"}:et}class AccountNotFoundError extends BaseError$3{constructor({docsPath:o}={}){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 Client."].join(` -`),{docsPath:o,docsSlug:"account",name:"AccountNotFoundError"})}}const scriptRel="modulepreload",assetsURL=function(et){return"/"+et},seen={},__vitePreload=function(o,tt,rt){let nt=Promise.resolve();if(tt&&tt.length>0){document.getElementsByTagName("link");const it=document.querySelector("meta[property=csp-nonce]"),st=(it==null?void 0:it.nonce)||(it==null?void 0:it.getAttribute("nonce"));nt=Promise.allSettled(tt.map(at=>{if(at=assetsURL(at),at in seen)return;seen[at]=!0;const ct=at.endsWith(".css"),lt=ct?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${at}"]${lt}`))return;const dt=document.createElement("link");if(dt.rel=ct?"stylesheet":scriptRel,ct||(dt.as="script"),dt.crossOrigin="",dt.href=at,st&&dt.setAttribute("nonce",st),document.head.appendChild(dt),ct)return new Promise((ht,mt)=>{dt.addEventListener("load",ht),dt.addEventListener("error",()=>mt(new Error(`Unable to preload CSS for ${at}`)))})}))}function ot(it){const st=new Event("vite:preloadError",{cancelable:!0});if(st.payload=it,window.dispatchEvent(st),!st.defaultPrevented)throw it}return nt.then(it=>{for(const st of it||[])st.status==="rejected"&&ot(st.reason);return o().catch(ot)})};class NegativeOffsetError extends BaseError$3{constructor({offset:o}){super(`Offset \`${o}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError$3{constructor({length:o,position:tt}){super(`Position \`${tt}\` is out of bounds (\`0 < position < ${o}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError$3{constructor({count:o,limit:tt}){super(`Recursive read limit of \`${tt}\` exceeded (recursive read count: \`${o}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={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 RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(et){if(et<0||et>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:et})},decrementPosition(et){if(et<0)throw new NegativeOffsetError({offset:et});const o=this.position-et;this.assertPosition(o),this.position=o},getReadCount(et){return this.positionReadCount.get(et||this.position)||0},incrementPosition(et){if(et<0)throw new NegativeOffsetError({offset:et});const o=this.position+et;this.assertPosition(o),this.position=o},inspectByte(et){const o=et??this.position;return this.assertPosition(o),this.bytes[o]},inspectBytes(et,o){const tt=o??this.position;return this.assertPosition(tt+et-1),this.bytes.subarray(tt,tt+et)},inspectUint8(et){const o=et??this.position;return this.assertPosition(o),this.bytes[o]},inspectUint16(et){const o=et??this.position;return this.assertPosition(o+1),this.dataView.getUint16(o)},inspectUint24(et){const o=et??this.position;return this.assertPosition(o+2),(this.dataView.getUint16(o)<<8)+this.dataView.getUint8(o+2)},inspectUint32(et){const o=et??this.position;return this.assertPosition(o+3),this.dataView.getUint32(o)},pushByte(et){this.assertPosition(this.position),this.bytes[this.position]=et,this.position++},pushBytes(et){this.assertPosition(this.position+et.length-1),this.bytes.set(et,this.position),this.position+=et.length},pushUint8(et){this.assertPosition(this.position),this.bytes[this.position]=et,this.position++},pushUint16(et){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,et),this.position+=2},pushUint24(et){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,et>>8),this.dataView.setUint8(this.position+2,et&255),this.position+=3},pushUint32(et){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,et),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const et=this.inspectByte();return this.position++,et},readBytes(et,o){this.assertReadLimit(),this._touch();const tt=this.inspectBytes(et);return this.position+=o??et,tt},readUint8(){this.assertReadLimit(),this._touch();const et=this.inspectUint8();return this.position+=1,et},readUint16(){this.assertReadLimit(),this._touch();const et=this.inspectUint16();return this.position+=2,et},readUint24(){this.assertReadLimit(),this._touch();const et=this.inspectUint24();return this.position+=3,et},readUint32(){this.assertReadLimit(),this._touch();const et=this.inspectUint32();return this.position+=4,et},get remaining(){return this.bytes.length-this.position},setPosition(et){const o=this.position;return this.assertPosition(et),this.position=et,()=>this.position=o},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const et=this.getReadCount();this.positionReadCount.set(this.position,et+1),et>0&&this.recursiveReadCount++}};function createCursor(et,{recursiveReadLimit:o=8192}={}){const tt=Object.create(staticCursor);return tt.bytes=et,tt.dataView=new DataView(et.buffer,et.byteOffset,et.byteLength),tt.positionReadCount=new Map,tt.recursiveReadLimit=o,tt}function toRlp(et,o="hex"){const tt=getEncodable(et),rt=createCursor(new Uint8Array(tt.length));return tt.encode(rt),o==="hex"?bytesToHex$3(rt.bytes):rt.bytes}function getEncodable(et){return Array.isArray(et)?getEncodableList(et.map(o=>getEncodable(o))):getEncodableBytes(et)}function getEncodableList(et){const o=et.reduce((nt,ot)=>nt+ot.length,0),tt=getSizeOfLength(o);return{length:o<=55?1+o:1+tt+o,encode(nt){o<=55?nt.pushByte(192+o):(nt.pushByte(247+tt),tt===1?nt.pushUint8(o):tt===2?nt.pushUint16(o):tt===3?nt.pushUint24(o):nt.pushUint32(o));for(const{encode:ot}of et)ot(nt)}}}function getEncodableBytes(et){const o=typeof et=="string"?hexToBytes$3(et):et,tt=getSizeOfLength(o.length);return{length:o.length===1&&o[0]<128?1:o.length<=55?1+o.length:1+tt+o.length,encode(nt){o.length===1&&o[0]<128?nt.pushBytes(o):o.length<=55?(nt.pushByte(128+o.length),nt.pushBytes(o)):(nt.pushByte(183+tt),tt===1?nt.pushUint8(o.length):tt===2?nt.pushUint16(o.length):tt===3?nt.pushUint24(o.length):nt.pushUint32(o.length),nt.pushBytes(o))}}}function getSizeOfLength(et){if(et<2**8)return 1;if(et<2**16)return 2;if(et<2**24)return 3;if(et<2**32)return 4;throw new BaseError$3("Length is too large.")}class ChainDoesNotSupportContract extends BaseError$3{constructor({blockNumber:o,chain:tt,contract:rt}){super(`Chain "${tt.name}" does not support contract "${rt.name}".`,{metaMessages:["This could be due to any of the following:",...o&&rt.blockCreated&&rt.blockCreated>o?[`- The contract "${rt.name}" was not deployed until block ${rt.blockCreated} (current block ${o}).`]:[`- The chain does not have the contract "${rt.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ClientChainNotConfiguredError extends BaseError$3{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError$3{constructor({chainId:o}){super(typeof o=="number"?`Chain ID "${o}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9},weiUnits={ether:-18,gwei:-9};function formatUnits(et,o){let tt=et.toString();const rt=tt.startsWith("-");rt&&(tt=tt.slice(1)),tt=tt.padStart(o,"0");let[nt,ot]=[tt.slice(0,tt.length-o),tt.slice(tt.length-o)];return ot=ot.replace(/(0+)$/,""),`${rt?"-":""}${nt||"0"}${ot?`.${ot}`:""}`}function formatGwei(et,o="wei"){return formatUnits(et,gweiUnits[o])}class ExecutionRevertedError extends BaseError$3{constructor({cause:o,message:tt}={}){var nt;const rt=(nt=tt==null?void 0:tt.replace("execution reverted: ",""))==null?void 0:nt.replace("execution reverted","");super(`Execution reverted ${rt?`with reason: ${rt}`:"for an unknown reason"}.`,{cause:o,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError$3{constructor({cause:o,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:o,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"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 FeeCapTooLowError extends BaseError$3{constructor({cause:o,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)}`:""} gwei) cannot be lower than the block base fee.`,{cause:o,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"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 NonceTooHighError extends BaseError$3{constructor({cause:o,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}is higher than the next one expected.`,{cause:o,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError$3{constructor({cause:o,nonce:tt}={}){super([`Nonce provided for the transaction ${tt?`(${tt}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` +`),{docsPath:o,docsSlug:"account",name:"AccountNotFoundError"})}}const scriptRel="modulepreload",assetsURL=function(et,o){return new URL(et,o).href},seen={},__vitePreload=function(o,tt,rt){let nt=Promise.resolve();if(tt&&tt.length>0){const it=document.getElementsByTagName("link"),st=document.querySelector("meta[property=csp-nonce]"),at=(st==null?void 0:st.nonce)||(st==null?void 0:st.getAttribute("nonce"));nt=Promise.allSettled(tt.map(ct=>{if(ct=assetsURL(ct,rt),ct in seen)return;seen[ct]=!0;const lt=ct.endsWith(".css"),dt=lt?'[rel="stylesheet"]':"";if(!!rt)for(let ft=it.length-1;ft>=0;ft--){const pt=it[ft];if(pt.href===ct&&(!lt||pt.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${ct}"]${dt}`))return;const mt=document.createElement("link");if(mt.rel=lt?"stylesheet":scriptRel,lt||(mt.as="script"),mt.crossOrigin="",mt.href=ct,at&&mt.setAttribute("nonce",at),document.head.appendChild(mt),lt)return new Promise((ft,pt)=>{mt.addEventListener("load",ft),mt.addEventListener("error",()=>pt(new Error(`Unable to preload CSS for ${ct}`)))})}))}function ot(it){const st=new Event("vite:preloadError",{cancelable:!0});if(st.payload=it,window.dispatchEvent(st),!st.defaultPrevented)throw it}return nt.then(it=>{for(const st of it||[])st.status==="rejected"&&ot(st.reason);return o().catch(ot)})};class NegativeOffsetError extends BaseError$3{constructor({offset:o}){super(`Offset \`${o}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class PositionOutOfBoundsError extends BaseError$3{constructor({length:o,position:tt}){super(`Position \`${tt}\` is out of bounds (\`0 < position < ${o}\`).`,{name:"PositionOutOfBoundsError"})}}class RecursiveReadLimitExceededError extends BaseError$3{constructor({count:o,limit:tt}){super(`Recursive read limit of \`${tt}\` exceeded (recursive read count: \`${o}\`).`,{name:"RecursiveReadLimitExceededError"})}}const staticCursor={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 RecursiveReadLimitExceededError({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(et){if(et<0||et>this.bytes.length-1)throw new PositionOutOfBoundsError({length:this.bytes.length,position:et})},decrementPosition(et){if(et<0)throw new NegativeOffsetError({offset:et});const o=this.position-et;this.assertPosition(o),this.position=o},getReadCount(et){return this.positionReadCount.get(et||this.position)||0},incrementPosition(et){if(et<0)throw new NegativeOffsetError({offset:et});const o=this.position+et;this.assertPosition(o),this.position=o},inspectByte(et){const o=et??this.position;return this.assertPosition(o),this.bytes[o]},inspectBytes(et,o){const tt=o??this.position;return this.assertPosition(tt+et-1),this.bytes.subarray(tt,tt+et)},inspectUint8(et){const o=et??this.position;return this.assertPosition(o),this.bytes[o]},inspectUint16(et){const o=et??this.position;return this.assertPosition(o+1),this.dataView.getUint16(o)},inspectUint24(et){const o=et??this.position;return this.assertPosition(o+2),(this.dataView.getUint16(o)<<8)+this.dataView.getUint8(o+2)},inspectUint32(et){const o=et??this.position;return this.assertPosition(o+3),this.dataView.getUint32(o)},pushByte(et){this.assertPosition(this.position),this.bytes[this.position]=et,this.position++},pushBytes(et){this.assertPosition(this.position+et.length-1),this.bytes.set(et,this.position),this.position+=et.length},pushUint8(et){this.assertPosition(this.position),this.bytes[this.position]=et,this.position++},pushUint16(et){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,et),this.position+=2},pushUint24(et){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,et>>8),this.dataView.setUint8(this.position+2,et&255),this.position+=3},pushUint32(et){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,et),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const et=this.inspectByte();return this.position++,et},readBytes(et,o){this.assertReadLimit(),this._touch();const tt=this.inspectBytes(et);return this.position+=o??et,tt},readUint8(){this.assertReadLimit(),this._touch();const et=this.inspectUint8();return this.position+=1,et},readUint16(){this.assertReadLimit(),this._touch();const et=this.inspectUint16();return this.position+=2,et},readUint24(){this.assertReadLimit(),this._touch();const et=this.inspectUint24();return this.position+=3,et},readUint32(){this.assertReadLimit(),this._touch();const et=this.inspectUint32();return this.position+=4,et},get remaining(){return this.bytes.length-this.position},setPosition(et){const o=this.position;return this.assertPosition(et),this.position=et,()=>this.position=o},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const et=this.getReadCount();this.positionReadCount.set(this.position,et+1),et>0&&this.recursiveReadCount++}};function createCursor(et,{recursiveReadLimit:o=8192}={}){const tt=Object.create(staticCursor);return tt.bytes=et,tt.dataView=new DataView(et.buffer,et.byteOffset,et.byteLength),tt.positionReadCount=new Map,tt.recursiveReadLimit=o,tt}function toRlp(et,o="hex"){const tt=getEncodable(et),rt=createCursor(new Uint8Array(tt.length));return tt.encode(rt),o==="hex"?bytesToHex$3(rt.bytes):rt.bytes}function getEncodable(et){return Array.isArray(et)?getEncodableList(et.map(o=>getEncodable(o))):getEncodableBytes(et)}function getEncodableList(et){const o=et.reduce((nt,ot)=>nt+ot.length,0),tt=getSizeOfLength(o);return{length:o<=55?1+o:1+tt+o,encode(nt){o<=55?nt.pushByte(192+o):(nt.pushByte(247+tt),tt===1?nt.pushUint8(o):tt===2?nt.pushUint16(o):tt===3?nt.pushUint24(o):nt.pushUint32(o));for(const{encode:ot}of et)ot(nt)}}}function getEncodableBytes(et){const o=typeof et=="string"?hexToBytes$3(et):et,tt=getSizeOfLength(o.length);return{length:o.length===1&&o[0]<128?1:o.length<=55?1+o.length:1+tt+o.length,encode(nt){o.length===1&&o[0]<128?nt.pushBytes(o):o.length<=55?(nt.pushByte(128+o.length),nt.pushBytes(o)):(nt.pushByte(183+tt),tt===1?nt.pushUint8(o.length):tt===2?nt.pushUint16(o.length):tt===3?nt.pushUint24(o.length):nt.pushUint32(o.length),nt.pushBytes(o))}}}function getSizeOfLength(et){if(et<2**8)return 1;if(et<2**16)return 2;if(et<2**24)return 3;if(et<2**32)return 4;throw new BaseError$3("Length is too large.")}class ChainDoesNotSupportContract extends BaseError$3{constructor({blockNumber:o,chain:tt,contract:rt}){super(`Chain "${tt.name}" does not support contract "${rt.name}".`,{metaMessages:["This could be due to any of the following:",...o&&rt.blockCreated&&rt.blockCreated>o?[`- The contract "${rt.name}" was not deployed until block ${rt.blockCreated} (current block ${o}).`]:[`- The chain does not have the contract "${rt.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ClientChainNotConfiguredError extends BaseError$3{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError$3{constructor({chainId:o}){super(typeof o=="number"?`Chain ID "${o}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const etherUnits={gwei:9,wei:18},gweiUnits={ether:-9,wei:9},weiUnits={ether:-18,gwei:-9};function formatUnits(et,o){let tt=et.toString();const rt=tt.startsWith("-");rt&&(tt=tt.slice(1)),tt=tt.padStart(o,"0");let[nt,ot]=[tt.slice(0,tt.length-o),tt.slice(tt.length-o)];return ot=ot.replace(/(0+)$/,""),`${rt?"-":""}${nt||"0"}${ot?`.${ot}`:""}`}function formatGwei(et,o="wei"){return formatUnits(et,gweiUnits[o])}class ExecutionRevertedError extends BaseError$3{constructor({cause:o,message:tt}={}){var nt;const rt=(nt=tt==null?void 0:tt.replace("execution reverted: ",""))==null?void 0:nt.replace("execution reverted","");super(`Execution reverted ${rt?`with reason: ${rt}`:"for an unknown reason"}.`,{cause:o,name:"ExecutionRevertedError"})}}Object.defineProperty(ExecutionRevertedError,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(ExecutionRevertedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class FeeCapTooHighError extends BaseError$3{constructor({cause:o,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:o,name:"FeeCapTooHighError"})}}Object.defineProperty(FeeCapTooHighError,"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 FeeCapTooLowError extends BaseError$3{constructor({cause:o,maxFeePerGas:tt}={}){super(`The fee cap (\`maxFeePerGas\`${tt?` = ${formatGwei(tt)}`:""} gwei) cannot be lower than the block base fee.`,{cause:o,name:"FeeCapTooLowError"})}}Object.defineProperty(FeeCapTooLowError,"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 NonceTooHighError extends BaseError$3{constructor({cause:o,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}is higher than the next one expected.`,{cause:o,name:"NonceTooHighError"})}}Object.defineProperty(NonceTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class NonceTooLowError extends BaseError$3{constructor({cause:o,nonce:tt}={}){super([`Nonce provided for the transaction ${tt?`(${tt}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(` `),{cause:o,name:"NonceTooLowError"})}}Object.defineProperty(NonceTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class NonceMaxValueError extends BaseError$3{constructor({cause:o,nonce:tt}={}){super(`Nonce provided for the transaction ${tt?`(${tt}) `:""}exceeds the maximum allowed nonce.`,{cause:o,name:"NonceMaxValueError"})}}Object.defineProperty(NonceMaxValueError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class InsufficientFundsError extends BaseError$3{constructor({cause:o}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(` `),{cause:o,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."],name:"InsufficientFundsError"})}}Object.defineProperty(InsufficientFundsError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class IntrinsicGasTooHighError extends BaseError$3{constructor({cause:o,gas:tt}={}){super(`The amount of gas ${tt?`(${tt}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:o,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(IntrinsicGasTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class IntrinsicGasTooLowError extends BaseError$3{constructor({cause:o,gas:tt}={}){super(`The amount of gas ${tt?`(${tt}) `:""}provided for the transaction is too low.`,{cause:o,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(IntrinsicGasTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class TransactionTypeNotSupportedError extends BaseError$3{constructor({cause:o}){super("The transaction type is not supported for this chain.",{cause:o,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(TransactionTypeNotSupportedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class TipAboveFeeCapError extends BaseError$3{constructor({cause:o,maxPriorityFeePerGas:tt,maxFeePerGas:rt}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${tt?` = ${formatGwei(tt)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${rt?` = ${formatGwei(rt)} gwei`:""}).`].join(` `),{cause:o,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"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 UnknownNodeError extends BaseError$3{constructor({cause:o}){super(`An error occurred while executing: ${o==null?void 0:o.shortMessage}`,{cause:o,name:"UnknownNodeError"})}}function formatEther(et,o="wei"){return formatUnits(et,etherUnits[o])}function prettyPrint(et){const o=Object.entries(et).map(([rt,nt])=>nt===void 0||nt===!1?null:[rt,nt]).filter(Boolean),tt=o.reduce((rt,[nt])=>Math.max(rt,nt.length),0);return o.map(([rt,nt])=>` ${`${rt}:`.padEnd(tt+1)} ${nt}`).join(` @@ -70,8 +70,8 @@ Error generating stack: `+ot.message+` `).slice(0,-1)}function serializeStateMapping(et){if(!(!et||et.length===0))return et.reduce((o,{slot:tt,value:rt})=>{if(tt.length!==66)throw new InvalidBytesLengthError({size:tt.length,targetSize:66,type:"hex"});if(rt.length!==66)throw new InvalidBytesLengthError({size:rt.length,targetSize:66,type:"hex"});return o[tt]=rt,o},{})}function serializeAccountStateOverride(et){const{balance:o,nonce:tt,state:rt,stateDiff:nt,code:ot}=et,it={};if(ot!==void 0&&(it.code=ot),o!==void 0&&(it.balance=numberToHex(o)),tt!==void 0&&(it.nonce=numberToHex(tt)),rt!==void 0&&(it.state=serializeStateMapping(rt)),nt!==void 0){if(it.state)throw new StateAssignmentConflictError;it.stateDiff=serializeStateMapping(nt)}return it}function serializeStateOverride(et){if(!et)return;const o={};for(const{address:tt,...rt}of et){if(!isAddress(tt,{strict:!1}))throw new InvalidAddressError({address:tt});if(o[tt])throw new AccountStateConflictError({address:tt});o[tt]=serializeAccountStateOverride(rt)}return o}async function getBalance$1(et,{address:o,blockNumber:tt,blockTag:rt="latest"}){const nt=tt?numberToHex(tt):void 0,ot=await et.request({method:"eth_getBalance",params:[o,nt||rt]});return BigInt(ot)}function blobsToCommitments(et){const{kzg:o}=et,tt=et.to??(typeof et.blobs[0]=="string"?"hex":"bytes"),rt=typeof et.blobs[0]=="string"?et.blobs.map(ot=>hexToBytes$3(ot)):et.blobs,nt=[];for(const ot of rt)nt.push(Uint8Array.from(o.blobToKzgCommitment(ot)));return tt==="bytes"?nt:nt.map(ot=>bytesToHex$3(ot))}function blobsToProofs(et){const{kzg:o}=et,tt=et.to??(typeof et.blobs[0]=="string"?"hex":"bytes"),rt=typeof et.blobs[0]=="string"?et.blobs.map(it=>hexToBytes$3(it)):et.blobs,nt=typeof et.commitments[0]=="string"?et.commitments.map(it=>hexToBytes$3(it)):et.commitments,ot=[];for(let it=0;itbytesToHex$3(it))}function setBigUint64$1(et,o,tt,rt){if(typeof et.setBigUint64=="function")return et.setBigUint64(o,tt,rt);const nt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>nt&ot),st=Number(tt&ot),at=rt?4:0,ct=rt?0:4;et.setUint32(o+at,it,rt),et.setUint32(o+ct,st,rt)}const Chi=(et,o,tt)=>et&o^~et&tt,Maj=(et,o,tt)=>et&o^et&tt^o&tt;class HashMD extends Hash{constructor(o,tt,rt,nt){super(),this.blockLen=o,this.outputLen=tt,this.padOffset=rt,this.isLE=nt,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(o),this.view=createView$1(this.buffer)}update(o){exists$1(this);const{view:tt,buffer:rt,blockLen:nt}=this;o=toBytes$2(o);const ot=o.length;for(let it=0;itnt-it&&(this.process(rt,0),it=0);for(let dt=it;dtlt.length)throw new Error("_sha2: outputLen bigger than state");for(let dt=0;dt>>3,pt=rotr(mt,17)^rotr(mt,19)^mt>>>10;SHA256_W[dt]=pt+SHA256_W[dt-7]+ft+SHA256_W[dt-16]|0}let{A:rt,B:nt,C:ot,D:it,E:st,F:at,G:ct,H:lt}=this;for(let dt=0;dt<64;dt++){const ht=rotr(st,6)^rotr(st,11)^rotr(st,25),mt=lt+ht+Chi(st,at,ct)+SHA256_K[dt]+SHA256_W[dt]|0,pt=(rotr(rt,2)^rotr(rt,13)^rotr(rt,22))+Maj(rt,nt,ot)|0;lt=ct,ct=at,at=st,st=it+mt|0,it=ot,ot=nt,nt=rt,rt=mt+pt|0}rt=rt+this.A|0,nt=nt+this.B|0,ot=ot+this.C|0,it=it+this.D|0,st=st+this.E|0,at=at+this.F|0,ct=ct+this.G|0,lt=lt+this.H|0,this.set(rt,nt,ot,it,st,at,ct,lt)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256$3=wrapConstructor(()=>new SHA256);function sha256$2(et,o){return sha256$3(isHex(et,{strict:!1})?toBytes$3(et):et)}function commitmentToVersionedHash(et){const{commitment:o,version:tt=1}=et,rt=et.to??(typeof o=="string"?"hex":"bytes"),nt=sha256$2(o);return nt.set([tt],0),rt==="bytes"?nt:bytesToHex$3(nt)}function commitmentsToVersionedHashes(et){const{commitments:o,version:tt}=et,rt=et.to??(typeof o[0]=="string"?"hex":"bytes"),nt=[];for(const ot of o)nt.push(commitmentToVersionedHash({commitment:ot,to:rt,version:tt}));return nt}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError$3{constructor({maxSize:o,size:tt}){super("Blob size is too large.",{metaMessages:[`Max: ${o} bytes`,`Given: ${tt} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError$3{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError$3{constructor({hash:o,size:tt}){super(`Versioned hash "${o}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${tt}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError$3{constructor({hash:o,version:tt}){super(`Versioned hash "${o}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${tt}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(et){const o=et.to??(typeof et.data=="string"?"hex":"bytes"),tt=typeof et.data=="string"?hexToBytes$3(et.data):et.data,rt=size$2(tt);if(!rt)throw new EmptyBlobError;if(rt>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:rt});const nt=[];let ot=!0,it=0;for(;ot;){const st=createCursor(new Uint8Array(bytesPerBlob));let at=0;for(;atst.bytes):nt.map(st=>bytesToHex$3(st.bytes))}function toBlobSidecars(et){const{data:o,kzg:tt,to:rt}=et,nt=et.blobs??toBlobs({data:o,to:rt}),ot=et.commitments??blobsToCommitments({blobs:nt,kzg:tt,to:rt}),it=et.proofs??blobsToProofs({blobs:nt,commitments:ot,kzg:tt,to:rt}),st=[];for(let at=0;at1||tt[0]>1)throw new InvalidBytesBooleanError(tt);return!!tt[0]}function bytesToNumber$1(et,o={}){typeof o.size<"u"&&assertSize(et,{size:o.size});const tt=bytesToHex$3(et,o);return hexToNumber$2(tt,o)}function bytesToString(et,o={}){let tt=et;return typeof o.size<"u"&&(assertSize(tt,{size:o.size}),tt=trim$1(tt,{dir:"right"})),new TextDecoder().decode(tt)}function decodeAbiParameters(et,o){const tt=typeof o=="string"?hexToBytes$3(o):o,rt=createCursor(tt);if(size$2(tt)===0&&et.length>0)throw new AbiDecodingZeroDataError;if(size$2(o)&&size$2(o)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof o=="string"?o:bytesToHex$3(o),params:et,size:size$2(o)});let nt=0;const ot=[];for(let it=0;it48?bytesToBigInt(nt,{signed:tt}):bytesToNumber$1(nt,{signed:tt}),32]}function decodeTuple(et,o,{staticPosition:tt}){const rt=o.components.length===0||o.components.some(({name:it})=>!it),nt=rt?[]:{};let ot=0;if(hasDynamicChild(o)){const it=bytesToNumber$1(et.readBytes(sizeOfOffset)),st=tt+it;for(let at=0;atkeccak256$1(toBytes$3(et));function hashSignature(et){return hash(et)}const version$7="1.0.6";let BaseError$2=class ks extends Error{constructor(o,tt={}){var it;const rt=tt.cause instanceof ks?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,nt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=[o||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...nt?[`Docs: https://abitype.dev${nt}`]:[],...rt?[`Details: ${rt}`]:[],`Version: abitype@${version$7}`].join(` `);super(ot),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"}),tt.cause&&(this.cause=tt.cause),this.details=rt,this.docsPath=nt,this.metaMessages=tt.metaMessages,this.shortMessage=o}};function execTyped(et,o){const tt=et.exec(o);return tt==null?void 0:tt.groups}const bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^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)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(et){let o=et.type;if(tupleRegex.test(et.type)&&"components"in et){o="(";const tt=et.components.length;for(let nt=0;nt[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(et){return errorSignatureRegex.test(et)}function execErrorSignature(et){return execTyped(errorSignatureRegex,et)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(et){return eventSignatureRegex.test(et)}function execEventSignature(et){return execTyped(eventSignatureRegex,et)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(et){return functionSignatureRegex.test(et)}function execFunctionSignature(et){return execTyped(functionSignatureRegex,et)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(et){return structSignatureRegex.test(et)}function execStructSignature(et){return execTyped(structSignatureRegex,et)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(et){return constructorSignatureRegex.test(et)}function execConstructorSignature(et){return execTyped(constructorSignatureRegex,et)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(et){return fallbackSignatureRegex.test(et)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(et){return receiveSignatureRegex.test(et)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$2{constructor({type:o}){super("Unknown type.",{metaMessages:[`Type "${o}" 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 UnknownSolidityTypeError extends BaseError$2{constructor({type:o}){super("Unknown type.",{metaMessages:[`Type "${o}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidParameterError extends BaseError$2{constructor({param:o}){super("Invalid ABI parameter.",{details:o}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$2{constructor({param:o,name:tt}){super("Invalid ABI parameter.",{details:o,metaMessages:[`"${tt}" 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 InvalidModifierError extends BaseError$2{constructor({param:o,type:tt,modifier:rt}){super("Invalid ABI parameter.",{details:o,metaMessages:[`Modifier "${rt}" not allowed${tt?` in "${tt}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$2{constructor({param:o,type:tt,modifier:rt}){super("Invalid ABI parameter.",{details:o,metaMessages:[`Modifier "${rt}" not allowed${tt?` in "${tt}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${rt}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$2{constructor({abiParameter:o}){super("Invalid ABI parameter.",{details:JSON.stringify(o,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}let InvalidSignatureError$1=class extends BaseError$2{constructor({signature:o,type:tt}){super(`Invalid ${tt} signature.`,{details:o}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class UnknownSignatureError extends BaseError$2{constructor({signature:o}){super("Unknown signature.",{details:o}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$2{constructor({signature:o}){super("Invalid struct signature.",{details:o,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$2{constructor({type:o}){super("Circular reference detected.",{metaMessages:[`Struct "${o}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$2{constructor({current:o,depth:tt}){super("Unbalanced parentheses.",{metaMessages:[`"${o.trim()}" has too many ${tt>0?"opening":"closing"} parentheses.`],details:`Depth "${tt}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(et,o){return o?`${o}:${et}`:et}const parameterCache=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 parseSignature(et,o={}){if(isFunctionSignature(et)){const tt=execFunctionSignature(et);if(!tt)throw new InvalidSignatureError$1({signature:et,type:"function"});const rt=splitParameters(tt.parameters),nt=[],ot=rt.length;for(let st=0;st[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter(et,o){var dt,ht;const tt=getParameterCacheKey(et,o==null?void 0:o.type);if(parameterCache.has(tt))return parameterCache.get(tt);const rt=isTupleRegex.test(et),nt=execTyped(rt?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,et);if(!nt)throw new InvalidParameterError({param:et});if(nt.name&&isSolidityKeyword(nt.name))throw new SolidityProtectedKeywordError({param:et,name:nt.name});const ot=nt.name?{name:nt.name}:{},it=nt.modifier==="indexed"?{indexed:!0}:{},st=(o==null?void 0:o.structs)??{};let at,ct={};if(rt){at="tuple";const mt=splitParameters(nt.type),ft=[],pt=mt.length;for(let gt=0;gt[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(et,o,tt=new Set){const rt=[],nt=et.length;for(let ot=0;ot{const o=typeof et=="string"?et:formatAbiItem(et);return normalizeSignature$1(o)};function toSignatureHash(et){return hashSignature(toSignature(et))}const toEventSelector=toSignatureHash,toFunctionSelector=et=>slice(toSignatureHash(et),0,4);function getAbiItem(et){const{abi:o,args:tt=[],name:rt}=et,nt=isHex(rt,{strict:!1}),ot=o.filter(st=>nt?st.type==="function"?toFunctionSelector(st)===rt:st.type==="event"?toEventSelector(st)===rt:!1:"name"in st&&st.name===rt);if(ot.length===0)return;if(ot.length===1)return ot[0];let it;for(const st of ot){if(!("inputs"in st))continue;if(!tt||tt.length===0){if(!st.inputs||st.inputs.length===0)return st;continue}if(!st.inputs||st.inputs.length===0||st.inputs.length!==tt.length)continue;if(tt.every((ct,lt)=>{const dt="inputs"in st&&st.inputs[lt];return dt?isArgOfType(ct,dt):!1})){if(it&&"inputs"in it&&it.inputs){const ct=getAmbiguousTypes(st.inputs,it.inputs,tt);if(ct)throw new AbiItemAmbiguityError({abiItem:st,type:ct[0]},{abiItem:it,type:ct[1]})}it=st}}return it||ot[0]}function isArgOfType(et,o){const tt=typeof et,rt=o.type;switch(rt){case"address":return isAddress(et,{strict:!1});case"bool":return tt==="boolean";case"function":return tt==="string";case"string":return tt==="string";default:return rt==="tuple"&&"components"in o?Object.values(o.components).every((nt,ot)=>isArgOfType(Object.values(et)[ot],nt)):/^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(rt)?tt==="number"||tt==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(rt)?tt==="string"||et instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(rt)?Array.isArray(et)&&et.every(nt=>isArgOfType(nt,{...o,type:rt.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(et,o,tt){for(const rt in et){const nt=et[rt],ot=o[rt];if(nt.type==="tuple"&&ot.type==="tuple"&&"components"in nt&&"components"in ot)return getAmbiguousTypes(nt.components,ot.components,tt[rt]);const it=[nt.type,ot.type];if(it.includes("address")&&it.includes("bytes20")?!0:it.includes("address")&&it.includes("string")?isAddress(tt[rt],{strict:!1}):it.includes("address")&&it.includes("bytes")?isAddress(tt[rt],{strict:!1}):!1)return it}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(et){const{abi:o,args:tt,functionName:rt,data:nt}=et;let ot=o[0];if(rt){const st=getAbiItem({abi:o,args:tt,name:rt});if(!st)throw new AbiFunctionNotFoundError(rt,{docsPath:docsPath$1});ot=st}if(ot.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!ot.outputs)throw new AbiFunctionOutputsNotFoundError(ot.name,{docsPath:docsPath$1});const it=decodeAbiParameters(ot.outputs,nt);if(it&&it.length>1)return it;if(it&&it.length===1)return it[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(et){const{abi:o,args:tt,functionName:rt}=et;let nt=o[0];if(rt){const ot=getAbiItem({abi:o,args:tt,name:rt});if(!ot)throw new AbiFunctionNotFoundError(rt,{docsPath});nt=ot}if(nt.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[nt],functionName:toFunctionSelector(formatAbiItem$1(nt))}}function encodeFunctionData(et){const{args:o}=et,{abi:tt,functionName:rt}=(()=>{var st;return et.abi.length===1&&((st=et.functionName)!=null&&st.startsWith("0x"))?et:prepareEncodeFunctionData(et)})(),nt=tt[0],ot=rt,it="inputs"in nt&&nt.inputs?encodeAbiParameters(nt.inputs,o??[]):void 0;return concatHex([ot,it??"0x"])}function getChainContractAddress({blockNumber:et,chain:o,contract:tt}){var nt;const rt=(nt=o==null?void 0:o.contracts)==null?void 0:nt[tt];if(!rt)throw new ChainDoesNotSupportContract({chain:o,contract:{name:tt}});if(et&&rt.blockCreated&&rt.blockCreated>et)throw new ChainDoesNotSupportContract({blockNumber:et,chain:o,contract:{name:tt,blockCreated:rt.blockCreated}});return rt.address}const panicReasons={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."},solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function decodeErrorResult(et){const{abi:o,data:tt}=et,rt=slice(tt,0,4);if(rt==="0x")throw new AbiDecodingZeroDataError;const ot=[...o||[],solidityError,solidityPanic].find(it=>it.type==="error"&&rt===toFunctionSelector(formatAbiItem$1(it)));if(!ot)throw new AbiErrorSignatureNotFoundError(rt,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:ot,args:"inputs"in ot&&ot.inputs&&ot.inputs.length>0?decodeAbiParameters(ot.inputs,slice(tt,4)):void 0,errorName:ot.name}}function formatAbiItemWithArgs({abiItem:et,args:o,includeFunctionName:tt=!0,includeName:rt=!1}){if("name"in et&&"inputs"in et&&et.inputs)return`${tt?et.name:""}(${et.inputs.map((nt,ot)=>`${rt&&nt.name?`${nt.name}: `:""}${typeof o[ot]=="object"?stringify$2(o[ot]):o[ot]}`).join(", ")})`}class CallExecutionError extends BaseError$3{constructor(o,{account:tt,docsPath:rt,chain:nt,data:ot,gas:it,gasPrice:st,maxFeePerGas:at,maxPriorityFeePerGas:ct,nonce:lt,to:dt,value:ht,stateOverride:mt}){var gt;const ft=tt?parseAccount(tt):void 0;let pt=prettyPrint({from:ft==null?void 0:ft.address,to:dt,value:typeof ht<"u"&&`${formatEther(ht)} ${((gt=nt==null?void 0:nt.nativeCurrency)==null?void 0:gt.symbol)||"ETH"}`,data:ot,gas:it,gasPrice:typeof st<"u"&&`${formatGwei(st)} gwei`,maxFeePerGas:typeof at<"u"&&`${formatGwei(at)} gwei`,maxPriorityFeePerGas:typeof ct<"u"&&`${formatGwei(ct)} gwei`,nonce:lt});mt&&(pt+=` ${prettyStateOverride(mt)}`),super(o.shortMessage,{cause:o,docsPath:rt,metaMessages:[...o.metaMessages?[...o.metaMessages," "]:[],"Raw Call Arguments:",pt].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=o}}class ContractFunctionExecutionError extends BaseError$3{constructor(o,{abi:tt,args:rt,contractAddress:nt,docsPath:ot,functionName:it,sender:st}){const at=getAbiItem({abi:tt,args:rt,name:it}),ct=at?formatAbiItemWithArgs({abiItem:at,args:rt,includeFunctionName:!1,includeName:!1}):void 0,lt=at?formatAbiItem$1(at,{includeName:!0}):void 0,dt=prettyPrint({address:nt&&getContractAddress(nt),function:lt,args:ct&&ct!=="()"&&`${[...Array((it==null?void 0:it.length)??0).keys()].map(()=>" ").join("")}${ct}`,sender:st});super(o.shortMessage||`An unknown error occurred while executing the contract function "${it}".`,{cause:o,docsPath:ot,metaMessages:[...o.metaMessages?[...o.metaMessages," "]:[],dt&&"Contract Call:",dt].filter(Boolean),name:"ContractFunctionExecutionError"}),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}),this.abi=tt,this.args=rt,this.cause=o,this.contractAddress=nt,this.functionName=it,this.sender=st}}class ContractFunctionRevertedError extends BaseError$3{constructor({abi:o,data:tt,functionName:rt,message:nt}){let ot,it,st,at;if(tt&&tt!=="0x")try{it=decodeErrorResult({abi:o,data:tt});const{abiItem:lt,errorName:dt,args:ht}=it;if(dt==="Error")at=ht[0];else if(dt==="Panic"){const[mt]=ht;at=panicReasons[mt]}else{const mt=lt?formatAbiItem$1(lt,{includeName:!0}):void 0,ft=lt&&ht?formatAbiItemWithArgs({abiItem:lt,args:ht,includeFunctionName:!1,includeName:!1}):void 0;st=[mt?`Error: ${mt}`:"",ft&&ft!=="()"?` ${[...Array((dt==null?void 0:dt.length)??0).keys()].map(()=>" ").join("")}${ft}`:""]}}catch(lt){ot=lt}else nt&&(at=nt);let ct;ot instanceof AbiErrorSignatureNotFoundError&&(ct=ot.signature,st=[`Unable to decode signature "${ct}" 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=${ct}.`]),super(at&&at!=="execution reverted"||ct?[`The contract function "${rt}" reverted with the following ${ct?"signature":"reason"}:`,at||ct].join(` -`):`The contract function "${rt}" reverted.`,{cause:ot,metaMessages:st,name:"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=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:o}){super(`The contract function "${o}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${o}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:o}){super(`Deployment for counterfactual contract call failed${o?` for factory "${o}".`:""}`,{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."],name:"CounterfactualDeploymentFailedError"})}}class RawContractError extends BaseError$3{constructor({data:o,message:tt}){super(tt||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o}}function isNullUniversalResolverError(et,o){var rt,nt,ot,it,st,at;if(!(et instanceof BaseError$3))return!1;const tt=et.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((rt=tt.data)==null?void 0:rt.errorName)==="ResolverNotFound"||((nt=tt.data)==null?void 0:nt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||o==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(et){if(et.length!==66||et.indexOf("[")!==0||et.indexOf("]")!==65)return null;const o=`0x${et.slice(1,65)}`;return isHex(o)?o:null}function namehash(et){let o=new Uint8Array(32).fill(0);if(!et)return bytesToHex$3(o);const tt=et.split(".");for(let rt=tt.length-1;rt>=0;rt-=1){const nt=encodedLabelToLabelhash(tt[rt]),ot=nt?toBytes$3(nt):keccak256$1(stringToBytes(tt[rt]),"bytes");o=keccak256$1(concat$6([o,ot]),"bytes")}return bytesToHex$3(o)}function encodeLabelhash(et){return`[${et.slice(2)}]`}function labelhash(et){const o=new Uint8Array(32).fill(0);return et?encodedLabelToLabelhash(et)||keccak256$1(stringToBytes(et)):bytesToHex$3(o)}function packetToBytes(et){const o=et.replace(/^\.|\.$/gm,"");if(o.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(o).byteLength+2);let rt=0;const nt=o.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(nt[ot])))),tt[rt]=it.length,tt.set(it,rt+1),rt+=it.length+1}return tt.byteLength!==rt+1?tt.slice(0,rt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(et,{abi:o,address:tt,args:rt,docsPath:nt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=et instanceof RawContractError?et:et instanceof BaseError$3?et.walk(ht=>"data"in ht)||et.walk():{},dt=et instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:o,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):et;return new ContractFunctionExecutionError(dt,{abi:o,args:rt,contractAddress:tt,docsPath:nt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(et,{docsPath:o,...tt}){const rt=(()=>{const nt=getNodeError(et,tt);return nt instanceof UnknownNodeError?et:nt})();return new CallExecutionError(rt,{docsPath:o,...tt})}const schedulerCache=new Map;function createBatchScheduler({fn:et,id:o,shouldSplitBatch:tt,wait:rt=0,sort:nt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&et(dt).then(ht=>{var mt;nt&&Array.isArray(ht)&&ht.sort(nt);for(let ft=0;ft{var mt;for(let ft=0;ftschedulerCache.delete(o),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(o)||[],ct=lt=>schedulerCache.set(o,[...at(),lt]);return{flush:it,async schedule(lt){const dt={},ht=new Promise((pt,gt)=>{dt.resolve=pt,dt.reject=gt});return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,pendingPromise:dt}),ht):(ct({args:lt,pendingPromise:dt}),setTimeout(ot,rt),ht)}}}async function call(et,o){var Ot,Nt,Yt,Ft;const{account:tt=et.account,batch:rt=!!((Ot=et.batch)!=null&&Ot.multicall),blockNumber:nt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:gt,nonce:yt,to:bt,value:xt,stateOverride:vt,...Et}=o,Ct=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&bt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const St=at&&ct,At=lt&&dt&&bt&&ct,kt=St||At,It=St?toDeploylessCallViaBytecodeData({code:at,data:ct}):At?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:bt}):ct;try{assertRequest(o);const Qt=(nt?numberToHex(nt):void 0)||ot,Vt=serializeStateOverride(vt),Bt=(Ft=(Yt=(Nt=et.chain)==null?void 0:Nt.formatters)==null?void 0:Yt.transactionRequest)==null?void 0:Ft.format,jt=(Bt||formatTransactionRequest)({...extract$1(Et,{format:Bt}),from:Ct==null?void 0:Ct.address,accessList:it,blobs:st,data:It,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:gt,nonce:yt,to:kt?void 0:bt,value:xt});if(rt&&shouldPerformMulticall({request:jt})&&!Vt)try{return await scheduleMulticall(et,{...jt,blockNumber:nt,blockTag:ot})}catch(Kt){if(!(Kt instanceof ClientChainNotConfiguredError)&&!(Kt instanceof ChainDoesNotSupportContract))throw Kt}const Xt=await et.request({method:"eth_call",params:Vt?[jt,Qt,Vt]:[jt,Qt]});return Xt==="0x"?{data:void 0}:{data:Xt}}catch(Ht){const Qt=getRevertErrorData(Ht),{offchainLookup:Vt,offchainLookupSignature:Bt}=await __vitePreload(async()=>{const{offchainLookup:Wt,offchainLookupSignature:jt}=await import("./ccip-DHJq9nI9.js");return{offchainLookup:Wt,offchainLookupSignature:jt}},[]);if(et.ccipRead!==!1&&(Qt==null?void 0:Qt.slice(0,10))===Bt&&bt)return{data:await Vt(et,{data:Qt,to:bt})};throw kt&&(Qt==null?void 0:Qt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ht,{...o,account:Ct,chain:et.chain})}}function shouldPerformMulticall({request:et}){const{data:o,to:tt,...rt}=et;return!(!o||o.startsWith(aggregate3Signature)||!tt||Object.values(rt).filter(nt=>typeof nt<"u").length>0)}async function scheduleMulticall(et,o){var pt;const{batchSize:tt=1024,wait:rt=0}=typeof((pt=et.batch)==null?void 0:pt.multicall)=="object"?et.batch.multicall:{},{blockNumber:nt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=o;let ct=st;if(!ct){if(!et.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:nt,chain:et.chain,contract:"multicall3"})}const dt=(nt?numberToHex(nt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${et.uid}.${dt}`,wait:rt,shouldSplitBatch(gt){return gt.reduce((bt,{data:xt})=>bt+(xt.length-2),0)>tt*2},fn:async gt=>{const yt=gt.map(vt=>({allowFailure:!0,callData:vt.data,target:vt.to})),bt=encodeFunctionData({abi:multicall3Abi,args:[yt],functionName:"aggregate3"}),xt=await et.request({method:"eth_call",params:[{data:bt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[yt],functionName:"aggregate3",data:xt||"0x"})}}),[{returnData:mt,success:ft}]=await ht({data:it,to:at});if(!ft)throw new RawContractError({data:mt});return mt==="0x"?{data:void 0}:{data:mt}}function toDeploylessCallViaBytecodeData(et){const{code:o,data:tt}=et;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[o,tt]})}function toDeploylessCallViaFactoryData(et){const{data:o,factory:tt,factoryData:rt,to:nt}=et;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[nt,o,tt,rt]})}function getRevertErrorData(et){var tt;if(!(et instanceof BaseError$3))return;const o=et.walk();return typeof(o==null?void 0:o.data)=="object"?(tt=o.data)==null?void 0:tt.data:o.data}async function readContract$1(et,o){const{abi:tt,address:rt,args:nt,functionName:ot,...it}=o,st=encodeFunctionData({abi:tt,args:nt,functionName:ot});try{const{data:at}=await getAction$1(et,call,"call")({...it,data:st,to:rt});return decodeFunctionResult({abi:tt,args:nt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:rt,args:nt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(et,{blockNumber:o,blockTag:tt,coinType:rt,name:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:o,chain:et.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...rt!=null?{args:[namehash(nt),BigInt(rt)]}:{args:[namehash(nt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),ct],blockNumber:o,blockTag:tt},dt=getAction$1(et,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const mt=decodeFunctionResult({abi:addressResolverAbi,args:rt!=null?[namehash(nt),BigInt(rt)]:void 0,functionName:"addr",data:ht[0]});return mt==="0x"||trim$1(mt)==="0x00"?null:mt}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:o}){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(o)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:o}){super(`ENS NFT avatar URI is invalid. ${o}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:o}){super(`Unable to resolve ENS avatar URI "${o}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:o}){super(`ENS NFT avatar namespace "${o}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(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\-.]+))?(?\/.*)?$/,base64Regex$1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(et){try{const o=await fetch(et,{method:"HEAD"});if(o.status===200){const tt=o.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(o){return typeof o=="object"&&typeof o.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const rt=new Image;rt.onload=()=>{tt(!0)},rt.onerror=()=>{tt(!1)},rt.src=et})}}function getGateway(et,o){return et?et.endsWith("/")?et.slice(0,-1):et:o}function resolveAvatarUri({uri:et,gatewayUrls:o}){const tt=base64Regex$1.test(et);if(tt)return{uri:et,isOnChain:!0,isEncoded:tt};const rt=getGateway(o==null?void 0:o.ipfs,"https://ipfs.io"),nt=getGateway(o==null?void 0:o.arweave,"https://arweave.net"),ot=et.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(et);if(et.startsWith("http")&&!lt&&!dt){let mt=et;return o!=null&&o.arweave&&(mt=et.replace(/https:\/\/arweave.net/g,o==null?void 0:o.arweave)),{uri:mt,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${rt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${nt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=et.replace(dataURIRegex,"");if(ht.startsWith("nt.json());return await parseAvatarUri({gatewayUrls:et,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:o})}}async function parseAvatarUri({gatewayUrls:et,uri:o}){const{uri:tt,isOnChain:rt}=resolveAvatarUri({uri:o,gatewayUrls:et});if(rt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:o})}function parseNftUri(et){let o=et;o.startsWith("did:nft:")&&(o=o.replace("did:nft:","").replace(/_/g,"/"));const[tt,rt,nt]=o.split("/"),[ot,it]=tt.split(":"),[st,at]=rt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!nt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:nt}}async function getNftTokenUri(et,{nft:o}){if(o.namespace==="erc721")return readContract$1(et,{address:o.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(o.tokenID)]});if(o.namespace==="erc1155")return readContract$1(et,{address:o.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(o.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:o.namespace})}async function parseAvatarRecord(et,{gatewayUrls:o,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(et,{gatewayUrls:o,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:o})}async function parseNftAvatarUri(et,{gatewayUrls:o,record:tt}){const rt=parseNftUri(tt),nt=await getNftTokenUri(et,{nft:rt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:nt,gatewayUrls:o});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:o})}let at=rt.tokenID;return rt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:o,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(et,{blockNumber:o,blockTag:tt,name:rt,key:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:o,chain:et.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(rt),nt]})],blockNumber:o,blockTag:tt},lt=getAction$1(et,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(et,{blockNumber:o,blockTag:tt,assetGatewayUrls:rt,name:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(et,getEnsText,"getEnsText")({blockNumber:o,blockTag:tt,key:"avatar",name:nt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(et,{record:at,gatewayUrls:rt})}catch{return null}}async function getEnsName$1(et,{address:o,blockNumber:tt,blockTag:rt,gatewayUrls:nt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:et.chain,contract:"ensUniversalResolver"})}const at=`${o.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:rt},lt=getAction$1(et,readContract$1,"readContract"),[dt,ht]=nt?await lt({...ct,args:[...ct.args,nt]}):await lt(ct);return o.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(et){const o=(nt,ot)=>({clear:()=>ot.delete(nt),get:()=>ot.get(nt),set:it=>ot.set(nt,it)}),tt=o(et,promiseCache$1),rt=o(et,responseCache);return{clear:()=>{tt.clear(),rt.clear()},promise:tt,response:rt}}async function withCache(et,{cacheKey:o,cacheTime:tt=Number.POSITIVE_INFINITY}){const rt=getCache(o),nt=rt.response.get();if(nt&&tt>0&&new Date().getTime()-nt.created.getTime()`blockNumber.${et}`;async function getBlockNumber$1(et,{cacheTime:o=et.cacheTime}={}){const tt=await withCache(()=>et.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(et.uid),cacheTime:o});return BigInt(tt)}function formatLog(et,{args:o,eventName:tt}={}){return{...et,blockHash:et.blockHash?et.blockHash:null,blockNumber:et.blockNumber?BigInt(et.blockNumber):null,logIndex:et.logIndex?Number(et.logIndex):null,transactionHash:et.transactionHash?et.transactionHash:null,transactionIndex:et.transactionIndex?Number(et.transactionIndex):null,...tt?{args:o,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(et){const o={...et,blockNumber:et.blockNumber?BigInt(et.blockNumber):null,contractAddress:et.contractAddress?et.contractAddress:null,cumulativeGasUsed:et.cumulativeGasUsed?BigInt(et.cumulativeGasUsed):null,effectiveGasPrice:et.effectiveGasPrice?BigInt(et.effectiveGasPrice):null,gasUsed:et.gasUsed?BigInt(et.gasUsed):null,logs:et.logs?et.logs.map(tt=>formatLog(tt)):null,to:et.to?et.to:null,transactionIndex:et.transactionIndex?hexToNumber$2(et.transactionIndex):null,status:et.status?receiptStatuses[et.status]:null,type:et.type?transactionType[et.type]||et.type:null};return et.blobGasPrice&&(o.blobGasPrice=BigInt(et.blobGasPrice)),et.blobGasUsed&&(o.blobGasUsed=BigInt(et.blobGasUsed)),o}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(et,o){var gt;const{allowFailure:tt=!0,batchSize:rt,blockNumber:nt,blockTag:ot,multicallAddress:it,stateOverride:st}=o,at=o.contracts,ct=rt??(typeof((gt=et.batch)==null?void 0:gt.multicall)=="object"&&et.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!et.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:nt,chain:et.chain,contract:"multicall3"})}const dt=[[]];let ht=0,mt=0;for(let yt=0;yt0&&mt>ct&&dt[ht].length>0&&(ht++,mt=(Ct.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:Ct,target:xt}]}catch(Ct){const St=getContractError(Ct,{abi:bt,address:xt,args:vt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw St;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:xt}]}}const ft=await Promise.allSettled(dt.map(yt=>getAction$1(et,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[yt],blockNumber:nt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let yt=0;ytlistenersCache.get(et)||[],ot=()=>{const lt=nt();listenersCache.set(et,lt.filter(dt=>dt.id!==rt))},it=()=>{const lt=cleanupCache.get(et);nt().length===1&<&<(),ot()},st=nt();if(listenersCache.set(et,[...st,{id:rt,fns:o}]),st&&st.length>0)return it;const at={};for(const lt in o)at[lt]=(...dt)=>{var mt,ft;const ht=nt();if(ht.length!==0)for(const pt of ht)(ft=(mt=pt.fns)[lt])==null||ft.call(mt,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(et,ct),it}async function wait$1(et){return new Promise(o=>setTimeout(o,et))}function poll(et,{emitOnBegin:o,initialWaitTime:tt,interval:rt}){let nt=!0;const ot=()=>nt=!1;return(async()=>{let st;o&&(st=await et({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??rt;await wait$1(at);const ct=async()=>{nt&&(await et({unpoll:ot}),await wait$1(rt),ct())};ct()})(),ot}function watchBlockNumber$1(et,{emitOnBegin:o=!1,emitMissed:tt=!1,onBlockNumber:rt,onError:nt,poll:ot,pollingInterval:it=et.pollingInterval}){const st=typeof ot<"u"?ot:!(et.transport.type==="webSocket"||et.transport.type==="fallback"&&et.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",et.uid,o,tt,it]);return observe(dt,{onBlockNumber:rt,onError:nt},ht=>poll(async()=>{var mt;try{const ft=await getAction$1(et,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(ft===at)return;if(ft-at>1&&tt)for(let pt=at+1n;ptat)&&(ht.onBlockNumber(ft,at),at=ft)}catch(ft){(mt=ht.onError)==null||mt.call(ht,ft)}},{emitOnBegin:o,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",et.uid,o,tt]);return observe(dt,{onBlockNumber:rt,onError:nt},ht=>{let mt=!0,ft=()=>mt=!1;return(async()=>{try{const pt=(()=>{if(et.transport.type==="fallback"){const yt=et.transport.transports.find(bt=>bt.config.type==="webSocket");return yt?yt.value:et.transport}return et.transport})(),{unsubscribe:gt}=await pt.subscribe({params:["newHeads"],onData(yt){var xt;if(!mt)return;const bt=hexToBigInt((xt=yt.result)==null?void 0:xt.number);ht.onBlockNumber(bt,at),at=bt},onError(yt){var bt;(bt=ht.onError)==null||bt.call(ht,yt)}});ft=gt,mt||ft()}catch(pt){nt==null||nt(pt)}})(),()=>ft()})})()}const promiseCache=new LruMap(8192);function withDedupe(et,{enabled:o=!0,id:tt}){if(!o||!tt)return et();if(promiseCache.get(tt))return promiseCache.get(tt);const rt=et().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,rt),rt}function withRetry(et,{delay:o=100,retryCount:tt=2,shouldRetry:rt=()=>!0}={}){return new Promise((nt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof o=="function"?o({count:st,error:ct}):o;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await et();nt(ct)}catch(ct){if(st{const{dedupe:nt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...o,...rt},at=nt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await et(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:nt,id:at})}}function shouldRetry(et){return"code"in et&&typeof et.code=="number"?et.code===-1||et.code===LimitExceededRpcError.code||et.code===InternalRpcError.code:et instanceof HttpRequestError&&et.status?et.status===403||et.status===408||et.status===413||et.status===429||et.status===500||et.status===502||et.status===503||et.status===504:!0}function defineChain(et){return{formatters:void 0,fees:void 0,serializers:void 0,...et}}function withTimeout(et,{errorInstance:o=new Error("timed out"),timeout:tt,signal:rt}){return new Promise((nt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{rt?st.abort():ot(o)},tt)),nt(await et({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(o),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(et,o={}){return{async request(tt){var dt;const{body:rt,onRequest:nt=o.onRequest,onResponse:ot=o.onResponse,timeout:it=o.timeout??1e4}=tt,st={...o.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:ft})=>{const pt={...st,body:Array.isArray(rt)?stringify$2(rt.map(xt=>({jsonrpc:"2.0",id:xt.id??idCache.take(),...xt}))):stringify$2({jsonrpc:"2.0",id:rt.id??idCache.take(),...rt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?ft:null)},gt=new Request(et,pt),yt=await(nt==null?void 0:nt(gt,pt))??{...pt,url:et};return await fetch(yt.url??et,yt)},{errorInstance:new TimeoutError$4({body:rt,url:et}),timeout:it,signal:!0});ot&&await ot(ht);let mt;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))mt=await ht.json();else{mt=await ht.text();try{mt=JSON.parse(mt||"{}")}catch(ft){if(ht.ok)throw ft;mt={error:mt}}}if(!ht.ok)throw new HttpRequestError({body:rt,details:stringify$2(mt.error)||ht.statusText,headers:ht.headers,status:ht.status,url:et});return mt}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:rt,cause:ht,url:et})}}}}function assertTransactionEIP7702(et){const{authorizationList:o}=et;if(o)for(const tt of o){const{contractAddress:rt,chainId:nt}=tt;if(!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt<=0)throw new InvalidChainIdError({chainId:nt})}assertTransactionEIP1559(et)}function assertTransactionEIP4844(et){const{blobVersionedHashes:o}=et;if(o){if(o.length===0)throw new EmptyBlobError;for(const tt of o){const rt=size$2(tt),nt=hexToNumber$2(slice(tt,0,1));if(rt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:rt});if(nt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:nt})}}assertTransactionEIP1559(et)}function assertTransactionEIP1559(et){const{chainId:o,maxPriorityFeePerGas:tt,maxFeePerGas:rt,to:nt}=et;if(o<=0)throw new InvalidChainIdError({chainId:o});if(nt&&!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt});if(tt&&rt&&tt>rt)throw new TipAboveFeeCapError({maxFeePerGas:rt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(et){const{chainId:o,maxPriorityFeePerGas:tt,gasPrice:rt,maxFeePerGas:nt,to:ot}=et;if(o<=0)throw new InvalidChainIdError({chainId:o});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||nt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt})}function assertTransactionLegacy(et){const{chainId:o,maxPriorityFeePerGas:tt,gasPrice:rt,maxFeePerGas:nt,to:ot}=et;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof o<"u"&&o<=0)throw new InvalidChainIdError({chainId:o});if(tt||nt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt})}function serializeAuthorizationList(et){if(!et||et.length===0)return[];const o=[];for(const tt of et){const{contractAddress:rt,chainId:nt,nonce:ot,...it}=tt;o.push([toHex(nt),rt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return o}function serializeAccessList(et){if(!et||et.length===0)return[];const o=[];for(let tt=0;tt"u"||typeof mt>"u")){const xt=typeof et.blobs[0]=="string"?et.blobs:et.blobs.map(Ct=>bytesToHex$3(Ct)),vt=et.kzg,Et=blobsToCommitments({blobs:xt,kzg:vt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof mt>"u"){const Ct=blobsToProofs({blobs:xt,commitments:Et,kzg:vt});mt=toBlobSidecars({blobs:xt,commitments:Et,proofs:Ct})}}const ft=serializeAccessList(lt),pt=[toHex(tt),nt?toHex(nt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",ft,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(et,o)],gt=[],yt=[],bt=[];if(mt)for(let xt=0;xt{if(o.v>=35n)return(o.v-35n)/2n>0?o.v:27n+(o.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+o.v-27n);const mt=27n+(o.v===27n?0n:1n);if(o.v!==mt)throw new InvalidLegacyVError({v:o.v});return mt})(),dt=trim$1(o.r),ht=trim$1(o.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(et,o){const tt=o??et,{v:rt,yParity:nt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof rt>"u"&&typeof nt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof nt=="number"?nt?toHex(1):"0x":rt===0n?"0x":rt===1n?toHex(1):rt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(et,{account:o=et.account,message:tt}){if(!o)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const rt=parseAccount(o);if(rt.signMessage)return rt.signMessage({message:tt});const nt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return et.request({method:"personal_sign",params:[nt,rt.address]},{retryCount:0})}class HMAC extends Hash{constructor(o,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(o);const rt=toBytes$2(tt);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const nt=this.blockLen,ot=new Uint8Array(nt);ot.set(rt.length>nt?o.create().update(rt).digest():rt);for(let it=0;itnew HMAC(et,o).update(tt).digest();hmac.create=(et,o)=>new HMAC(et,o);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(et){return et instanceof Uint8Array||et!=null&&typeof et=="object"&&et.constructor.name==="Uint8Array"}function abytes(et){if(!isBytes$2(et))throw new Error("Uint8Array expected")}function abool(et,o){if(typeof o!="boolean")throw new Error(`${et} must be valid boolean, got "${o}".`)}const hexes$1=Array.from({length:256},(et,o)=>o.toString(16).padStart(2,"0"));function bytesToHex$2(et){abytes(et);let o="";for(let tt=0;tt=asciis._0&&et<=asciis._9)return et-asciis._0;if(et>=asciis._A&&et<=asciis._F)return et-(asciis._A-10);if(et>=asciis._a&&et<=asciis._f)return et-(asciis._a-10)}function hexToBytes$2(et){if(typeof et!="string")throw new Error("hex string expected, got "+typeof et);const o=et.length,tt=o/2;if(o%2)throw new Error("padded hex string expected, got unpadded hex of length "+o);const rt=new Uint8Array(tt);for(let nt=0,ot=0;nttypeof et=="bigint"&&_0n$6<=et;function inRange(et,o,tt){return isPosBig(et)&&isPosBig(o)&&isPosBig(tt)&&o<=et&&et_0n$6;et>>=_1n$8,o+=1);return o}function bitGet(et,o){return et>>BigInt(o)&_1n$8}function bitSet(et,o,tt){return et|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(et),u8fr=et=>Uint8Array.from(et);function createHmacDrbg(et,o,tt){if(typeof et!="number"||et<2)throw new Error("hashLen must be a number");if(typeof o!="number"||o<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let rt=u8n(et),nt=u8n(et),ot=0;const it=()=>{rt.fill(1),nt.fill(0),ot=0},st=(...dt)=>tt(nt,rt,...dt),at=(dt=u8n())=>{nt=st(u8fr([0]),dt),rt=st(),dt.length!==0&&(nt=st(u8fr([1]),dt),rt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let mt;for(;!(mt=ht(ct()));)at();return it(),mt}}const validatorFns={bigint:et=>typeof et=="bigint",function:et=>typeof et=="function",boolean:et=>typeof et=="boolean",string:et=>typeof et=="string",stringOrUint8Array:et=>typeof et=="string"||isBytes$2(et),isSafeInteger:et=>Number.isSafeInteger(et),array:et=>Array.isArray(et),field:(et,o)=>o.Fp.isValid(et),hash:et=>typeof et=="function"&&Number.isSafeInteger(et.outputLen)};function validateObject(et,o,tt={}){const rt=(nt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=et[nt];if(!(it&&at===void 0)&&!st(at,et))throw new Error(`Invalid param ${String(nt)}=${at} (${typeof at}), expected ${ot}`)};for(const[nt,ot]of Object.entries(o))rt(nt,ot,!1);for(const[nt,ot]of Object.entries(tt))rt(nt,ot,!0);return et}const notImplemented=()=>{throw new Error("not implemented")};function memoized(et){const o=new WeakMap;return(tt,...rt)=>{const nt=o.get(tt);if(nt!==void 0)return nt;const ot=et(tt,...rt);return o.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(et,o){const tt=et%o;return tt>=_0n$5?tt:o+tt}function pow(et,o,tt){if(tt<=_0n$5||o<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let rt=_1n$7;for(;o>_0n$5;)o&_1n$7&&(rt=rt*et%tt),et=et*et%tt,o>>=_1n$7;return rt}function pow2$1(et,o,tt){let rt=et;for(;o-- >_0n$5;)rt*=rt,rt%=tt;return rt}function invert$1(et,o){if(et===_0n$5||o<=_0n$5)throw new Error(`invert: expected positive integers, got n=${et} mod=${o}`);let tt=mod$1(et,o),rt=o,nt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=rt/tt,at=rt%tt,ct=nt-ot*st;rt=tt,tt=at,nt=ot,ot=ct}if(rt!==_1n$7)throw new Error("invert: does not exist");return mod$1(nt,o)}function tonelliShanks(et){const o=(et-_1n$7)/_2n$4;let tt,rt,nt;for(tt=et-_1n$7,rt=0;tt%_2n$4===_0n$5;tt/=_2n$4,rt++);for(nt=_2n$4;nt(mod$1(et,o)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(et){const o={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((rt,nt)=>(rt[nt]="function",rt),o);return validateObject(et,tt)}function FpPow(et,o,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return et.ONE;if(tt===_1n$7)return o;let rt=et.ONE,nt=o;for(;tt>_0n$5;)tt&_1n$7&&(rt=et.mul(rt,nt)),nt=et.sqr(nt),tt>>=_1n$7;return rt}function FpInvertBatch(et,o){const tt=new Array(o.length),rt=o.reduce((ot,it,st)=>et.is0(it)?ot:(tt[st]=ot,et.mul(ot,it)),et.ONE),nt=et.inv(rt);return o.reduceRight((ot,it,st)=>et.is0(it)?ot:(tt[st]=et.mul(ot,tt[st]),et.mul(ot,it)),nt),tt}function nLength(et,o){const tt=o!==void 0?o:et.toString(2).length,rt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:rt}}function Field$1(et,o,tt=!1,rt={}){if(et<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${et}`);const{nBitLength:nt,nByteLength:ot}=nLength(et,o);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(et),st=Object.freeze({ORDER:et,BITS:nt,BYTES:ot,MASK:bitMask(nt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,et),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,et),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,et),add:(at,ct)=>mod$1(at+ct,et),sub:(at,ct)=>mod$1(at-ct,et),mul:(at,ct)=>mod$1(at*ct,et),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,et),et),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,et),sqrt:rt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(et){if(typeof et!="bigint")throw new Error("field order must be bigint");const o=et.toString(2).length;return Math.ceil(o/8)}function getMinHashLength(et){const o=getFieldBytesLength(et);return o+Math.ceil(o/2)}function mapHashToField(et,o,tt=!1){const rt=et.length,nt=getFieldBytesLength(o),ot=getMinHashLength(o);if(rt<16||rt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${rt}`);const it=tt?bytesToNumberBE(et):bytesToNumberLE(et),st=mod$1(it,o-_1n$7)+_1n$7;return tt?numberToBytesLE(st,nt):numberToBytesBE(st,nt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(et,o){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},rt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>o)throw new Error(`Wrong window size=${ot}, should be [1..${o}]`)},nt=ot=>{rt(ot);const it=Math.ceil(o/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=et.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=nt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=ft,yt>ct&&(yt-=mt,st+=_1n$6);const bt=gt,xt=gt+Math.abs(yt)-1,vt=pt%2!==0,Et=yt<0;yt===0?dt=dt.add(tt(vt,it[bt])):lt=lt.add(tt(Et,it[xt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){rt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(et,o,tt,rt){if(!Array.isArray(tt)||!Array.isArray(rt)||rt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");rt.forEach((lt,dt)=>{if(!o.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof et))throw new Error(`wrong point at index ${dt}`)});const nt=bitLen(BigInt(tt.length)),ot=nt>12?nt-3:nt>4?nt-2:nt?2:1,it=(1<=0;lt-=ot){st.fill(et.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[ft]=st[ft].add(tt[ht])}let dt=et.ZERO;for(let ht=st.length-1,mt=et.ZERO;ht>0;ht--)mt=mt.add(st[ht]),dt=dt.add(mt);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(et<0||et>256)throw new tt("tlv.encode: wrong tag");if(o.length&1)throw new tt("tlv.encode: unpadded data");const rt=o.length/2,nt=numberToHexUnpadded$1(rt);if(nt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=rt>127?numberToHexUnpadded$1(nt.length/2|128):"";return`${numberToHexUnpadded$1(et)}${ot}${nt}${o}`},decode(et,o){const{Err:tt}=DER;let rt=0;if(et<0||et>256)throw new tt("tlv.encode: wrong tag");if(o.length<2||o[rt++]!==et)throw new tt("tlv.decode: wrong tlv");const nt=o[rt++],ot=!!(nt&128);let it=0;if(!ot)it=nt;else{const at=nt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=o.subarray(rt,rt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(rt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=o.subarray(rt,rt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:o.subarray(rt+it)}}},_int:{encode(et){const{Err:o}=DER;if(et<_0n$3)throw new o("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(et);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new o("unexpected assertion");return tt},decode(et){const{Err:o}=DER;if(et[0]&128)throw new o("Invalid signature integer: negative");if(et[0]===0&&!(et[1]&128))throw new o("Invalid signature integer: unnecessary leading zero");return b2n(et)}},toSig(et){const{Err:o,_int:tt,_tlv:rt}=DER,nt=typeof et=="string"?h2b(et):et;abytes(nt);const{v:ot,l:it}=rt.decode(48,nt);if(it.length)throw new o("Invalid signature: left bytes after parsing");const{v:st,l:at}=rt.decode(2,ot),{v:ct,l:lt}=rt.decode(2,at);if(lt.length)throw new o("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(et){const{_tlv:o,_int:tt}=DER,rt=`${o.encode(2,tt.encode(et.r))}${o.encode(2,tt.encode(et.s))}`;return o.encode(48,rt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(et){const o=validatePointOpts(et),{Fp:tt}=o,rt=Field$1(o.n,o.nBitLength),nt=o.toBytes||((pt,gt,yt)=>{const bt=gt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(bt.x),tt.toBytes(bt.y))}),ot=o.fromBytes||(pt=>{const gt=pt.subarray(1),yt=tt.fromBytes(gt.subarray(0,tt.BYTES)),bt=tt.fromBytes(gt.subarray(tt.BYTES,2*tt.BYTES));return{x:yt,y:bt}});function it(pt){const{a:gt,b:yt}=o,bt=tt.sqr(pt),xt=tt.mul(bt,pt);return tt.add(tt.add(xt,tt.mul(pt,gt)),yt)}if(!tt.eql(tt.sqr(o.Gy),it(o.Gx)))throw new Error("bad generator point: equation left != right");function st(pt){return inRange(pt,_1n$5,o.n)}function at(pt){const{allowedPrivateKeyLengths:gt,nByteLength:yt,wrapPrivateKey:bt,n:xt}=o;if(gt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!gt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(yt*2,"0")}let vt;try{vt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,yt))}catch{throw new Error(`private key must be ${yt} bytes, hex or bigint, not ${typeof pt}`)}return bt&&(vt=mod$1(vt,xt)),aInRange("private key",vt,_1n$5,xt),vt}function ct(pt){if(!(pt instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((pt,gt)=>{const{px:yt,py:bt,pz:xt}=pt;if(tt.eql(xt,tt.ONE))return{x:yt,y:bt};const vt=pt.is0();gt==null&&(gt=vt?tt.ONE:tt.inv(xt));const Et=tt.mul(yt,gt),Ct=tt.mul(bt,gt),St=tt.mul(xt,gt);if(vt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(St,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:Ct}}),dt=memoized(pt=>{if(pt.is0()){if(o.allowInfinityPoint&&!tt.is0(pt.py))return;throw new Error("bad point: ZERO")}const{x:gt,y:yt}=pt.toAffine();if(!tt.isValid(gt)||!tt.isValid(yt))throw new Error("bad point: x or y not FE");const bt=tt.sqr(yt),xt=it(gt);if(!tt.eql(bt,xt))throw new Error("bad point: equation left != right");if(!pt.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(gt,yt,bt){if(this.px=gt,this.py=yt,this.pz=bt,gt==null||!tt.isValid(gt))throw new Error("x required");if(yt==null||!tt.isValid(yt))throw new Error("y required");if(bt==null||!tt.isValid(bt))throw new Error("z required");Object.freeze(this)}static fromAffine(gt){const{x:yt,y:bt}=gt||{};if(!gt||!tt.isValid(yt)||!tt.isValid(bt))throw new Error("invalid affine point");if(gt instanceof ht)throw new Error("projective point not allowed");const xt=vt=>tt.eql(vt,tt.ZERO);return xt(yt)&&xt(bt)?ht.ZERO:new ht(yt,bt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(gt){const yt=tt.invertBatch(gt.map(bt=>bt.pz));return gt.map((bt,xt)=>bt.toAffine(yt[xt])).map(ht.fromAffine)}static fromHex(gt){const yt=ht.fromAffine(ot(ensureBytes$1("pointHex",gt)));return yt.assertValidity(),yt}static fromPrivateKey(gt){return ht.BASE.multiply(at(gt))}static msm(gt,yt){return pippenger(ht,rt,gt,yt)}_setWindowSize(gt){ft.setWindowSize(this,gt)}assertValidity(){dt(this)}hasEvenY(){const{y:gt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(gt);throw new Error("Field doesn't support isOdd")}equals(gt){ct(gt);const{px:yt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=gt,St=tt.eql(tt.mul(yt,Ct),tt.mul(vt,xt)),At=tt.eql(tt.mul(bt,Ct),tt.mul(Et,xt));return St&&At}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:gt,b:yt}=o,bt=tt.mul(yt,_3n$2),{px:xt,py:vt,pz:Et}=this;let Ct=tt.ZERO,St=tt.ZERO,At=tt.ZERO,kt=tt.mul(xt,xt),It=tt.mul(vt,vt),Ot=tt.mul(Et,Et),Nt=tt.mul(xt,vt);return Nt=tt.add(Nt,Nt),At=tt.mul(xt,Et),At=tt.add(At,At),Ct=tt.mul(gt,At),St=tt.mul(bt,Ot),St=tt.add(Ct,St),Ct=tt.sub(It,St),St=tt.add(It,St),St=tt.mul(Ct,St),Ct=tt.mul(Nt,Ct),At=tt.mul(bt,At),Ot=tt.mul(gt,Ot),Nt=tt.sub(kt,Ot),Nt=tt.mul(gt,Nt),Nt=tt.add(Nt,At),At=tt.add(kt,kt),kt=tt.add(At,kt),kt=tt.add(kt,Ot),kt=tt.mul(kt,Nt),St=tt.add(St,kt),Ot=tt.mul(vt,Et),Ot=tt.add(Ot,Ot),kt=tt.mul(Ot,Nt),Ct=tt.sub(Ct,kt),At=tt.mul(Ot,It),At=tt.add(At,At),At=tt.add(At,At),new ht(Ct,St,At)}add(gt){ct(gt);const{px:yt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=gt;let St=tt.ZERO,At=tt.ZERO,kt=tt.ZERO;const It=o.a,Ot=tt.mul(o.b,_3n$2);let Nt=tt.mul(yt,vt),Yt=tt.mul(bt,Et),Ft=tt.mul(xt,Ct),Ht=tt.add(yt,bt),Qt=tt.add(vt,Et);Ht=tt.mul(Ht,Qt),Qt=tt.add(Nt,Yt),Ht=tt.sub(Ht,Qt),Qt=tt.add(yt,xt);let Vt=tt.add(vt,Ct);return Qt=tt.mul(Qt,Vt),Vt=tt.add(Nt,Ft),Qt=tt.sub(Qt,Vt),Vt=tt.add(bt,xt),St=tt.add(Et,Ct),Vt=tt.mul(Vt,St),St=tt.add(Yt,Ft),Vt=tt.sub(Vt,St),kt=tt.mul(It,Qt),St=tt.mul(Ot,Ft),kt=tt.add(St,kt),St=tt.sub(Yt,kt),kt=tt.add(Yt,kt),At=tt.mul(St,kt),Yt=tt.add(Nt,Nt),Yt=tt.add(Yt,Nt),Ft=tt.mul(It,Ft),Qt=tt.mul(Ot,Qt),Yt=tt.add(Yt,Ft),Ft=tt.sub(Nt,Ft),Ft=tt.mul(It,Ft),Qt=tt.add(Qt,Ft),Nt=tt.mul(Yt,Qt),At=tt.add(At,Nt),Nt=tt.mul(Vt,Qt),St=tt.mul(Ht,St),St=tt.sub(St,Nt),Nt=tt.mul(Ht,Yt),kt=tt.mul(Vt,kt),kt=tt.add(kt,Nt),new ht(St,At,kt)}subtract(gt){return this.add(gt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(gt){return ft.wNAFCached(this,gt,ht.normalizeZ)}multiplyUnsafe(gt){aInRange("scalar",gt,_0n$3,o.n);const yt=ht.ZERO;if(gt===_0n$3)return yt;if(gt===_1n$5)return this;const{endo:bt}=o;if(!bt)return ft.unsafeLadder(this,gt);let{k1neg:xt,k1:vt,k2neg:Et,k2:Ct}=bt.splitScalar(gt),St=yt,At=yt,kt=this;for(;vt>_0n$3||Ct>_0n$3;)vt&_1n$5&&(St=St.add(kt)),Ct&_1n$5&&(At=At.add(kt)),kt=kt.double(),vt>>=_1n$5,Ct>>=_1n$5;return xt&&(St=St.negate()),Et&&(At=At.negate()),At=new ht(tt.mul(At.px,bt.beta),At.py,At.pz),St.add(At)}multiply(gt){const{endo:yt,n:bt}=o;aInRange("scalar",gt,_1n$5,bt);let xt,vt;if(yt){const{k1neg:Et,k1:Ct,k2neg:St,k2:At}=yt.splitScalar(gt);let{p:kt,f:It}=this.wNAF(Ct),{p:Ot,f:Nt}=this.wNAF(At);kt=ft.constTimeNegate(Et,kt),Ot=ft.constTimeNegate(St,Ot),Ot=new ht(tt.mul(Ot.px,yt.beta),Ot.py,Ot.pz),xt=kt.add(Ot),vt=It.add(Nt)}else{const{p:Et,f:Ct}=this.wNAF(gt);xt=Et,vt=Ct}return ht.normalizeZ([xt,vt])[0]}multiplyAndAddUnsafe(gt,yt,bt){const xt=ht.BASE,vt=(Ct,St)=>St===_0n$3||St===_1n$5||!Ct.equals(xt)?Ct.multiplyUnsafe(St):Ct.multiply(St),Et=vt(this,yt).add(vt(gt,bt));return Et.is0()?void 0:Et}toAffine(gt){return lt(this,gt)}isTorsionFree(){const{h:gt,isTorsionFree:yt}=o;if(gt===_1n$5)return!0;if(yt)return yt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:gt,clearCofactor:yt}=o;return gt===_1n$5?this:yt?yt(ht,this):this.multiplyUnsafe(o.h)}toRawBytes(gt=!0){return abool("isCompressed",gt),this.assertValidity(),nt(ht,this,gt)}toHex(gt=!0){return abool("isCompressed",gt),bytesToHex$2(this.toRawBytes(gt))}}ht.BASE=new ht(o.Gx,o.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const mt=o.nBitLength,ft=wNAF(ht,o.endo?Math.ceil(mt/2):mt);return{CURVE:o,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(et){const o=validateBasic(et);return validateObject(o,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...o})}function weierstrass$1(et){const o=validateOpts$2(et),{Fp:tt,n:rt}=o,nt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(Ft){return mod$1(Ft,rt)}function st(Ft){return invert$1(Ft,rt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...o,toBytes(Ft,Ht,Qt){const Vt=Ht.toAffine(),Bt=tt.toBytes(Vt.x),Wt=concatBytes$1;return abool("isCompressed",Qt),Qt?Wt(Uint8Array.from([Ht.hasEvenY()?2:3]),Bt):Wt(Uint8Array.from([4]),Bt,tt.toBytes(Vt.y))},fromBytes(Ft){const Ht=Ft.length,Qt=Ft[0],Vt=Ft.subarray(1);if(Ht===nt&&(Qt===2||Qt===3)){const Bt=bytesToNumberBE(Vt);if(!inRange(Bt,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const Wt=lt(Bt);let jt;try{jt=tt.sqrt(Wt)}catch(Pt){const Gt=Pt instanceof Error?": "+Pt.message:"";throw new Error("Point is not on curve"+Gt)}const Xt=(jt&_1n$5)===_1n$5;return(Qt&1)===1!==Xt&&(jt=tt.neg(jt)),{x:Bt,y:jt}}else if(Ht===ot&&Qt===4){const Bt=tt.fromBytes(Vt.subarray(0,tt.BYTES)),Wt=tt.fromBytes(Vt.subarray(tt.BYTES,2*tt.BYTES));return{x:Bt,y:Wt}}else throw new Error(`Point of length ${Ht} was invalid. Expected ${nt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=Ft=>bytesToHex$2(numberToBytesBE(Ft,o.nByteLength));function mt(Ft){const Ht=rt>>_1n$5;return Ft>Ht}function ft(Ft){return mt(Ft)?it(-Ft):Ft}const pt=(Ft,Ht,Qt)=>bytesToNumberBE(Ft.slice(Ht,Qt));class gt{constructor(Ht,Qt,Vt){this.r=Ht,this.s=Qt,this.recovery=Vt,this.assertValidity()}static fromCompact(Ht){const Qt=o.nByteLength;return Ht=ensureBytes$1("compactSignature",Ht,Qt*2),new gt(pt(Ht,0,Qt),pt(Ht,Qt,2*Qt))}static fromDER(Ht){const{r:Qt,s:Vt}=DER.toSig(ensureBytes$1("DER",Ht));return new gt(Qt,Vt)}assertValidity(){aInRange("r",this.r,_1n$5,rt),aInRange("s",this.s,_1n$5,rt)}addRecoveryBit(Ht){return new gt(this.r,this.s,Ht)}recoverPublicKey(Ht){const{r:Qt,s:Vt,recovery:Bt}=this,Wt=Ct(ensureBytes$1("msgHash",Ht));if(Bt==null||![0,1,2,3].includes(Bt))throw new Error("recovery id invalid");const jt=Bt===2||Bt===3?Qt+o.n:Qt;if(jt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Xt=Bt&1?"03":"02",Kt=at.fromHex(Xt+ht(jt)),Pt=st(jt),Gt=it(-Wt*Pt),tr=it(Vt*Pt),zt=at.BASE.multiplyAndAddUnsafe(Kt,Gt,tr);if(!zt)throw new Error("point at infinify");return zt.assertValidity(),zt}hasHighS(){return mt(this.s)}normalizeS(){return this.hasHighS()?new gt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const yt={isValidPrivateKey(Ft){try{return ct(Ft),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const Ft=getMinHashLength(o.n);return mapHashToField(o.randomBytes(Ft),o.n)},precompute(Ft=8,Ht=at.BASE){return Ht._setWindowSize(Ft),Ht.multiply(BigInt(3)),Ht}};function bt(Ft,Ht=!0){return at.fromPrivateKey(Ft).toRawBytes(Ht)}function xt(Ft){const Ht=isBytes$2(Ft),Qt=typeof Ft=="string",Vt=(Ht||Qt)&&Ft.length;return Ht?Vt===nt||Vt===ot:Qt?Vt===2*nt||Vt===2*ot:Ft instanceof at}function vt(Ft,Ht,Qt=!0){if(xt(Ft))throw new Error("first arg must be private key");if(!xt(Ht))throw new Error("second arg must be public key");return at.fromHex(Ht).multiply(ct(Ft)).toRawBytes(Qt)}const Et=o.bits2int||function(Ft){const Ht=bytesToNumberBE(Ft),Qt=Ft.length*8-o.nBitLength;return Qt>0?Ht>>BigInt(Qt):Ht},Ct=o.bits2int_modN||function(Ft){return it(Et(Ft))},St=bitMask(o.nBitLength);function At(Ft){return aInRange(`num < 2^${o.nBitLength}`,Ft,_0n$3,St),numberToBytesBE(Ft,o.nByteLength)}function kt(Ft,Ht,Qt=It){if(["recovered","canonical"].some(rr=>rr in Qt))throw new Error("sign() legacy options not supported");const{hash:Vt,randomBytes:Bt}=o;let{lowS:Wt,prehash:jt,extraEntropy:Xt}=Qt;Wt==null&&(Wt=!0),Ft=ensureBytes$1("msgHash",Ft),validateSigVerOpts(Qt),jt&&(Ft=ensureBytes$1("prehashed msgHash",Vt(Ft)));const Kt=Ct(Ft),Pt=ct(Ht),Gt=[At(Pt),At(Kt)];if(Xt!=null&&Xt!==!1){const rr=Xt===!0?Bt(tt.BYTES):Xt;Gt.push(ensureBytes$1("extraEntropy",rr))}const tr=concatBytes$1(...Gt),zt=Kt;function lr(rr){const Jt=Et(rr);if(!dt(Jt))return;const Rt=st(Jt),Mt=at.BASE.multiply(Jt).toAffine(),Ut=it(Mt.x);if(Ut===_0n$3)return;const Zt=it(Rt*it(zt+Ut*Pt));if(Zt===_0n$3)return;let nr=(Mt.x===Ut?0:2)|Number(Mt.y&_1n$5),ar=Zt;return Wt&&mt(Zt)&&(ar=ft(Zt),nr^=1),new gt(Ut,ar,nr)}return{seed:tr,k2sig:lr}}const It={lowS:o.lowS,prehash:!1},Ot={lowS:o.lowS,prehash:!1};function Nt(Ft,Ht,Qt=It){const{seed:Vt,k2sig:Bt}=kt(Ft,Ht,Qt),Wt=o;return createHmacDrbg(Wt.hash.outputLen,Wt.nByteLength,Wt.hmac)(Vt,Bt)}at.BASE._setWindowSize(8);function Yt(Ft,Ht,Qt,Vt=Ot){var Mt;const Bt=Ft;if(Ht=ensureBytes$1("msgHash",Ht),Qt=ensureBytes$1("publicKey",Qt),"strict"in Vt)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Vt);const{lowS:Wt,prehash:jt}=Vt;let Xt,Kt;try{if(typeof Bt=="string"||isBytes$2(Bt))try{Xt=gt.fromDER(Bt)}catch(Ut){if(!(Ut instanceof DER.Err))throw Ut;Xt=gt.fromCompact(Bt)}else if(typeof Bt=="object"&&typeof Bt.r=="bigint"&&typeof Bt.s=="bigint"){const{r:Ut,s:Zt}=Bt;Xt=new gt(Ut,Zt)}else throw new Error("PARSE");Kt=at.fromHex(Qt)}catch(Ut){if(Ut.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Wt&&Xt.hasHighS())return!1;jt&&(Ht=o.hash(Ht));const{r:Pt,s:Gt}=Xt,tr=Ct(Ht),zt=st(Gt),lr=it(tr*zt),rr=it(Pt*zt),Jt=(Mt=at.BASE.multiplyAndAddUnsafe(Kt,lr,rr))==null?void 0:Mt.toAffine();return Jt?it(Jt.x)===Pt:!1}return{CURVE:o,getPublicKey:bt,getSharedSecret:vt,sign:Nt,verify:Yt,ProjectivePoint:at,Signature:gt,utils:yt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(et){return{hash:et,hmac:(o,...tt)=>hmac(et,o,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(et,o){const tt=rt=>weierstrass$1({...et,...getHash(rt)});return Object.freeze({...tt(o),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(et,o)=>(et+o/_2n$3)/o;function sqrtMod$1(et){const o=secp256k1P,tt=BigInt(3),rt=BigInt(6),nt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=et*et*et%o,lt=ct*ct*et%o,dt=pow2$1(lt,tt,o)*lt%o,ht=pow2$1(dt,tt,o)*lt%o,mt=pow2$1(ht,_2n$3,o)*ct%o,ft=pow2$1(mt,nt,o)*mt%o,pt=pow2$1(ft,ot,o)*ft%o,gt=pow2$1(pt,st,o)*pt%o,yt=pow2$1(gt,at,o)*gt%o,bt=pow2$1(yt,st,o)*pt%o,xt=pow2$1(bt,tt,o)*lt%o,vt=pow2$1(xt,it,o)*ft%o,Et=pow2$1(vt,rt,o)*ct%o,Ct=pow2$1(Et,_2n$3,o);if(!Fp$1.eql(Fp$1.sqr(Ct),et))throw new Error("Cannot find square root");return Ct}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:et=>{const o=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),rt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),nt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*et,o),at=divNearest$1(-rt*et,o);let ct=mod$1(et-st*tt-at*nt,o),lt=mod$1(-st*rt-at*ot,o);const dt=ct>it,ht=lt>it;if(dt&&(ct=o-ct),ht&&(lt=o-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+et);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$3);BigInt(0);secp256k1.ProjectivePoint;function getAction(et,o,tt){const rt=et[o.name];if(typeof rt=="function")return rt;const nt=et[tt];return typeof nt=="function"?nt:ot=>o(et,ot)}const version$6="2.13.8",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$2=function(et,o,tt,rt){if(tt==="a"&&!rt)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?et!==o||!rt:!o.has(et))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?rt:tt==="a"?rt.call(et):rt?rt.value:o.get(et)},_BaseError_instances,_BaseError_walk;let BaseError$1=class _s extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(o,tt={}){var ot;super(),_BaseError_instances.add(this),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:"WagmiCoreError"});const rt=tt.cause instanceof _s?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,nt=tt.cause instanceof _s&&tt.cause.docsPath||tt.docsPath;this.message=[o||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...nt?[`Docs: ${this.docsBaseUrl}${nt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...rt?[`Details: ${rt}`]:[],`Version: ${this.version}`].join(` -`),tt.cause&&(this.cause=tt.cause),this.details=rt,this.docsPath=nt,this.metaMessages=tt.metaMessages,this.shortMessage=o}walk(o){return __classPrivateFieldGet$2(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,o)}};_BaseError_instances=new WeakSet,_BaseError_walk=function et(o,tt){return tt!=null&&tt(o)?o:o.cause?__classPrivateFieldGet$2(this,_BaseError_instances,"m",et).call(this,o.cause,tt):o};class ChainNotConfiguredError extends BaseError$1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$1{constructor({address:o,connector:tt}){super(`Account "${o}" not found for connector "${tt.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$1{constructor({connectionChainId:o,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${o}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${o}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:o}){super(`Connector "${o.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function connect$1(et,o){var rt;let tt;if(typeof o.connector=="function"?tt=et._internal.connectors.setup(o.connector):tt=o.connector,tt.uid===et.state.current)throw new ConnectorAlreadyConnectedError;try{et.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const nt=await tt.connect({chainId:o.chainId}),ot=nt.accounts;return tt.emitter.off("connect",et._internal.events.connect),tt.emitter.on("change",et._internal.events.change),tt.emitter.on("disconnect",et._internal.events.disconnect),await((rt=et.storage)==null?void 0:rt.setItem("recentConnectorId",tt.id)),et.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:nt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:nt.chainId}}catch(nt){throw et.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),nt}}const size$1=256;let index$3=size$1,buffer$2;function uid$1(et=11){if(!buffer$2||index$3+et>size$1*2){buffer$2="",index$3=0;for(let o=0;o{const bt=yt(gt);for(const vt in ft)delete bt[vt];const xt={...gt,...bt};return Object.assign(xt,{extend:pt(xt)})}}return Object.assign(ft,{extend:pt(ft)})}function createTransport({key:et,name:o,request:tt,retryCount:rt=3,retryDelay:nt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:et,name:o,request:tt,retryCount:rt,retryDelay:nt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:rt,retryDelay:nt,uid:at}),value:st}}function custom$1(et,o={}){const{key:tt="custom",name:rt="Custom Provider",retryDelay:nt}=o;return({retryCount:ot})=>createTransport({key:tt,name:rt,request:et.request.bind(et),retryCount:o.retryCount??ot,retryDelay:nt,type:"custom"})}class UrlRequiredError extends BaseError$3{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function http(et,o={}){const{batch:tt,fetchOptions:rt,key:nt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=o;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:mt=0}=typeof tt=="object"?tt:{},ft=o.retryCount??lt,pt=dt??o.timeout??1e4,gt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!gt)throw new UrlRequiredError;const yt=getHttpRpcClient(gt,{fetchOptions:rt,onRequest:it,onResponse:st,timeout:pt});return createTransport({key:nt,name:ot,async request({method:bt,params:xt}){const vt={method:bt,params:xt},{schedule:Et}=createBatchScheduler({id:gt,wait:mt,shouldSplitBatch(kt){return kt.length>ht},fn:kt=>yt.request({body:kt}),sort:(kt,It)=>kt.id-It.id}),Ct=async kt=>tt?Et(kt):[await yt.request({body:kt})],[{error:St,result:At}]=await Ct(vt);if(St)throw new RpcRequestError({body:vt,error:St,url:gt});return At},retryCount:ft,retryDelay:at,timeout:pt,type:"http"},{fetchOptions:rt,url:gt})}}async function getConnectorClient(et,o={}){let tt;if(o.connector){const{connector:ct}=o;if(et.state.status==="reconnecting"&&!ct.getAccounts&&!ct.getChainId)throw new ConnectorUnavailableReconnectingError({connector:ct});const[lt,dt]=await Promise.all([ct.getAccounts(),ct.getChainId()]);tt={accounts:lt,chainId:dt,connector:ct}}else tt=et.state.connections.get(et.state.current);if(!tt)throw new ConnectorNotConnectedError;const rt=o.chainId??tt.chainId,nt=await tt.connector.getChainId();if(nt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:nt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:rt});const it=parseAccount(o.account??tt.accounts[0]);if(it.address=getAddress(it.address),o.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=et.chains.find(ct=>ct.id===rt),at=await tt.connector.getProvider({chainId:rt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom$1(at)({...ct,retryCount:0})})}async function disconnect(et,o={}){var nt,ot;let tt;if(o.connector)tt=o.connector;else{const{connections:it,current:st}=et.state,at=it.get(st);tt=at==null?void 0:at.connector}const rt=et.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",et._internal.events.change),tt.emitter.off("disconnect",et._internal.events.disconnect),tt.emitter.on("connect",et._internal.events.connect),rt.delete(tt.uid)),et.setState(it=>{if(rt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=rt.values().next().value;return{...it,connections:new Map(rt),current:st.connector.uid}});{const it=et.state.current;if(!it)return;const st=(nt=et.state.connections.get(it))==null?void 0:nt.connector;if(!st)return;await((ot=et.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(et){return typeof et=="number"?et:et==="wei"?0:Math.abs(weiUnits[et])}function getAccount(et){const o=et.state.current,tt=et.state.connections.get(o),rt=tt==null?void 0:tt.accounts,nt=rt==null?void 0:rt[0],ot=et.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=et.state.status;switch(it){case"connected":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:it};case"reconnecting":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!nt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:it};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:it}}}async function multicall(et,o){const{allowFailure:tt=!0,chainId:rt,contracts:nt,...ot}=o,it=et.getClient({chainId:rt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:nt,...ot})}function readContract(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,readContract$1,"readContract")(rt)}async function readContracts(et,o){var st;const{allowFailure:tt=!0,blockNumber:rt,blockTag:nt,...ot}=o,it=o.contracts;try{const at={};for(const[ht,mt]of it.entries()){const ft=mt.chainId??et.state.chainId;at[ft]||(at[ft]=[]),(st=at[ft])==null||st.push({contract:mt,index:ht})}const ct=()=>Object.entries(at).map(([ht,mt])=>multicall(et,{...ot,allowFailure:tt,blockNumber:rt,blockTag:nt,chainId:Number.parseInt(ht),contracts:mt.map(({contract:ft})=>ft)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:mt})=>mt));return lt.reduce((ht,mt,ft)=>(ht&&(ht[dt[ft]]=mt),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(et,{...lt,blockNumber:rt,blockTag:nt}));return tt?(await Promise.allSettled(ct())).map(lt=>lt.status==="fulfilled"?{result:lt.value,status:"success"}:{error:lt.reason,result:void 0,status:"failure"}):await Promise.all(ct())}}async function getBalance(et,o){const{address:tt,blockNumber:rt,blockTag:nt,chainId:ot,token:it,unit:st="ether"}=o;if(it)try{return getTokenBalance(et,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht instanceof ContractFunctionExecutionError){const mt=await getTokenBalance(et,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),ft=hexToString(trim$1(mt.symbol,{dir:"right"}));return{...mt,symbol:ft}}throw ht}const at=et.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(rt?{address:tt,blockNumber:rt}:{address:tt,blockTag:nt}),dt=et.chains.find(ht=>ht.id===ot)??at.chain;return{decimals:dt.nativeCurrency.decimals,formatted:formatUnits(lt,getUnit(st)),symbol:dt.nativeCurrency.symbol,value:lt}}async function getTokenBalance(et,o){const{balanceAddress:tt,chainId:rt,symbolType:nt,tokenAddress:ot,unit:it}=o,st={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:nt}]}],address:ot},[at,ct,lt]=await readContracts(et,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:rt},{...st,functionName:"decimals",chainId:rt},{...st,functionName:"symbol",chainId:rt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(et,o={}){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getBlockNumber$1,"getBlockNumber")(rt)}function getChainId(et){return et.state.chainId}function deepEqual(et,o){if(et===o)return!0;if(et&&o&&typeof et=="object"&&typeof o=="object"){if(et.constructor!==o.constructor)return!1;let tt,rt;if(Array.isArray(et)&&Array.isArray(o)){if(tt=et.length,tt!==o.length)return!1;for(rt=tt;rt--!==0;)if(!deepEqual(et[rt],o[rt]))return!1;return!0}if(et.valueOf!==Object.prototype.valueOf)return et.valueOf()===o.valueOf();if(et.toString!==Object.prototype.toString)return et.toString()===o.toString();const nt=Object.keys(et);if(tt=nt.length,tt!==Object.keys(o).length)return!1;for(rt=tt;rt--!==0;)if(!Object.prototype.hasOwnProperty.call(o,nt[rt]))return!1;for(rt=tt;rt--!==0;){const ot=nt[rt];if(ot&&!deepEqual(et[ot],o[ot]))return!1}return!0}return et!==et&&o!==o}let previousChains=[];function getChains(et){const o=et.chains;return deepEqual(previousChains,o)?previousChains:(previousChains=o,o)}let previousConnections=[];function getConnections(et){const o=[...et.state.connections.values()];return et.state.status==="reconnecting"||deepEqual(previousConnections,o)?previousConnections:(previousConnections=o,o)}let previousConnectors=[];function getConnectors(et){const o=et.connectors;return deepEqual(previousConnectors,o)?previousConnectors:(previousConnectors=o,o)}function getEnsAddress(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsAddress$1,"getEnsAddress")(rt)}function getEnsAvatar(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsAvatar$1,"getEnsAvatar")(rt)}function getEnsName(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsName$1,"getEnsName")(rt)}let isReconnecting=!1;async function reconnect(et,o={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,et.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=o.connectors)!=null&&ct.length)for(const dt of o.connectors){let ht;typeof dt=="function"?ht=et._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...et.connectors);let rt;try{rt=await((lt=et.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const nt={};for(const[,dt]of et.state.connections)nt[dt.connector.id]=1;rt&&(nt[rt]=0);const ot=Object.keys(nt).length>0?[...tt].sort((dt,ht)=>(nt[dt.id]??10)-(nt[ht.id]??10)):tt;let it=!1;const st=[],at=[];for(const dt of ot){const ht=await dt.getProvider().catch(()=>{});if(!ht||at.some(pt=>pt===ht)||!await dt.isAuthorized())continue;const ft=await dt.connect({isReconnecting:!0}).catch(()=>null);ft&&(dt.emitter.off("connect",et._internal.events.connect),dt.emitter.on("change",et._internal.events.change),dt.emitter.on("disconnect",et._internal.events.disconnect),et.setState(pt=>{const gt=new Map(it?pt.connections:new Map).set(dt.uid,{accounts:ft.accounts,chainId:ft.chainId,connector:dt});return{...pt,current:it?pt.current:dt.uid,connections:gt}}),st.push({accounts:ft.accounts,chainId:ft.chainId,connector:dt}),at.push(ht),it=!0)}return(et.state.status==="reconnecting"||et.state.status==="connecting")&&(it?et.setState(dt=>({...dt,status:"connected"})):et.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(et,o){const{account:tt,connector:rt,...nt}=o;let ot;return typeof tt=="object"&&tt.type==="local"?ot=et.getClient():ot=await getConnectorClient(et,{account:tt,connector:rt}),getAction(ot,signMessage$1,"signMessage")({...nt,...tt?{account:tt}:{}})}class ProviderNotFoundError extends BaseError$1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$1{constructor({connector:o}){super(`"${o.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(et,o){var it;const{addEthereumChainParameter:tt,chainId:rt}=o,nt=et.state.connections.get(((it=o.connector)==null?void 0:it.uid)??et.state.current);if(nt){const st=nt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:rt})}const ot=et.chains.find(st=>st.id===rt);if(!ot)throw new ChainNotConfiguredError;return et.setState(st=>({...st,chainId:rt})),ot}function watchAccount(et,o){const{onChange:tt}=o;return et.subscribe(()=>getAccount(et),tt,{equalityFn(rt,nt){const{connector:ot,...it}=rt,{connector:st,...at}=nt;return deepEqual(it,at)&&(ot==null?void 0:ot.id)===(st==null?void 0:st.id)&&(ot==null?void 0:ot.uid)===(st==null?void 0:st.uid)}})}function watchBlockNumber(et,o){const{syncConnectedChain:tt=et._internal.syncConnectedChain,...rt}=o;let nt;const ot=at=>{nt&&nt();const ct=et.getClient({chainId:at});return nt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(rt),nt},it=ot(o.chainId);let st;return tt&&!o.chainId&&(st=et.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(et,o){const{onChange:tt}=o;return et.subscribe(rt=>rt.chainId,tt)}function watchConnections(et,o){const{onChange:tt}=o;return et.subscribe(()=>getConnections(et),tt,{equalityFn:deepEqual})}function watchConnectors(et,o){const{onChange:tt}=o;return et._internal.connectors.subscribe((rt,nt)=>{tt(Object.values(rt),nt)})}function createConnector(et){return et}const supportsSimulationIdRegex=/(rabby|trustwallet)/,targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(et){return et!=null&&et.coinbaseWalletExtension?et.coinbaseWalletExtension:findProvider(et,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(et){return findProvider(et,o=>{if(!o.isMetaMask||o.isBraveWallet&&!o._events&&!o._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isZerion"];for(const rt of tt)if(o[rt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(et){var o,tt;return(o=et==null?void 0:et.phantom)!=null&&o.ethereum?(tt=et.phantom)==null?void 0:tt.ethereum:findProvider(et,"isPhantom")}}};injected.type="injected";function injected(et={}){const{shimDisconnect:o=!0,unstable_shimAsyncInject:tt}=et;function rt(){const at=et.target;if(typeof at=="function"){const ct=at();if(ct)return ct}return typeof at=="object"?at:typeof at=="string"?{...targetMap[at]??{id:at,name:`${at[0].toUpperCase()}${at.slice(1)}`,provider:`is${at[0].toUpperCase()}${at.slice(1)}`}}:{id:"injected",name:"Injected",provider(ct){return ct==null?void 0:ct.ethereum}}}let nt,ot,it,st;return at=>({get icon(){return rt().icon},get id(){return rt().id},get name(){return rt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&et.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),nt||(nt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",nt)))},async connect({chainId:ct,isReconnecting:lt}={}){var mt,ft,pt,gt,yt,bt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(o)try{ht=(gt=(pt=(ft=(mt=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:mt.caveats)==null?void 0:ft[0])==null?void 0:pt.value)==null?void 0:gt.map(vt=>getAddress(vt)),ht.length>0&&(ht=await this.getAccounts())}catch(xt){const vt=xt;if(vt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(vt);if(vt.code===ResourceUnavailableRpcError.code)throw vt}try{!(ht!=null&&ht.length)&&!lt&&(ht=(await dt.request({method:"eth_requestAccounts"})).map(Et=>getAddress(Et))),it&&(dt.removeListener("connect",it),it=void 0),nt||(nt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let xt=await this.getChainId();if(ct&&xt!==ct){const vt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:xt}});xt=(vt==null?void 0:vt.id)??xt}return o&&await((yt=at.storage)==null?void 0:yt.removeItem(`${this.id}.disconnected`)),et.target||await((bt=at.storage)==null?void 0:bt.setItem("injected.connected",!0)),{accounts:ht,chainId:xt}}catch(xt){const vt=xt;throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):vt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(vt):vt}},async disconnect(){var lt,dt;const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;ot&&(ct.removeListener("chainChanged",ot),ot=void 0),st&&(ct.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),ct.on("connect",it));try{await withTimeout(()=>ct.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}o&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),et.target||await((dt=at.storage)==null?void 0:dt.removeItem("injected.connected"))},async getAccounts(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;return(await ct.request({method:"eth_accounts"})).map(dt=>getAddress(dt))},async getChainId(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;const lt=await ct.request({method:"eth_chainId"});return Number(lt)},async getProvider(){if(typeof window>"u")return;let ct;const lt=rt();return typeof lt.provider=="function"?ct=lt.provider(window):typeof lt.provider=="string"?ct=findProvider(window,lt.provider):ct=lt.provider,ct&&!ct.removeListener&&("off"in ct&&typeof ct.off=="function"?ct.removeListener=ct.off:ct.removeListener=()=>{}),ct},async isAuthorized(){var ct,lt;try{if(o&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!et.target&&!await((lt=at.storage)==null?void 0:lt.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(tt!==void 0&&tt!==!1){const ft=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",ft),!!await this.getProvider()),pt=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(yt=>window.addEventListener("ethereum#initialized",()=>yt(ft()),{once:!0}))]:[],new Promise(yt=>setTimeout(()=>yt(ft()),pt))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,ft,pt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(yt=>yt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);try{return await Promise.all([dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt)}]}).then(async()=>{await this.getChainId()===lt&&at.emitter.emit("change",{chainId:lt})}),new Promise(yt=>{const bt=xt=>{"chainId"in xt&&xt.chainId===lt&&(at.emitter.off("change",bt),yt())};at.emitter.on("change",bt)})]),ht}catch(yt){const bt=yt;if(bt.code===4902||((ft=(mt=bt==null?void 0:bt.data)==null?void 0:mt.originalError)==null?void 0:ft.code)===4902)try{const{default:xt,...vt}=ht.blockExplorers??{};let Et;ct!=null&&ct.blockExplorerUrls?Et=ct.blockExplorerUrls:xt&&(Et=[xt.url,...Object.values(vt).map(kt=>kt.url)]);let Ct;(pt=ct==null?void 0:ct.rpcUrls)!=null&&pt.length?Ct=ct.rpcUrls:Ct=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const St={blockExplorerUrls:Et,chainId:numberToHex(lt),chainName:(ct==null?void 0:ct.chainName)??ht.name,iconUrls:ct==null?void 0:ct.iconUrls,nativeCurrency:(ct==null?void 0:ct.nativeCurrency)??ht.nativeCurrency,rpcUrls:Ct};if(await dt.request({method:"wallet_addEthereumChain",params:[St]}),await this.getChainId()!==lt)throw new UserRejectedRequestError(new Error("User rejected switch after adding network."));return ht}catch(xt){throw new UserRejectedRequestError(xt)}throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):new SwitchChainError(bt)}},async onAccountsChanged(ct){var lt;if(ct.length===0)this.onDisconnect();else if(at.emitter.listenerCount("connect")){const dt=(await this.getChainId()).toString();this.onConnect({chainId:dt}),o&&await((lt=at.storage)==null?void 0:lt.removeItem(`${this.id}.disconnected`))}else at.emitter.emit("change",{accounts:ct.map(dt=>getAddress(dt))})},onChainChanged(ct){const lt=Number(ct);at.emitter.emit("change",{chainId:lt})},async onConnect(ct){const lt=await this.getAccounts();if(lt.length===0)return;const dt=Number(ct.chainId);at.emitter.emit("connect",{accounts:lt,chainId:dt});const ht=await this.getProvider();ht&&(it&&(ht.removeListener("connect",it),it=void 0),nt||(nt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),ht.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),ht.on("disconnect",st)))},async onDisconnect(ct){const lt=await this.getProvider();ct&&ct.code===1013&<&&(await this.getAccounts()).length||(at.emitter.emit("disconnect"),lt&&(ot&&(lt.removeListener("chainChanged",ot),ot=void 0),st&&(lt.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),lt.on("connect",it))))}})}function findProvider(et,o){function tt(nt){return typeof o=="function"?o(nt):typeof o=="string"?nt[o]:!0}const rt=et.ethereum;if(rt!=null&&rt.providers)return rt.providers.find(nt=>tt(nt));if(rt&&tt(rt))return rt}function requestProviders(et){if(typeof window>"u")return;const o=tt=>et(tt.detail);return window.addEventListener("eip6963:announceProvider",o),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",o)}function createStore$1(){const et=new Set;let o=[];const tt=()=>requestProviders(nt=>{o.some(({info:ot})=>ot.uuid===nt.info.uuid)||(o=[...o,nt],et.forEach(ot=>ot(o,{added:[nt]})))});let rt=tt();return{_listeners(){return et},clear(){et.forEach(nt=>nt([],{removed:[...o]})),o=[]},destroy(){this.clear(),et.clear(),rt==null||rt()},findProvider({rdns:nt}){return o.find(ot=>ot.info.rdns===nt)},getProviders(){return o},reset(){this.clear(),rt==null||rt(),rt=tt()},subscribe(nt,{emitImmediately:ot}={}){return et.add(nt),ot&&nt(o,{added:o}),()=>et.delete(nt)}}}const __vite_import_meta_env__$2={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},subscribeWithSelectorImpl=et=>(o,tt,rt)=>{const nt=rt.subscribe;return rt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(rt.getState());ct=ht=>{const mt=it(ht);if(!lt(dt,mt)){const ft=dt;st(dt=mt,ft)}},at!=null&&at.fireImmediately&&st(dt,dt)}return nt(ct)},et(o,tt,rt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(et,o){let tt;try{tt=et()}catch{return}return{getItem:nt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(nt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(nt,ot)=>tt.setItem(nt,JSON.stringify(ot,void 0)),removeItem:nt=>tt.removeItem(nt)}}const toThenable=et=>o=>{try{const tt=et(o);return tt instanceof Promise?tt:{then(rt){return toThenable(rt)(tt)},catch(rt){return this}}}catch(tt){return{then(rt){return this},catch(rt){return toThenable(rt)(tt)}}}},oldImpl=(et,o)=>(tt,rt,nt)=>{let ot={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:gt=>gt,version:0,merge:(gt,yt)=>({...yt,...gt}),...o},it=!1;const st=new Set,at=new Set;let ct;try{ct=ot.getStorage()}catch{}if(!ct)return et((...gt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...gt)},rt,nt);const lt=toThenable(ot.serialize),dt=()=>{const gt=ot.partialize({...rt()});let yt;const bt=lt({state:gt,version:ot.version}).then(xt=>ct.setItem(ot.name,xt)).catch(xt=>{yt=xt});if(yt)throw yt;return bt},ht=nt.setState;nt.setState=(gt,yt)=>{ht(gt,yt),dt()};const mt=et((...gt)=>{tt(...gt),dt()},rt,nt);let ft;const pt=()=>{var gt;if(!ct)return;it=!1,st.forEach(bt=>bt(rt()));const yt=((gt=ot.onRehydrateStorage)==null?void 0:gt.call(ot,rt()))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(bt=>{if(bt)return ot.deserialize(bt)}).then(bt=>{if(bt)if(typeof bt.version=="number"&&bt.version!==ot.version){if(ot.migrate)return ot.migrate(bt.state,bt.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return bt.state}).then(bt=>{var xt;return ft=ot.merge(bt,(xt=rt())!=null?xt:mt),tt(ft,!0),dt()}).then(()=>{yt==null||yt(ft,void 0),it=!0,at.forEach(bt=>bt(ft))}).catch(bt=>{yt==null||yt(void 0,bt)})};return nt.persist={setOptions:gt=>{ot={...ot,...gt},gt.getStorage&&(ct=gt.getStorage())},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>pt(),hasHydrated:()=>it,onHydrate:gt=>(st.add(gt),()=>{st.delete(gt)}),onFinishHydration:gt=>(at.add(gt),()=>{at.delete(gt)})},pt(),ft||mt},newImpl=(et,o)=>(tt,rt,nt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:pt=>pt,version:0,merge:(pt,gt)=>({...gt,...pt}),...o},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return et((...pt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...pt)},rt,nt);const lt=()=>{const pt=ot.partialize({...rt()});return ct.setItem(ot.name,{state:pt,version:ot.version})},dt=nt.setState;nt.setState=(pt,gt)=>{dt(pt,gt),lt()};const ht=et((...pt)=>{tt(...pt),lt()},rt,nt);let mt;const ft=()=>{var pt,gt;if(!ct)return;it=!1,st.forEach(bt=>{var xt;return bt((xt=rt())!=null?xt:ht)});const yt=((gt=ot.onRehydrateStorage)==null?void 0:gt.call(ot,(pt=rt())!=null?pt:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(bt=>{if(bt)if(typeof bt.version=="number"&&bt.version!==ot.version){if(ot.migrate)return ot.migrate(bt.state,bt.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return bt.state}).then(bt=>{var xt;return mt=ot.merge(bt,(xt=rt())!=null?xt:ht),tt(mt,!0),lt()}).then(()=>{yt==null||yt(mt,void 0),mt=rt(),it=!0,at.forEach(bt=>bt(mt))}).catch(bt=>{yt==null||yt(void 0,bt)})};return nt.persist={setOptions:pt=>{ot={...ot,...pt},pt.storage&&(ct=pt.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>ft(),hasHydrated:()=>it,onHydrate:pt=>(st.add(pt),()=>{st.delete(pt)}),onFinishHydration:pt=>(at.add(pt),()=>{at.delete(pt)})},ot.skipHydration||ft(),mt||ht},persistImpl=(et,o)=>"getStorage"in o||"serialize"in o||"deserialize"in o?((__vite_import_meta_env__$2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),oldImpl(et,o)):newImpl(et,o),persist=persistImpl,__vite_import_meta_env__$1={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},createStoreImpl=et=>{let o;const tt=new Set,rt=(at,ct)=>{const lt=typeof at=="function"?at(o):at;if(!Object.is(lt,o)){const dt=o;o=ct??typeof lt!="object"?lt:Object.assign({},o,lt),tt.forEach(ht=>ht(o,dt))}},nt=()=>o,st={setState:rt,getState:nt,subscribe:at=>(tt.add(at),()=>tt.delete(at)),destroy:()=>{(__vite_import_meta_env__$1?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),tt.clear()}};return o=et(rt,nt,st),st},createStore=et=>et?createStoreImpl(et):createStoreImpl;var eventemitter3={exports:{}};(function(et){var o=Object.prototype.hasOwnProperty,tt="~";function rt(){}Object.create&&(rt.prototype=Object.create(null),new rt().__proto__||(tt=!1));function nt(at,ct,lt){this.fn=at,this.context=ct,this.once=lt||!1}function ot(at,ct,lt,dt,ht){if(typeof lt!="function")throw new TypeError("The listener must be a function");var mt=new nt(lt,dt||at,ht),ft=tt?tt+ct:ct;return at._events[ft]?at._events[ft].fn?at._events[ft]=[at._events[ft],mt]:at._events[ft].push(mt):(at._events[ft]=mt,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new rt:delete at._events[ct]}function st(){this._events=new rt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)o.call(lt,dt)&&ct.push(tt?dt.slice(1):dt);return Object.getOwnPropertySymbols?ct.concat(Object.getOwnPropertySymbols(lt)):ct},st.prototype.listeners=function(ct){var lt=tt?tt+ct:ct,dt=this._events[lt];if(!dt)return[];if(dt.fn)return[dt.fn];for(var ht=0,mt=dt.length,ft=new Array(mt);ht{let nt=rt;return(nt==null?void 0:nt.__type)==="bigint"&&(nt=BigInt(nt.value)),(nt==null?void 0:nt.__type)==="Map"&&(nt=new Map(nt.value)),(o==null?void 0:o(tt,nt))??nt})}function getReferenceKey(et,o){return et.slice(0,o).join(".")||"."}function getCutoff(et,o){const{length:tt}=et;for(let rt=0;rt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(o==null?void 0:o(nt,it))??it},rt),tt??void 0)}function createStorage(et){const{deserialize:o=deserialize$1,key:tt="wagmi",serialize:rt=serialize$1,storage:nt=noopStorage}=et;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...nt,key:tt,async getItem(it,st){const at=nt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?o(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(nt.removeItem(at)):await ot(nt.setItem(at,rt(st)))},async removeItem(it){await ot(nt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer$1;function uid(et=11){if(!buffer$1||index$2+et>size*2){buffer$1="",index$2=0;for(let o=0;oot.chains),at=createStore(()=>[...ot.connectors??[],...nt?[]:(it==null?void 0:it.getProviders().map(lt))??[]].map(ct));function ct(Et){var At;const Ct=createEmitter(uid()),St={...Et({emitter:Ct,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:Ct,uid:Ct.uid};return Ct.on("connect",xt),(At=St.setup)==null||At.call(St),St}function lt(Et){const{info:Ct}=Et,St=Et.provider;return injected({target:{...Ct,id:Ct.rdns,provider:St}})}const dt=new Map;function ht(Et={}){const Ct=Et.chainId??gt.getState().chainId,St=st.getState().find(kt=>kt.id===Ct);if(Et.chainId&&!St)throw new ChainNotConfiguredError;{const kt=dt.get(gt.getState().chainId);if(kt&&!St)return kt;if(!St)throw new ChainNotConfiguredError}{const kt=dt.get(Ct);if(kt)return kt}let At;if(ot.client)At=ot.client({chain:St});else{const kt=St.id,It=st.getState().map(Yt=>Yt.id),Ot={},Nt=Object.entries(ot);for(const[Yt,Ft]of Nt)if(!(Yt==="chains"||Yt==="client"||Yt==="connectors"||Yt==="transports"))if(typeof Ft=="object")if(kt in Ft)Ot[Yt]=Ft[kt];else{if(It.some(Qt=>Qt in Ft))continue;Ot[Yt]=Ft}else Ot[Yt]=Ft;At=createClient({...Ot,chain:St,batch:Ot.batch??{multicall:!0},transport:Yt=>ot.transports[kt]({...Yt,connectors:at})})}return dt.set(Ct,At),At}function mt(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let ft;const pt="0.0.0-canary-";version$6.startsWith(pt)?ft=Number.parseInt(version$6.replace(pt,"")):ft=Number.parseInt(version$6.split(".")[0]??"0");const gt=createStore(subscribeWithSelector(tt?persist(mt,{migrate(Et,Ct){if(Ct===ft)return Et;const St=mt(),At=yt(Et,St.chainId);return{...St,chainId:At}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([Ct,St])=>{const{id:At,name:kt,type:It,uid:Ot}=St.connector;return[Ct,{...St,connector:{id:At,name:kt,type:It,uid:Ot}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,Ct){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const St=yt(Et,Ct.chainId);return{...Ct,...Et,chainId:St}},skipHydration:nt,storage:tt,version:ft}):mt));function yt(Et,Ct){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(St=>St.id===Et.chainId)?Et.chainId:Ct}rt&>.subscribe(({connections:Et,current:Ct})=>{var St;return Ct?(St=Et.get(Ct))==null?void 0:St.chainId:void 0},Et=>{if(st.getState().some(St=>St.id===Et))return gt.setState(St=>({...St,chainId:Et??St.chainId}))}),it==null||it.subscribe(Et=>{const Ct=new Map;for(const At of at.getState())Ct.set(At.id,!0);const St=[];for(const At of Et){const kt=ct(lt(At));Ct.has(kt.id)||St.push(kt)}tt&&!gt.persist.hasHydrated()||at.setState(At=>[...At,...St],!0)});function bt(Et){gt.setState(Ct=>{const St=Ct.connections.get(Et.uid);return St?{...Ct,connections:new Map(Ct.connections).set(Et.uid,{accounts:Et.accounts??St.accounts,chainId:Et.chainId??St.chainId,connector:St.connector})}:Ct})}function xt(Et){gt.getState().status==="connecting"||gt.getState().status==="reconnecting"||gt.setState(Ct=>{const St=at.getState().find(At=>At.uid===Et.uid);return St?(St.emitter.listenerCount("connect")&&St.emitter.off("connect",bt),St.emitter.listenerCount("change")||St.emitter.on("change",bt),St.emitter.listenerCount("disconnect")||St.emitter.on("disconnect",vt),{...Ct,connections:new Map(Ct.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:St}),current:Et.uid,status:"connected"}):Ct})}function vt(Et){gt.setState(Ct=>{const St=Ct.connections.get(Et.uid);if(St){const kt=St.connector;kt.emitter.listenerCount("change")&&St.connector.emitter.off("change",bt),kt.emitter.listenerCount("disconnect")&&St.connector.emitter.off("disconnect",vt),kt.emitter.listenerCount("connect")||St.connector.emitter.on("connect",xt)}if(Ct.connections.delete(Et.uid),Ct.connections.size===0)return{...Ct,connections:new Map,current:null,status:"disconnected"};const At=Ct.connections.values().next().value;return{...Ct,connections:new Map(Ct.connections),current:At.connector.uid}})}return{get chains(){return st.getState()},get connectors(){return at.getState()},storage:tt,getClient:ht,get state(){return gt.getState()},setState(Et){let Ct;typeof Et=="function"?Ct=Et(gt.getState()):Ct=Et;const St=mt();typeof Ct!="object"&&(Ct=St),Object.keys(St).some(kt=>!(kt in Ct))&&(Ct=St),gt.setState(Ct,!0)},subscribe(Et,Ct,St){return gt.subscribe(Et,Ct,St?{...St,fireImmediately:St.emitImmediately}:void 0)},_internal:{mipd:it,store:gt,ssr:!!nt,syncConnectedChain:rt,transports:ot.transports,chains:{setState(Et){const Ct=typeof Et=="function"?Et(st.getState()):Et;if(Ct.length!==0)return st.setState(Ct,!0)},subscribe(Et){return st.subscribe(Et)}},connectors:{providerDetailToConnector:lt,setup:ct,setState(Et){return at.setState(typeof Et=="function"?Et(at.getState()):Et,!0)},subscribe(Et){return at.subscribe(Et)}},events:{change:bt,connect:xt,disconnect:vt}}}}function hydrate(et,o){const{initialState:tt,reconnectOnMount:rt}=o;return tt&&!et._internal.store.persist.hasHydrated()&&et.setState({...tt,chainId:et.chains.some(nt=>nt.id===tt.chainId)?tt.chainId:et.chains[0].id,connections:rt?tt.connections:new Map,status:rt?"reconnecting":"disconnected"}),{async onMount(){var nt;if(et._internal.ssr){await et._internal.store.persist.rehydrate();const ot=(nt=et._internal.mipd)==null?void 0:nt.getProviders().map(et._internal.connectors.providerDetailToConnector).map(et._internal.connectors.setup);et._internal.connectors.setState(it=>[...it,...ot??[]])}rt?reconnect(et):et.storage&&et.setState(ot=>({...ot,connections:new Map}))}}}function extractRpcUrls(et){var ot,it,st;const{chain:o}=et,tt=o.rpcUrls.default.http[0];if(!et.transports)return[tt];const rt=(it=(ot=et.transports)==null?void 0:ot[o.id])==null?void 0:it.call(ot,{chain:o});return(((st=rt==null?void 0:rt.value)==null?void 0:st.transports)||[rt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(et){const{children:o,config:tt,initialState:rt,reconnectOnMount:nt=!0}=et,{onMount:ot}=hydrate(tt,{initialState:rt,reconnectOnMount:nt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),o}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(et){const{children:o,config:tt}=et,rt={value:tt};return reactExports.createElement(Hydrate,et,reactExports.createElement(WagmiContext.Provider,rt,o))}const version$5="2.12.19",getVersion=()=>`wagmi@${version$5}`;class BaseError extends BaseError$1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return getVersion()}}class WagmiProviderNotFoundError extends BaseError{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function useConfig(et={}){const o=et.config??reactExports.useContext(WagmiContext);if(!o)throw new WagmiProviderNotFoundError;return o}function watchChains(et,o){const{onChange:tt}=o;return et._internal.chains.subscribe((rt,nt)=>{tt(rt,nt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** +`):`The contract function "${rt}" reverted.`,{cause:ot,metaMessages:st,name:"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=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:o}){super(`The contract function "${o}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${o}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:o}){super(`Deployment for counterfactual contract call failed${o?` for factory "${o}".`:""}`,{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."],name:"CounterfactualDeploymentFailedError"})}}class RawContractError extends BaseError$3{constructor({data:o,message:tt}){super(tt||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o}}function isNullUniversalResolverError(et,o){var rt,nt,ot,it,st,at;if(!(et instanceof BaseError$3))return!1;const tt=et.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((rt=tt.data)==null?void 0:rt.errorName)==="ResolverNotFound"||((nt=tt.data)==null?void 0:nt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||o==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(et){if(et.length!==66||et.indexOf("[")!==0||et.indexOf("]")!==65)return null;const o=`0x${et.slice(1,65)}`;return isHex(o)?o:null}function namehash(et){let o=new Uint8Array(32).fill(0);if(!et)return bytesToHex$3(o);const tt=et.split(".");for(let rt=tt.length-1;rt>=0;rt-=1){const nt=encodedLabelToLabelhash(tt[rt]),ot=nt?toBytes$3(nt):keccak256$1(stringToBytes(tt[rt]),"bytes");o=keccak256$1(concat$6([o,ot]),"bytes")}return bytesToHex$3(o)}function encodeLabelhash(et){return`[${et.slice(2)}]`}function labelhash(et){const o=new Uint8Array(32).fill(0);return et?encodedLabelToLabelhash(et)||keccak256$1(stringToBytes(et)):bytesToHex$3(o)}function packetToBytes(et){const o=et.replace(/^\.|\.$/gm,"");if(o.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(o).byteLength+2);let rt=0;const nt=o.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(nt[ot])))),tt[rt]=it.length,tt.set(it,rt+1),rt+=it.length+1}return tt.byteLength!==rt+1?tt.slice(0,rt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(et,{abi:o,address:tt,args:rt,docsPath:nt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=et instanceof RawContractError?et:et instanceof BaseError$3?et.walk(ht=>"data"in ht)||et.walk():{},dt=et instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:o,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):et;return new ContractFunctionExecutionError(dt,{abi:o,args:rt,contractAddress:tt,docsPath:nt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(et,{docsPath:o,...tt}){const rt=(()=>{const nt=getNodeError(et,tt);return nt instanceof UnknownNodeError?et:nt})();return new CallExecutionError(rt,{docsPath:o,...tt})}const schedulerCache=new Map;function createBatchScheduler({fn:et,id:o,shouldSplitBatch:tt,wait:rt=0,sort:nt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&et(dt).then(ht=>{var mt;nt&&Array.isArray(ht)&&ht.sort(nt);for(let ft=0;ft{var mt;for(let ft=0;ftschedulerCache.delete(o),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(o)||[],ct=lt=>schedulerCache.set(o,[...at(),lt]);return{flush:it,async schedule(lt){const dt={},ht=new Promise((pt,gt)=>{dt.resolve=pt,dt.reject=gt});return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,pendingPromise:dt}),ht):(ct({args:lt,pendingPromise:dt}),setTimeout(ot,rt),ht)}}}async function call(et,o){var Ot,Nt,Yt,Ft;const{account:tt=et.account,batch:rt=!!((Ot=et.batch)!=null&&Ot.multicall),blockNumber:nt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:gt,nonce:yt,to:bt,value:xt,stateOverride:vt,...Et}=o,Ct=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&bt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const St=at&&ct,At=lt&&dt&&bt&&ct,kt=St||At,It=St?toDeploylessCallViaBytecodeData({code:at,data:ct}):At?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:bt}):ct;try{assertRequest(o);const Qt=(nt?numberToHex(nt):void 0)||ot,Vt=serializeStateOverride(vt),Bt=(Ft=(Yt=(Nt=et.chain)==null?void 0:Nt.formatters)==null?void 0:Yt.transactionRequest)==null?void 0:Ft.format,jt=(Bt||formatTransactionRequest)({...extract$1(Et,{format:Bt}),from:Ct==null?void 0:Ct.address,accessList:it,blobs:st,data:It,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:gt,nonce:yt,to:kt?void 0:bt,value:xt});if(rt&&shouldPerformMulticall({request:jt})&&!Vt)try{return await scheduleMulticall(et,{...jt,blockNumber:nt,blockTag:ot})}catch(Kt){if(!(Kt instanceof ClientChainNotConfiguredError)&&!(Kt instanceof ChainDoesNotSupportContract))throw Kt}const Xt=await et.request({method:"eth_call",params:Vt?[jt,Qt,Vt]:[jt,Qt]});return Xt==="0x"?{data:void 0}:{data:Xt}}catch(Ht){const Qt=getRevertErrorData(Ht),{offchainLookup:Vt,offchainLookupSignature:Bt}=await __vitePreload(async()=>{const{offchainLookup:Wt,offchainLookupSignature:jt}=await import("./ccip-ColseNtL.js");return{offchainLookup:Wt,offchainLookupSignature:jt}},[],import.meta.url);if(et.ccipRead!==!1&&(Qt==null?void 0:Qt.slice(0,10))===Bt&&bt)return{data:await Vt(et,{data:Qt,to:bt})};throw kt&&(Qt==null?void 0:Qt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ht,{...o,account:Ct,chain:et.chain})}}function shouldPerformMulticall({request:et}){const{data:o,to:tt,...rt}=et;return!(!o||o.startsWith(aggregate3Signature)||!tt||Object.values(rt).filter(nt=>typeof nt<"u").length>0)}async function scheduleMulticall(et,o){var pt;const{batchSize:tt=1024,wait:rt=0}=typeof((pt=et.batch)==null?void 0:pt.multicall)=="object"?et.batch.multicall:{},{blockNumber:nt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=o;let ct=st;if(!ct){if(!et.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:nt,chain:et.chain,contract:"multicall3"})}const dt=(nt?numberToHex(nt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${et.uid}.${dt}`,wait:rt,shouldSplitBatch(gt){return gt.reduce((bt,{data:xt})=>bt+(xt.length-2),0)>tt*2},fn:async gt=>{const yt=gt.map(vt=>({allowFailure:!0,callData:vt.data,target:vt.to})),bt=encodeFunctionData({abi:multicall3Abi,args:[yt],functionName:"aggregate3"}),xt=await et.request({method:"eth_call",params:[{data:bt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[yt],functionName:"aggregate3",data:xt||"0x"})}}),[{returnData:mt,success:ft}]=await ht({data:it,to:at});if(!ft)throw new RawContractError({data:mt});return mt==="0x"?{data:void 0}:{data:mt}}function toDeploylessCallViaBytecodeData(et){const{code:o,data:tt}=et;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[o,tt]})}function toDeploylessCallViaFactoryData(et){const{data:o,factory:tt,factoryData:rt,to:nt}=et;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[nt,o,tt,rt]})}function getRevertErrorData(et){var tt;if(!(et instanceof BaseError$3))return;const o=et.walk();return typeof(o==null?void 0:o.data)=="object"?(tt=o.data)==null?void 0:tt.data:o.data}async function readContract$1(et,o){const{abi:tt,address:rt,args:nt,functionName:ot,...it}=o,st=encodeFunctionData({abi:tt,args:nt,functionName:ot});try{const{data:at}=await getAction$1(et,call,"call")({...it,data:st,to:rt});return decodeFunctionResult({abi:tt,args:nt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:rt,args:nt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(et,{blockNumber:o,blockTag:tt,coinType:rt,name:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:o,chain:et.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...rt!=null?{args:[namehash(nt),BigInt(rt)]}:{args:[namehash(nt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),ct],blockNumber:o,blockTag:tt},dt=getAction$1(et,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const mt=decodeFunctionResult({abi:addressResolverAbi,args:rt!=null?[namehash(nt),BigInt(rt)]:void 0,functionName:"addr",data:ht[0]});return mt==="0x"||trim$1(mt)==="0x00"?null:mt}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:o}){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(o)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:o}){super(`ENS NFT avatar URI is invalid. ${o}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:o}){super(`Unable to resolve ENS avatar URI "${o}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:o}){super(`ENS NFT avatar namespace "${o}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(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\-.]+))?(?\/.*)?$/,base64Regex$1=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(et){try{const o=await fetch(et,{method:"HEAD"});if(o.status===200){const tt=o.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(o){return typeof o=="object"&&typeof o.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const rt=new Image;rt.onload=()=>{tt(!0)},rt.onerror=()=>{tt(!1)},rt.src=et})}}function getGateway(et,o){return et?et.endsWith("/")?et.slice(0,-1):et:o}function resolveAvatarUri({uri:et,gatewayUrls:o}){const tt=base64Regex$1.test(et);if(tt)return{uri:et,isOnChain:!0,isEncoded:tt};const rt=getGateway(o==null?void 0:o.ipfs,"https://ipfs.io"),nt=getGateway(o==null?void 0:o.arweave,"https://arweave.net"),ot=et.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(et);if(et.startsWith("http")&&!lt&&!dt){let mt=et;return o!=null&&o.arweave&&(mt=et.replace(/https:\/\/arweave.net/g,o==null?void 0:o.arweave)),{uri:mt,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${rt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${nt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=et.replace(dataURIRegex,"");if(ht.startsWith("nt.json());return await parseAvatarUri({gatewayUrls:et,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:o})}}async function parseAvatarUri({gatewayUrls:et,uri:o}){const{uri:tt,isOnChain:rt}=resolveAvatarUri({uri:o,gatewayUrls:et});if(rt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:o})}function parseNftUri(et){let o=et;o.startsWith("did:nft:")&&(o=o.replace("did:nft:","").replace(/_/g,"/"));const[tt,rt,nt]=o.split("/"),[ot,it]=tt.split(":"),[st,at]=rt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!nt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:nt}}async function getNftTokenUri(et,{nft:o}){if(o.namespace==="erc721")return readContract$1(et,{address:o.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(o.tokenID)]});if(o.namespace==="erc1155")return readContract$1(et,{address:o.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(o.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:o.namespace})}async function parseAvatarRecord(et,{gatewayUrls:o,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(et,{gatewayUrls:o,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:o})}async function parseNftAvatarUri(et,{gatewayUrls:o,record:tt}){const rt=parseNftUri(tt),nt=await getNftTokenUri(et,{nft:rt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:nt,gatewayUrls:o});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:o})}let at=rt.tokenID;return rt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:o,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(et,{blockNumber:o,blockTag:tt,name:rt,key:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:o,chain:et.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(rt),nt]})],blockNumber:o,blockTag:tt},lt=getAction$1(et,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(et,{blockNumber:o,blockTag:tt,assetGatewayUrls:rt,name:nt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(et,getEnsText,"getEnsText")({blockNumber:o,blockTag:tt,key:"avatar",name:nt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(et,{record:at,gatewayUrls:rt})}catch{return null}}async function getEnsName$1(et,{address:o,blockNumber:tt,blockTag:rt,gatewayUrls:nt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!et.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:et.chain,contract:"ensUniversalResolver"})}const at=`${o.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:rt},lt=getAction$1(et,readContract$1,"readContract"),[dt,ht]=nt?await lt({...ct,args:[...ct.args,nt]}):await lt(ct);return o.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(et){const o=(nt,ot)=>({clear:()=>ot.delete(nt),get:()=>ot.get(nt),set:it=>ot.set(nt,it)}),tt=o(et,promiseCache$1),rt=o(et,responseCache);return{clear:()=>{tt.clear(),rt.clear()},promise:tt,response:rt}}async function withCache(et,{cacheKey:o,cacheTime:tt=Number.POSITIVE_INFINITY}){const rt=getCache(o),nt=rt.response.get();if(nt&&tt>0&&new Date().getTime()-nt.created.getTime()`blockNumber.${et}`;async function getBlockNumber$1(et,{cacheTime:o=et.cacheTime}={}){const tt=await withCache(()=>et.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(et.uid),cacheTime:o});return BigInt(tt)}function formatLog(et,{args:o,eventName:tt}={}){return{...et,blockHash:et.blockHash?et.blockHash:null,blockNumber:et.blockNumber?BigInt(et.blockNumber):null,logIndex:et.logIndex?Number(et.logIndex):null,transactionHash:et.transactionHash?et.transactionHash:null,transactionIndex:et.transactionIndex?Number(et.transactionIndex):null,...tt?{args:o,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(et){const o={...et,blockNumber:et.blockNumber?BigInt(et.blockNumber):null,contractAddress:et.contractAddress?et.contractAddress:null,cumulativeGasUsed:et.cumulativeGasUsed?BigInt(et.cumulativeGasUsed):null,effectiveGasPrice:et.effectiveGasPrice?BigInt(et.effectiveGasPrice):null,gasUsed:et.gasUsed?BigInt(et.gasUsed):null,logs:et.logs?et.logs.map(tt=>formatLog(tt)):null,to:et.to?et.to:null,transactionIndex:et.transactionIndex?hexToNumber$2(et.transactionIndex):null,status:et.status?receiptStatuses[et.status]:null,type:et.type?transactionType[et.type]||et.type:null};return et.blobGasPrice&&(o.blobGasPrice=BigInt(et.blobGasPrice)),et.blobGasUsed&&(o.blobGasUsed=BigInt(et.blobGasUsed)),o}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(et,o){var gt;const{allowFailure:tt=!0,batchSize:rt,blockNumber:nt,blockTag:ot,multicallAddress:it,stateOverride:st}=o,at=o.contracts,ct=rt??(typeof((gt=et.batch)==null?void 0:gt.multicall)=="object"&&et.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!et.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:nt,chain:et.chain,contract:"multicall3"})}const dt=[[]];let ht=0,mt=0;for(let yt=0;yt0&&mt>ct&&dt[ht].length>0&&(ht++,mt=(Ct.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:Ct,target:xt}]}catch(Ct){const St=getContractError(Ct,{abi:bt,address:xt,args:vt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw St;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:xt}]}}const ft=await Promise.allSettled(dt.map(yt=>getAction$1(et,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[yt],blockNumber:nt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let yt=0;ytlistenersCache.get(et)||[],ot=()=>{const lt=nt();listenersCache.set(et,lt.filter(dt=>dt.id!==rt))},it=()=>{const lt=cleanupCache.get(et);nt().length===1&<&<(),ot()},st=nt();if(listenersCache.set(et,[...st,{id:rt,fns:o}]),st&&st.length>0)return it;const at={};for(const lt in o)at[lt]=(...dt)=>{var mt,ft;const ht=nt();if(ht.length!==0)for(const pt of ht)(ft=(mt=pt.fns)[lt])==null||ft.call(mt,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(et,ct),it}async function wait$1(et){return new Promise(o=>setTimeout(o,et))}function poll(et,{emitOnBegin:o,initialWaitTime:tt,interval:rt}){let nt=!0;const ot=()=>nt=!1;return(async()=>{let st;o&&(st=await et({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??rt;await wait$1(at);const ct=async()=>{nt&&(await et({unpoll:ot}),await wait$1(rt),ct())};ct()})(),ot}function watchBlockNumber$1(et,{emitOnBegin:o=!1,emitMissed:tt=!1,onBlockNumber:rt,onError:nt,poll:ot,pollingInterval:it=et.pollingInterval}){const st=typeof ot<"u"?ot:!(et.transport.type==="webSocket"||et.transport.type==="fallback"&&et.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",et.uid,o,tt,it]);return observe(dt,{onBlockNumber:rt,onError:nt},ht=>poll(async()=>{var mt;try{const ft=await getAction$1(et,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(ft===at)return;if(ft-at>1&&tt)for(let pt=at+1n;ptat)&&(ht.onBlockNumber(ft,at),at=ft)}catch(ft){(mt=ht.onError)==null||mt.call(ht,ft)}},{emitOnBegin:o,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",et.uid,o,tt]);return observe(dt,{onBlockNumber:rt,onError:nt},ht=>{let mt=!0,ft=()=>mt=!1;return(async()=>{try{const pt=(()=>{if(et.transport.type==="fallback"){const yt=et.transport.transports.find(bt=>bt.config.type==="webSocket");return yt?yt.value:et.transport}return et.transport})(),{unsubscribe:gt}=await pt.subscribe({params:["newHeads"],onData(yt){var xt;if(!mt)return;const bt=hexToBigInt((xt=yt.result)==null?void 0:xt.number);ht.onBlockNumber(bt,at),at=bt},onError(yt){var bt;(bt=ht.onError)==null||bt.call(ht,yt)}});ft=gt,mt||ft()}catch(pt){nt==null||nt(pt)}})(),()=>ft()})})()}const promiseCache=new LruMap(8192);function withDedupe(et,{enabled:o=!0,id:tt}){if(!o||!tt)return et();if(promiseCache.get(tt))return promiseCache.get(tt);const rt=et().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,rt),rt}function withRetry(et,{delay:o=100,retryCount:tt=2,shouldRetry:rt=()=>!0}={}){return new Promise((nt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof o=="function"?o({count:st,error:ct}):o;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await et();nt(ct)}catch(ct){if(st{const{dedupe:nt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...o,...rt},at=nt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await et(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:nt,id:at})}}function shouldRetry(et){return"code"in et&&typeof et.code=="number"?et.code===-1||et.code===LimitExceededRpcError.code||et.code===InternalRpcError.code:et instanceof HttpRequestError&&et.status?et.status===403||et.status===408||et.status===413||et.status===429||et.status===500||et.status===502||et.status===503||et.status===504:!0}function defineChain(et){return{formatters:void 0,fees:void 0,serializers:void 0,...et}}function withTimeout(et,{errorInstance:o=new Error("timed out"),timeout:tt,signal:rt}){return new Promise((nt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{rt?st.abort():ot(o)},tt)),nt(await et({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(o),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(et,o={}){return{async request(tt){var dt;const{body:rt,onRequest:nt=o.onRequest,onResponse:ot=o.onResponse,timeout:it=o.timeout??1e4}=tt,st={...o.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:ft})=>{const pt={...st,body:Array.isArray(rt)?stringify$2(rt.map(xt=>({jsonrpc:"2.0",id:xt.id??idCache.take(),...xt}))):stringify$2({jsonrpc:"2.0",id:rt.id??idCache.take(),...rt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?ft:null)},gt=new Request(et,pt),yt=await(nt==null?void 0:nt(gt,pt))??{...pt,url:et};return await fetch(yt.url??et,yt)},{errorInstance:new TimeoutError$4({body:rt,url:et}),timeout:it,signal:!0});ot&&await ot(ht);let mt;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))mt=await ht.json();else{mt=await ht.text();try{mt=JSON.parse(mt||"{}")}catch(ft){if(ht.ok)throw ft;mt={error:mt}}}if(!ht.ok)throw new HttpRequestError({body:rt,details:stringify$2(mt.error)||ht.statusText,headers:ht.headers,status:ht.status,url:et});return mt}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:rt,cause:ht,url:et})}}}}function assertTransactionEIP7702(et){const{authorizationList:o}=et;if(o)for(const tt of o){const{contractAddress:rt,chainId:nt}=tt;if(!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt<=0)throw new InvalidChainIdError({chainId:nt})}assertTransactionEIP1559(et)}function assertTransactionEIP4844(et){const{blobVersionedHashes:o}=et;if(o){if(o.length===0)throw new EmptyBlobError;for(const tt of o){const rt=size$2(tt),nt=hexToNumber$2(slice(tt,0,1));if(rt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:rt});if(nt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:nt})}}assertTransactionEIP1559(et)}function assertTransactionEIP1559(et){const{chainId:o,maxPriorityFeePerGas:tt,maxFeePerGas:rt,to:nt}=et;if(o<=0)throw new InvalidChainIdError({chainId:o});if(nt&&!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt});if(tt&&rt&&tt>rt)throw new TipAboveFeeCapError({maxFeePerGas:rt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(et){const{chainId:o,maxPriorityFeePerGas:tt,gasPrice:rt,maxFeePerGas:nt,to:ot}=et;if(o<=0)throw new InvalidChainIdError({chainId:o});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||nt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt})}function assertTransactionLegacy(et){const{chainId:o,maxPriorityFeePerGas:tt,gasPrice:rt,maxFeePerGas:nt,to:ot}=et;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof o<"u"&&o<=0)throw new InvalidChainIdError({chainId:o});if(tt||nt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(rt&&rt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:rt})}function serializeAuthorizationList(et){if(!et||et.length===0)return[];const o=[];for(const tt of et){const{contractAddress:rt,chainId:nt,nonce:ot,...it}=tt;o.push([toHex(nt),rt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return o}function serializeAccessList(et){if(!et||et.length===0)return[];const o=[];for(let tt=0;tt"u"||typeof mt>"u")){const xt=typeof et.blobs[0]=="string"?et.blobs:et.blobs.map(Ct=>bytesToHex$3(Ct)),vt=et.kzg,Et=blobsToCommitments({blobs:xt,kzg:vt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof mt>"u"){const Ct=blobsToProofs({blobs:xt,commitments:Et,kzg:vt});mt=toBlobSidecars({blobs:xt,commitments:Et,proofs:Ct})}}const ft=serializeAccessList(lt),pt=[toHex(tt),nt?toHex(nt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",ft,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(et,o)],gt=[],yt=[],bt=[];if(mt)for(let xt=0;xt{if(o.v>=35n)return(o.v-35n)/2n>0?o.v:27n+(o.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+o.v-27n);const mt=27n+(o.v===27n?0n:1n);if(o.v!==mt)throw new InvalidLegacyVError({v:o.v});return mt})(),dt=trim$1(o.r),ht=trim$1(o.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(et,o){const tt=o??et,{v:rt,yParity:nt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof rt>"u"&&typeof nt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof nt=="number"?nt?toHex(1):"0x":rt===0n?"0x":rt===1n?toHex(1):rt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(et,{account:o=et.account,message:tt}){if(!o)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const rt=parseAccount(o);if(rt.signMessage)return rt.signMessage({message:tt});const nt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return et.request({method:"personal_sign",params:[nt,rt.address]},{retryCount:0})}class HMAC extends Hash{constructor(o,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(o);const rt=toBytes$2(tt);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const nt=this.blockLen,ot=new Uint8Array(nt);ot.set(rt.length>nt?o.create().update(rt).digest():rt);for(let it=0;itnew HMAC(et,o).update(tt).digest();hmac.create=(et,o)=>new HMAC(et,o);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(et){return et instanceof Uint8Array||et!=null&&typeof et=="object"&&et.constructor.name==="Uint8Array"}function abytes(et){if(!isBytes$2(et))throw new Error("Uint8Array expected")}function abool(et,o){if(typeof o!="boolean")throw new Error(`${et} must be valid boolean, got "${o}".`)}const hexes$1=Array.from({length:256},(et,o)=>o.toString(16).padStart(2,"0"));function bytesToHex$2(et){abytes(et);let o="";for(let tt=0;tt=asciis._0&&et<=asciis._9)return et-asciis._0;if(et>=asciis._A&&et<=asciis._F)return et-(asciis._A-10);if(et>=asciis._a&&et<=asciis._f)return et-(asciis._a-10)}function hexToBytes$2(et){if(typeof et!="string")throw new Error("hex string expected, got "+typeof et);const o=et.length,tt=o/2;if(o%2)throw new Error("padded hex string expected, got unpadded hex of length "+o);const rt=new Uint8Array(tt);for(let nt=0,ot=0;nttypeof et=="bigint"&&_0n$6<=et;function inRange(et,o,tt){return isPosBig(et)&&isPosBig(o)&&isPosBig(tt)&&o<=et&&et_0n$6;et>>=_1n$8,o+=1);return o}function bitGet(et,o){return et>>BigInt(o)&_1n$8}function bitSet(et,o,tt){return et|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(et),u8fr=et=>Uint8Array.from(et);function createHmacDrbg(et,o,tt){if(typeof et!="number"||et<2)throw new Error("hashLen must be a number");if(typeof o!="number"||o<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let rt=u8n(et),nt=u8n(et),ot=0;const it=()=>{rt.fill(1),nt.fill(0),ot=0},st=(...dt)=>tt(nt,rt,...dt),at=(dt=u8n())=>{nt=st(u8fr([0]),dt),rt=st(),dt.length!==0&&(nt=st(u8fr([1]),dt),rt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let mt;for(;!(mt=ht(ct()));)at();return it(),mt}}const validatorFns={bigint:et=>typeof et=="bigint",function:et=>typeof et=="function",boolean:et=>typeof et=="boolean",string:et=>typeof et=="string",stringOrUint8Array:et=>typeof et=="string"||isBytes$2(et),isSafeInteger:et=>Number.isSafeInteger(et),array:et=>Array.isArray(et),field:(et,o)=>o.Fp.isValid(et),hash:et=>typeof et=="function"&&Number.isSafeInteger(et.outputLen)};function validateObject(et,o,tt={}){const rt=(nt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=et[nt];if(!(it&&at===void 0)&&!st(at,et))throw new Error(`Invalid param ${String(nt)}=${at} (${typeof at}), expected ${ot}`)};for(const[nt,ot]of Object.entries(o))rt(nt,ot,!1);for(const[nt,ot]of Object.entries(tt))rt(nt,ot,!0);return et}const notImplemented=()=>{throw new Error("not implemented")};function memoized(et){const o=new WeakMap;return(tt,...rt)=>{const nt=o.get(tt);if(nt!==void 0)return nt;const ot=et(tt,...rt);return o.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(et,o){const tt=et%o;return tt>=_0n$5?tt:o+tt}function pow(et,o,tt){if(tt<=_0n$5||o<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let rt=_1n$7;for(;o>_0n$5;)o&_1n$7&&(rt=rt*et%tt),et=et*et%tt,o>>=_1n$7;return rt}function pow2$1(et,o,tt){let rt=et;for(;o-- >_0n$5;)rt*=rt,rt%=tt;return rt}function invert$1(et,o){if(et===_0n$5||o<=_0n$5)throw new Error(`invert: expected positive integers, got n=${et} mod=${o}`);let tt=mod$1(et,o),rt=o,nt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=rt/tt,at=rt%tt,ct=nt-ot*st;rt=tt,tt=at,nt=ot,ot=ct}if(rt!==_1n$7)throw new Error("invert: does not exist");return mod$1(nt,o)}function tonelliShanks(et){const o=(et-_1n$7)/_2n$4;let tt,rt,nt;for(tt=et-_1n$7,rt=0;tt%_2n$4===_0n$5;tt/=_2n$4,rt++);for(nt=_2n$4;nt(mod$1(et,o)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(et){const o={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((rt,nt)=>(rt[nt]="function",rt),o);return validateObject(et,tt)}function FpPow(et,o,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return et.ONE;if(tt===_1n$7)return o;let rt=et.ONE,nt=o;for(;tt>_0n$5;)tt&_1n$7&&(rt=et.mul(rt,nt)),nt=et.sqr(nt),tt>>=_1n$7;return rt}function FpInvertBatch(et,o){const tt=new Array(o.length),rt=o.reduce((ot,it,st)=>et.is0(it)?ot:(tt[st]=ot,et.mul(ot,it)),et.ONE),nt=et.inv(rt);return o.reduceRight((ot,it,st)=>et.is0(it)?ot:(tt[st]=et.mul(ot,tt[st]),et.mul(ot,it)),nt),tt}function nLength(et,o){const tt=o!==void 0?o:et.toString(2).length,rt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:rt}}function Field$1(et,o,tt=!1,rt={}){if(et<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${et}`);const{nBitLength:nt,nByteLength:ot}=nLength(et,o);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(et),st=Object.freeze({ORDER:et,BITS:nt,BYTES:ot,MASK:bitMask(nt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,et),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,et),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,et),add:(at,ct)=>mod$1(at+ct,et),sub:(at,ct)=>mod$1(at-ct,et),mul:(at,ct)=>mod$1(at*ct,et),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,et),et),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,et),sqrt:rt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(et){if(typeof et!="bigint")throw new Error("field order must be bigint");const o=et.toString(2).length;return Math.ceil(o/8)}function getMinHashLength(et){const o=getFieldBytesLength(et);return o+Math.ceil(o/2)}function mapHashToField(et,o,tt=!1){const rt=et.length,nt=getFieldBytesLength(o),ot=getMinHashLength(o);if(rt<16||rt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${rt}`);const it=tt?bytesToNumberBE(et):bytesToNumberLE(et),st=mod$1(it,o-_1n$7)+_1n$7;return tt?numberToBytesLE(st,nt):numberToBytesBE(st,nt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(et,o){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},rt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>o)throw new Error(`Wrong window size=${ot}, should be [1..${o}]`)},nt=ot=>{rt(ot);const it=Math.ceil(o/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=et.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=nt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=ft,yt>ct&&(yt-=mt,st+=_1n$6);const bt=gt,xt=gt+Math.abs(yt)-1,vt=pt%2!==0,Et=yt<0;yt===0?dt=dt.add(tt(vt,it[bt])):lt=lt.add(tt(Et,it[xt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){rt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(et,o,tt,rt){if(!Array.isArray(tt)||!Array.isArray(rt)||rt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");rt.forEach((lt,dt)=>{if(!o.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof et))throw new Error(`wrong point at index ${dt}`)});const nt=bitLen(BigInt(tt.length)),ot=nt>12?nt-3:nt>4?nt-2:nt?2:1,it=(1<=0;lt-=ot){st.fill(et.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[ft]=st[ft].add(tt[ht])}let dt=et.ZERO;for(let ht=st.length-1,mt=et.ZERO;ht>0;ht--)mt=mt.add(st[ht]),dt=dt.add(mt);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(et<0||et>256)throw new tt("tlv.encode: wrong tag");if(o.length&1)throw new tt("tlv.encode: unpadded data");const rt=o.length/2,nt=numberToHexUnpadded$1(rt);if(nt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=rt>127?numberToHexUnpadded$1(nt.length/2|128):"";return`${numberToHexUnpadded$1(et)}${ot}${nt}${o}`},decode(et,o){const{Err:tt}=DER;let rt=0;if(et<0||et>256)throw new tt("tlv.encode: wrong tag");if(o.length<2||o[rt++]!==et)throw new tt("tlv.decode: wrong tlv");const nt=o[rt++],ot=!!(nt&128);let it=0;if(!ot)it=nt;else{const at=nt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=o.subarray(rt,rt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(rt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=o.subarray(rt,rt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:o.subarray(rt+it)}}},_int:{encode(et){const{Err:o}=DER;if(et<_0n$3)throw new o("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(et);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new o("unexpected assertion");return tt},decode(et){const{Err:o}=DER;if(et[0]&128)throw new o("Invalid signature integer: negative");if(et[0]===0&&!(et[1]&128))throw new o("Invalid signature integer: unnecessary leading zero");return b2n(et)}},toSig(et){const{Err:o,_int:tt,_tlv:rt}=DER,nt=typeof et=="string"?h2b(et):et;abytes(nt);const{v:ot,l:it}=rt.decode(48,nt);if(it.length)throw new o("Invalid signature: left bytes after parsing");const{v:st,l:at}=rt.decode(2,ot),{v:ct,l:lt}=rt.decode(2,at);if(lt.length)throw new o("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(et){const{_tlv:o,_int:tt}=DER,rt=`${o.encode(2,tt.encode(et.r))}${o.encode(2,tt.encode(et.s))}`;return o.encode(48,rt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(et){const o=validatePointOpts(et),{Fp:tt}=o,rt=Field$1(o.n,o.nBitLength),nt=o.toBytes||((pt,gt,yt)=>{const bt=gt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(bt.x),tt.toBytes(bt.y))}),ot=o.fromBytes||(pt=>{const gt=pt.subarray(1),yt=tt.fromBytes(gt.subarray(0,tt.BYTES)),bt=tt.fromBytes(gt.subarray(tt.BYTES,2*tt.BYTES));return{x:yt,y:bt}});function it(pt){const{a:gt,b:yt}=o,bt=tt.sqr(pt),xt=tt.mul(bt,pt);return tt.add(tt.add(xt,tt.mul(pt,gt)),yt)}if(!tt.eql(tt.sqr(o.Gy),it(o.Gx)))throw new Error("bad generator point: equation left != right");function st(pt){return inRange(pt,_1n$5,o.n)}function at(pt){const{allowedPrivateKeyLengths:gt,nByteLength:yt,wrapPrivateKey:bt,n:xt}=o;if(gt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!gt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(yt*2,"0")}let vt;try{vt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,yt))}catch{throw new Error(`private key must be ${yt} bytes, hex or bigint, not ${typeof pt}`)}return bt&&(vt=mod$1(vt,xt)),aInRange("private key",vt,_1n$5,xt),vt}function ct(pt){if(!(pt instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((pt,gt)=>{const{px:yt,py:bt,pz:xt}=pt;if(tt.eql(xt,tt.ONE))return{x:yt,y:bt};const vt=pt.is0();gt==null&&(gt=vt?tt.ONE:tt.inv(xt));const Et=tt.mul(yt,gt),Ct=tt.mul(bt,gt),St=tt.mul(xt,gt);if(vt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(St,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:Ct}}),dt=memoized(pt=>{if(pt.is0()){if(o.allowInfinityPoint&&!tt.is0(pt.py))return;throw new Error("bad point: ZERO")}const{x:gt,y:yt}=pt.toAffine();if(!tt.isValid(gt)||!tt.isValid(yt))throw new Error("bad point: x or y not FE");const bt=tt.sqr(yt),xt=it(gt);if(!tt.eql(bt,xt))throw new Error("bad point: equation left != right");if(!pt.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(gt,yt,bt){if(this.px=gt,this.py=yt,this.pz=bt,gt==null||!tt.isValid(gt))throw new Error("x required");if(yt==null||!tt.isValid(yt))throw new Error("y required");if(bt==null||!tt.isValid(bt))throw new Error("z required");Object.freeze(this)}static fromAffine(gt){const{x:yt,y:bt}=gt||{};if(!gt||!tt.isValid(yt)||!tt.isValid(bt))throw new Error("invalid affine point");if(gt instanceof ht)throw new Error("projective point not allowed");const xt=vt=>tt.eql(vt,tt.ZERO);return xt(yt)&&xt(bt)?ht.ZERO:new ht(yt,bt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(gt){const yt=tt.invertBatch(gt.map(bt=>bt.pz));return gt.map((bt,xt)=>bt.toAffine(yt[xt])).map(ht.fromAffine)}static fromHex(gt){const yt=ht.fromAffine(ot(ensureBytes$1("pointHex",gt)));return yt.assertValidity(),yt}static fromPrivateKey(gt){return ht.BASE.multiply(at(gt))}static msm(gt,yt){return pippenger(ht,rt,gt,yt)}_setWindowSize(gt){ft.setWindowSize(this,gt)}assertValidity(){dt(this)}hasEvenY(){const{y:gt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(gt);throw new Error("Field doesn't support isOdd")}equals(gt){ct(gt);const{px:yt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=gt,St=tt.eql(tt.mul(yt,Ct),tt.mul(vt,xt)),At=tt.eql(tt.mul(bt,Ct),tt.mul(Et,xt));return St&&At}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:gt,b:yt}=o,bt=tt.mul(yt,_3n$2),{px:xt,py:vt,pz:Et}=this;let Ct=tt.ZERO,St=tt.ZERO,At=tt.ZERO,kt=tt.mul(xt,xt),It=tt.mul(vt,vt),Ot=tt.mul(Et,Et),Nt=tt.mul(xt,vt);return Nt=tt.add(Nt,Nt),At=tt.mul(xt,Et),At=tt.add(At,At),Ct=tt.mul(gt,At),St=tt.mul(bt,Ot),St=tt.add(Ct,St),Ct=tt.sub(It,St),St=tt.add(It,St),St=tt.mul(Ct,St),Ct=tt.mul(Nt,Ct),At=tt.mul(bt,At),Ot=tt.mul(gt,Ot),Nt=tt.sub(kt,Ot),Nt=tt.mul(gt,Nt),Nt=tt.add(Nt,At),At=tt.add(kt,kt),kt=tt.add(At,kt),kt=tt.add(kt,Ot),kt=tt.mul(kt,Nt),St=tt.add(St,kt),Ot=tt.mul(vt,Et),Ot=tt.add(Ot,Ot),kt=tt.mul(Ot,Nt),Ct=tt.sub(Ct,kt),At=tt.mul(Ot,It),At=tt.add(At,At),At=tt.add(At,At),new ht(Ct,St,At)}add(gt){ct(gt);const{px:yt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=gt;let St=tt.ZERO,At=tt.ZERO,kt=tt.ZERO;const It=o.a,Ot=tt.mul(o.b,_3n$2);let Nt=tt.mul(yt,vt),Yt=tt.mul(bt,Et),Ft=tt.mul(xt,Ct),Ht=tt.add(yt,bt),Qt=tt.add(vt,Et);Ht=tt.mul(Ht,Qt),Qt=tt.add(Nt,Yt),Ht=tt.sub(Ht,Qt),Qt=tt.add(yt,xt);let Vt=tt.add(vt,Ct);return Qt=tt.mul(Qt,Vt),Vt=tt.add(Nt,Ft),Qt=tt.sub(Qt,Vt),Vt=tt.add(bt,xt),St=tt.add(Et,Ct),Vt=tt.mul(Vt,St),St=tt.add(Yt,Ft),Vt=tt.sub(Vt,St),kt=tt.mul(It,Qt),St=tt.mul(Ot,Ft),kt=tt.add(St,kt),St=tt.sub(Yt,kt),kt=tt.add(Yt,kt),At=tt.mul(St,kt),Yt=tt.add(Nt,Nt),Yt=tt.add(Yt,Nt),Ft=tt.mul(It,Ft),Qt=tt.mul(Ot,Qt),Yt=tt.add(Yt,Ft),Ft=tt.sub(Nt,Ft),Ft=tt.mul(It,Ft),Qt=tt.add(Qt,Ft),Nt=tt.mul(Yt,Qt),At=tt.add(At,Nt),Nt=tt.mul(Vt,Qt),St=tt.mul(Ht,St),St=tt.sub(St,Nt),Nt=tt.mul(Ht,Yt),kt=tt.mul(Vt,kt),kt=tt.add(kt,Nt),new ht(St,At,kt)}subtract(gt){return this.add(gt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(gt){return ft.wNAFCached(this,gt,ht.normalizeZ)}multiplyUnsafe(gt){aInRange("scalar",gt,_0n$3,o.n);const yt=ht.ZERO;if(gt===_0n$3)return yt;if(gt===_1n$5)return this;const{endo:bt}=o;if(!bt)return ft.unsafeLadder(this,gt);let{k1neg:xt,k1:vt,k2neg:Et,k2:Ct}=bt.splitScalar(gt),St=yt,At=yt,kt=this;for(;vt>_0n$3||Ct>_0n$3;)vt&_1n$5&&(St=St.add(kt)),Ct&_1n$5&&(At=At.add(kt)),kt=kt.double(),vt>>=_1n$5,Ct>>=_1n$5;return xt&&(St=St.negate()),Et&&(At=At.negate()),At=new ht(tt.mul(At.px,bt.beta),At.py,At.pz),St.add(At)}multiply(gt){const{endo:yt,n:bt}=o;aInRange("scalar",gt,_1n$5,bt);let xt,vt;if(yt){const{k1neg:Et,k1:Ct,k2neg:St,k2:At}=yt.splitScalar(gt);let{p:kt,f:It}=this.wNAF(Ct),{p:Ot,f:Nt}=this.wNAF(At);kt=ft.constTimeNegate(Et,kt),Ot=ft.constTimeNegate(St,Ot),Ot=new ht(tt.mul(Ot.px,yt.beta),Ot.py,Ot.pz),xt=kt.add(Ot),vt=It.add(Nt)}else{const{p:Et,f:Ct}=this.wNAF(gt);xt=Et,vt=Ct}return ht.normalizeZ([xt,vt])[0]}multiplyAndAddUnsafe(gt,yt,bt){const xt=ht.BASE,vt=(Ct,St)=>St===_0n$3||St===_1n$5||!Ct.equals(xt)?Ct.multiplyUnsafe(St):Ct.multiply(St),Et=vt(this,yt).add(vt(gt,bt));return Et.is0()?void 0:Et}toAffine(gt){return lt(this,gt)}isTorsionFree(){const{h:gt,isTorsionFree:yt}=o;if(gt===_1n$5)return!0;if(yt)return yt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:gt,clearCofactor:yt}=o;return gt===_1n$5?this:yt?yt(ht,this):this.multiplyUnsafe(o.h)}toRawBytes(gt=!0){return abool("isCompressed",gt),this.assertValidity(),nt(ht,this,gt)}toHex(gt=!0){return abool("isCompressed",gt),bytesToHex$2(this.toRawBytes(gt))}}ht.BASE=new ht(o.Gx,o.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const mt=o.nBitLength,ft=wNAF(ht,o.endo?Math.ceil(mt/2):mt);return{CURVE:o,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(et){const o=validateBasic(et);return validateObject(o,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...o})}function weierstrass$1(et){const o=validateOpts$2(et),{Fp:tt,n:rt}=o,nt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(Ft){return mod$1(Ft,rt)}function st(Ft){return invert$1(Ft,rt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...o,toBytes(Ft,Ht,Qt){const Vt=Ht.toAffine(),Bt=tt.toBytes(Vt.x),Wt=concatBytes$1;return abool("isCompressed",Qt),Qt?Wt(Uint8Array.from([Ht.hasEvenY()?2:3]),Bt):Wt(Uint8Array.from([4]),Bt,tt.toBytes(Vt.y))},fromBytes(Ft){const Ht=Ft.length,Qt=Ft[0],Vt=Ft.subarray(1);if(Ht===nt&&(Qt===2||Qt===3)){const Bt=bytesToNumberBE(Vt);if(!inRange(Bt,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const Wt=lt(Bt);let jt;try{jt=tt.sqrt(Wt)}catch(Pt){const Gt=Pt instanceof Error?": "+Pt.message:"";throw new Error("Point is not on curve"+Gt)}const Xt=(jt&_1n$5)===_1n$5;return(Qt&1)===1!==Xt&&(jt=tt.neg(jt)),{x:Bt,y:jt}}else if(Ht===ot&&Qt===4){const Bt=tt.fromBytes(Vt.subarray(0,tt.BYTES)),Wt=tt.fromBytes(Vt.subarray(tt.BYTES,2*tt.BYTES));return{x:Bt,y:Wt}}else throw new Error(`Point of length ${Ht} was invalid. Expected ${nt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=Ft=>bytesToHex$2(numberToBytesBE(Ft,o.nByteLength));function mt(Ft){const Ht=rt>>_1n$5;return Ft>Ht}function ft(Ft){return mt(Ft)?it(-Ft):Ft}const pt=(Ft,Ht,Qt)=>bytesToNumberBE(Ft.slice(Ht,Qt));class gt{constructor(Ht,Qt,Vt){this.r=Ht,this.s=Qt,this.recovery=Vt,this.assertValidity()}static fromCompact(Ht){const Qt=o.nByteLength;return Ht=ensureBytes$1("compactSignature",Ht,Qt*2),new gt(pt(Ht,0,Qt),pt(Ht,Qt,2*Qt))}static fromDER(Ht){const{r:Qt,s:Vt}=DER.toSig(ensureBytes$1("DER",Ht));return new gt(Qt,Vt)}assertValidity(){aInRange("r",this.r,_1n$5,rt),aInRange("s",this.s,_1n$5,rt)}addRecoveryBit(Ht){return new gt(this.r,this.s,Ht)}recoverPublicKey(Ht){const{r:Qt,s:Vt,recovery:Bt}=this,Wt=Ct(ensureBytes$1("msgHash",Ht));if(Bt==null||![0,1,2,3].includes(Bt))throw new Error("recovery id invalid");const jt=Bt===2||Bt===3?Qt+o.n:Qt;if(jt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Xt=Bt&1?"03":"02",Kt=at.fromHex(Xt+ht(jt)),Pt=st(jt),Gt=it(-Wt*Pt),tr=it(Vt*Pt),zt=at.BASE.multiplyAndAddUnsafe(Kt,Gt,tr);if(!zt)throw new Error("point at infinify");return zt.assertValidity(),zt}hasHighS(){return mt(this.s)}normalizeS(){return this.hasHighS()?new gt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const yt={isValidPrivateKey(Ft){try{return ct(Ft),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const Ft=getMinHashLength(o.n);return mapHashToField(o.randomBytes(Ft),o.n)},precompute(Ft=8,Ht=at.BASE){return Ht._setWindowSize(Ft),Ht.multiply(BigInt(3)),Ht}};function bt(Ft,Ht=!0){return at.fromPrivateKey(Ft).toRawBytes(Ht)}function xt(Ft){const Ht=isBytes$2(Ft),Qt=typeof Ft=="string",Vt=(Ht||Qt)&&Ft.length;return Ht?Vt===nt||Vt===ot:Qt?Vt===2*nt||Vt===2*ot:Ft instanceof at}function vt(Ft,Ht,Qt=!0){if(xt(Ft))throw new Error("first arg must be private key");if(!xt(Ht))throw new Error("second arg must be public key");return at.fromHex(Ht).multiply(ct(Ft)).toRawBytes(Qt)}const Et=o.bits2int||function(Ft){const Ht=bytesToNumberBE(Ft),Qt=Ft.length*8-o.nBitLength;return Qt>0?Ht>>BigInt(Qt):Ht},Ct=o.bits2int_modN||function(Ft){return it(Et(Ft))},St=bitMask(o.nBitLength);function At(Ft){return aInRange(`num < 2^${o.nBitLength}`,Ft,_0n$3,St),numberToBytesBE(Ft,o.nByteLength)}function kt(Ft,Ht,Qt=It){if(["recovered","canonical"].some(rr=>rr in Qt))throw new Error("sign() legacy options not supported");const{hash:Vt,randomBytes:Bt}=o;let{lowS:Wt,prehash:jt,extraEntropy:Xt}=Qt;Wt==null&&(Wt=!0),Ft=ensureBytes$1("msgHash",Ft),validateSigVerOpts(Qt),jt&&(Ft=ensureBytes$1("prehashed msgHash",Vt(Ft)));const Kt=Ct(Ft),Pt=ct(Ht),Gt=[At(Pt),At(Kt)];if(Xt!=null&&Xt!==!1){const rr=Xt===!0?Bt(tt.BYTES):Xt;Gt.push(ensureBytes$1("extraEntropy",rr))}const tr=concatBytes$1(...Gt),zt=Kt;function lr(rr){const Jt=Et(rr);if(!dt(Jt))return;const Rt=st(Jt),Mt=at.BASE.multiply(Jt).toAffine(),Ut=it(Mt.x);if(Ut===_0n$3)return;const Zt=it(Rt*it(zt+Ut*Pt));if(Zt===_0n$3)return;let nr=(Mt.x===Ut?0:2)|Number(Mt.y&_1n$5),ar=Zt;return Wt&&mt(Zt)&&(ar=ft(Zt),nr^=1),new gt(Ut,ar,nr)}return{seed:tr,k2sig:lr}}const It={lowS:o.lowS,prehash:!1},Ot={lowS:o.lowS,prehash:!1};function Nt(Ft,Ht,Qt=It){const{seed:Vt,k2sig:Bt}=kt(Ft,Ht,Qt),Wt=o;return createHmacDrbg(Wt.hash.outputLen,Wt.nByteLength,Wt.hmac)(Vt,Bt)}at.BASE._setWindowSize(8);function Yt(Ft,Ht,Qt,Vt=Ot){var Mt;const Bt=Ft;if(Ht=ensureBytes$1("msgHash",Ht),Qt=ensureBytes$1("publicKey",Qt),"strict"in Vt)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Vt);const{lowS:Wt,prehash:jt}=Vt;let Xt,Kt;try{if(typeof Bt=="string"||isBytes$2(Bt))try{Xt=gt.fromDER(Bt)}catch(Ut){if(!(Ut instanceof DER.Err))throw Ut;Xt=gt.fromCompact(Bt)}else if(typeof Bt=="object"&&typeof Bt.r=="bigint"&&typeof Bt.s=="bigint"){const{r:Ut,s:Zt}=Bt;Xt=new gt(Ut,Zt)}else throw new Error("PARSE");Kt=at.fromHex(Qt)}catch(Ut){if(Ut.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(Wt&&Xt.hasHighS())return!1;jt&&(Ht=o.hash(Ht));const{r:Pt,s:Gt}=Xt,tr=Ct(Ht),zt=st(Gt),lr=it(tr*zt),rr=it(Pt*zt),Jt=(Mt=at.BASE.multiplyAndAddUnsafe(Kt,lr,rr))==null?void 0:Mt.toAffine();return Jt?it(Jt.x)===Pt:!1}return{CURVE:o,getPublicKey:bt,getSharedSecret:vt,sign:Nt,verify:Yt,ProjectivePoint:at,Signature:gt,utils:yt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(et){return{hash:et,hmac:(o,...tt)=>hmac(et,o,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(et,o){const tt=rt=>weierstrass$1({...et,...getHash(rt)});return Object.freeze({...tt(o),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(et,o)=>(et+o/_2n$3)/o;function sqrtMod$1(et){const o=secp256k1P,tt=BigInt(3),rt=BigInt(6),nt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=et*et*et%o,lt=ct*ct*et%o,dt=pow2$1(lt,tt,o)*lt%o,ht=pow2$1(dt,tt,o)*lt%o,mt=pow2$1(ht,_2n$3,o)*ct%o,ft=pow2$1(mt,nt,o)*mt%o,pt=pow2$1(ft,ot,o)*ft%o,gt=pow2$1(pt,st,o)*pt%o,yt=pow2$1(gt,at,o)*gt%o,bt=pow2$1(yt,st,o)*pt%o,xt=pow2$1(bt,tt,o)*lt%o,vt=pow2$1(xt,it,o)*ft%o,Et=pow2$1(vt,rt,o)*ct%o,Ct=pow2$1(Et,_2n$3,o);if(!Fp$1.eql(Fp$1.sqr(Ct),et))throw new Error("Cannot find square root");return Ct}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:et=>{const o=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),rt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),nt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*et,o),at=divNearest$1(-rt*et,o);let ct=mod$1(et-st*tt-at*nt,o),lt=mod$1(-st*rt-at*ot,o);const dt=ct>it,ht=lt>it;if(dt&&(ct=o-ct),ht&&(lt=o-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+et);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$3);BigInt(0);secp256k1.ProjectivePoint;function getAction(et,o,tt){const rt=et[o.name];if(typeof rt=="function")return rt;const nt=et[tt];return typeof nt=="function"?nt:ot=>o(et,ot)}const version$6="2.13.8",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$2=function(et,o,tt,rt){if(tt==="a"&&!rt)throw new TypeError("Private accessor was defined without a getter");if(typeof o=="function"?et!==o||!rt:!o.has(et))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?rt:tt==="a"?rt.call(et):rt?rt.value:o.get(et)},_BaseError_instances,_BaseError_walk;let BaseError$1=class _s extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(o,tt={}){var ot;super(),_BaseError_instances.add(this),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:"WagmiCoreError"});const rt=tt.cause instanceof _s?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,nt=tt.cause instanceof _s&&tt.cause.docsPath||tt.docsPath;this.message=[o||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...nt?[`Docs: ${this.docsBaseUrl}${nt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...rt?[`Details: ${rt}`]:[],`Version: ${this.version}`].join(` +`),tt.cause&&(this.cause=tt.cause),this.details=rt,this.docsPath=nt,this.metaMessages=tt.metaMessages,this.shortMessage=o}walk(o){return __classPrivateFieldGet$2(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,o)}};_BaseError_instances=new WeakSet,_BaseError_walk=function et(o,tt){return tt!=null&&tt(o)?o:o.cause?__classPrivateFieldGet$2(this,_BaseError_instances,"m",et).call(this,o.cause,tt):o};class ChainNotConfiguredError extends BaseError$1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$1{constructor({address:o,connector:tt}){super(`Account "${o}" not found for connector "${tt.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$1{constructor({connectionChainId:o,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${o}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${o}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:o}){super(`Connector "${o.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function connect$1(et,o){var rt;let tt;if(typeof o.connector=="function"?tt=et._internal.connectors.setup(o.connector):tt=o.connector,tt.uid===et.state.current)throw new ConnectorAlreadyConnectedError;try{et.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const nt=await tt.connect({chainId:o.chainId}),ot=nt.accounts;return tt.emitter.off("connect",et._internal.events.connect),tt.emitter.on("change",et._internal.events.change),tt.emitter.on("disconnect",et._internal.events.disconnect),await((rt=et.storage)==null?void 0:rt.setItem("recentConnectorId",tt.id)),et.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:nt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:nt.chainId}}catch(nt){throw et.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),nt}}const size$1=256;let index$3=size$1,buffer$2;function uid$1(et=11){if(!buffer$2||index$3+et>size$1*2){buffer$2="",index$3=0;for(let o=0;o{const bt=yt(gt);for(const vt in ft)delete bt[vt];const xt={...gt,...bt};return Object.assign(xt,{extend:pt(xt)})}}return Object.assign(ft,{extend:pt(ft)})}function createTransport({key:et,name:o,request:tt,retryCount:rt=3,retryDelay:nt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:et,name:o,request:tt,retryCount:rt,retryDelay:nt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:rt,retryDelay:nt,uid:at}),value:st}}function custom$1(et,o={}){const{key:tt="custom",name:rt="Custom Provider",retryDelay:nt}=o;return({retryCount:ot})=>createTransport({key:tt,name:rt,request:et.request.bind(et),retryCount:o.retryCount??ot,retryDelay:nt,type:"custom"})}class UrlRequiredError extends BaseError$3{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function http(et,o={}){const{batch:tt,fetchOptions:rt,key:nt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=o;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:mt=0}=typeof tt=="object"?tt:{},ft=o.retryCount??lt,pt=dt??o.timeout??1e4,gt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!gt)throw new UrlRequiredError;const yt=getHttpRpcClient(gt,{fetchOptions:rt,onRequest:it,onResponse:st,timeout:pt});return createTransport({key:nt,name:ot,async request({method:bt,params:xt}){const vt={method:bt,params:xt},{schedule:Et}=createBatchScheduler({id:gt,wait:mt,shouldSplitBatch(kt){return kt.length>ht},fn:kt=>yt.request({body:kt}),sort:(kt,It)=>kt.id-It.id}),Ct=async kt=>tt?Et(kt):[await yt.request({body:kt})],[{error:St,result:At}]=await Ct(vt);if(St)throw new RpcRequestError({body:vt,error:St,url:gt});return At},retryCount:ft,retryDelay:at,timeout:pt,type:"http"},{fetchOptions:rt,url:gt})}}async function getConnectorClient(et,o={}){let tt;if(o.connector){const{connector:ct}=o;if(et.state.status==="reconnecting"&&!ct.getAccounts&&!ct.getChainId)throw new ConnectorUnavailableReconnectingError({connector:ct});const[lt,dt]=await Promise.all([ct.getAccounts(),ct.getChainId()]);tt={accounts:lt,chainId:dt,connector:ct}}else tt=et.state.connections.get(et.state.current);if(!tt)throw new ConnectorNotConnectedError;const rt=o.chainId??tt.chainId,nt=await tt.connector.getChainId();if(nt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:nt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:rt});const it=parseAccount(o.account??tt.accounts[0]);if(it.address=getAddress(it.address),o.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=et.chains.find(ct=>ct.id===rt),at=await tt.connector.getProvider({chainId:rt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom$1(at)({...ct,retryCount:0})})}async function disconnect(et,o={}){var nt,ot;let tt;if(o.connector)tt=o.connector;else{const{connections:it,current:st}=et.state,at=it.get(st);tt=at==null?void 0:at.connector}const rt=et.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",et._internal.events.change),tt.emitter.off("disconnect",et._internal.events.disconnect),tt.emitter.on("connect",et._internal.events.connect),rt.delete(tt.uid)),et.setState(it=>{if(rt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=rt.values().next().value;return{...it,connections:new Map(rt),current:st.connector.uid}});{const it=et.state.current;if(!it)return;const st=(nt=et.state.connections.get(it))==null?void 0:nt.connector;if(!st)return;await((ot=et.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(et){return typeof et=="number"?et:et==="wei"?0:Math.abs(weiUnits[et])}function getAccount(et){const o=et.state.current,tt=et.state.connections.get(o),rt=tt==null?void 0:tt.accounts,nt=rt==null?void 0:rt[0],ot=et.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=et.state.status;switch(it){case"connected":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:it};case"reconnecting":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!nt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:nt,addresses:rt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:it};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:it}}}async function multicall(et,o){const{allowFailure:tt=!0,chainId:rt,contracts:nt,...ot}=o,it=et.getClient({chainId:rt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:nt,...ot})}function readContract(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,readContract$1,"readContract")(rt)}async function readContracts(et,o){var st;const{allowFailure:tt=!0,blockNumber:rt,blockTag:nt,...ot}=o,it=o.contracts;try{const at={};for(const[ht,mt]of it.entries()){const ft=mt.chainId??et.state.chainId;at[ft]||(at[ft]=[]),(st=at[ft])==null||st.push({contract:mt,index:ht})}const ct=()=>Object.entries(at).map(([ht,mt])=>multicall(et,{...ot,allowFailure:tt,blockNumber:rt,blockTag:nt,chainId:Number.parseInt(ht),contracts:mt.map(({contract:ft})=>ft)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:mt})=>mt));return lt.reduce((ht,mt,ft)=>(ht&&(ht[dt[ft]]=mt),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(et,{...lt,blockNumber:rt,blockTag:nt}));return tt?(await Promise.allSettled(ct())).map(lt=>lt.status==="fulfilled"?{result:lt.value,status:"success"}:{error:lt.reason,result:void 0,status:"failure"}):await Promise.all(ct())}}async function getBalance(et,o){const{address:tt,blockNumber:rt,blockTag:nt,chainId:ot,token:it,unit:st="ether"}=o;if(it)try{return getTokenBalance(et,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht instanceof ContractFunctionExecutionError){const mt=await getTokenBalance(et,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),ft=hexToString(trim$1(mt.symbol,{dir:"right"}));return{...mt,symbol:ft}}throw ht}const at=et.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(rt?{address:tt,blockNumber:rt}:{address:tt,blockTag:nt}),dt=et.chains.find(ht=>ht.id===ot)??at.chain;return{decimals:dt.nativeCurrency.decimals,formatted:formatUnits(lt,getUnit(st)),symbol:dt.nativeCurrency.symbol,value:lt}}async function getTokenBalance(et,o){const{balanceAddress:tt,chainId:rt,symbolType:nt,tokenAddress:ot,unit:it}=o,st={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:nt}]}],address:ot},[at,ct,lt]=await readContracts(et,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:rt},{...st,functionName:"decimals",chainId:rt},{...st,functionName:"symbol",chainId:rt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(et,o={}){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getBlockNumber$1,"getBlockNumber")(rt)}function getChainId(et){return et.state.chainId}function deepEqual(et,o){if(et===o)return!0;if(et&&o&&typeof et=="object"&&typeof o=="object"){if(et.constructor!==o.constructor)return!1;let tt,rt;if(Array.isArray(et)&&Array.isArray(o)){if(tt=et.length,tt!==o.length)return!1;for(rt=tt;rt--!==0;)if(!deepEqual(et[rt],o[rt]))return!1;return!0}if(et.valueOf!==Object.prototype.valueOf)return et.valueOf()===o.valueOf();if(et.toString!==Object.prototype.toString)return et.toString()===o.toString();const nt=Object.keys(et);if(tt=nt.length,tt!==Object.keys(o).length)return!1;for(rt=tt;rt--!==0;)if(!Object.prototype.hasOwnProperty.call(o,nt[rt]))return!1;for(rt=tt;rt--!==0;){const ot=nt[rt];if(ot&&!deepEqual(et[ot],o[ot]))return!1}return!0}return et!==et&&o!==o}let previousChains=[];function getChains(et){const o=et.chains;return deepEqual(previousChains,o)?previousChains:(previousChains=o,o)}let previousConnections=[];function getConnections(et){const o=[...et.state.connections.values()];return et.state.status==="reconnecting"||deepEqual(previousConnections,o)?previousConnections:(previousConnections=o,o)}let previousConnectors=[];function getConnectors(et){const o=et.connectors;return deepEqual(previousConnectors,o)?previousConnectors:(previousConnectors=o,o)}function getEnsAddress(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsAddress$1,"getEnsAddress")(rt)}function getEnsAvatar(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsAvatar$1,"getEnsAvatar")(rt)}function getEnsName(et,o){const{chainId:tt,...rt}=o,nt=et.getClient({chainId:tt});return getAction(nt,getEnsName$1,"getEnsName")(rt)}let isReconnecting=!1;async function reconnect(et,o={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,et.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=o.connectors)!=null&&ct.length)for(const dt of o.connectors){let ht;typeof dt=="function"?ht=et._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...et.connectors);let rt;try{rt=await((lt=et.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const nt={};for(const[,dt]of et.state.connections)nt[dt.connector.id]=1;rt&&(nt[rt]=0);const ot=Object.keys(nt).length>0?[...tt].sort((dt,ht)=>(nt[dt.id]??10)-(nt[ht.id]??10)):tt;let it=!1;const st=[],at=[];for(const dt of ot){const ht=await dt.getProvider().catch(()=>{});if(!ht||at.some(pt=>pt===ht)||!await dt.isAuthorized())continue;const ft=await dt.connect({isReconnecting:!0}).catch(()=>null);ft&&(dt.emitter.off("connect",et._internal.events.connect),dt.emitter.on("change",et._internal.events.change),dt.emitter.on("disconnect",et._internal.events.disconnect),et.setState(pt=>{const gt=new Map(it?pt.connections:new Map).set(dt.uid,{accounts:ft.accounts,chainId:ft.chainId,connector:dt});return{...pt,current:it?pt.current:dt.uid,connections:gt}}),st.push({accounts:ft.accounts,chainId:ft.chainId,connector:dt}),at.push(ht),it=!0)}return(et.state.status==="reconnecting"||et.state.status==="connecting")&&(it?et.setState(dt=>({...dt,status:"connected"})):et.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(et,o){const{account:tt,connector:rt,...nt}=o;let ot;return typeof tt=="object"&&tt.type==="local"?ot=et.getClient():ot=await getConnectorClient(et,{account:tt,connector:rt}),getAction(ot,signMessage$1,"signMessage")({...nt,...tt?{account:tt}:{}})}class ProviderNotFoundError extends BaseError$1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$1{constructor({connector:o}){super(`"${o.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(et,o){var it;const{addEthereumChainParameter:tt,chainId:rt}=o,nt=et.state.connections.get(((it=o.connector)==null?void 0:it.uid)??et.state.current);if(nt){const st=nt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:rt})}const ot=et.chains.find(st=>st.id===rt);if(!ot)throw new ChainNotConfiguredError;return et.setState(st=>({...st,chainId:rt})),ot}function watchAccount(et,o){const{onChange:tt}=o;return et.subscribe(()=>getAccount(et),tt,{equalityFn(rt,nt){const{connector:ot,...it}=rt,{connector:st,...at}=nt;return deepEqual(it,at)&&(ot==null?void 0:ot.id)===(st==null?void 0:st.id)&&(ot==null?void 0:ot.uid)===(st==null?void 0:st.uid)}})}function watchBlockNumber(et,o){const{syncConnectedChain:tt=et._internal.syncConnectedChain,...rt}=o;let nt;const ot=at=>{nt&&nt();const ct=et.getClient({chainId:at});return nt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(rt),nt},it=ot(o.chainId);let st;return tt&&!o.chainId&&(st=et.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(et,o){const{onChange:tt}=o;return et.subscribe(rt=>rt.chainId,tt)}function watchConnections(et,o){const{onChange:tt}=o;return et.subscribe(()=>getConnections(et),tt,{equalityFn:deepEqual})}function watchConnectors(et,o){const{onChange:tt}=o;return et._internal.connectors.subscribe((rt,nt)=>{tt(Object.values(rt),nt)})}function createConnector(et){return et}const supportsSimulationIdRegex=/(rabby|trustwallet)/,targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(et){return et!=null&&et.coinbaseWalletExtension?et.coinbaseWalletExtension:findProvider(et,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(et){return findProvider(et,o=>{if(!o.isMetaMask||o.isBraveWallet&&!o._events&&!o._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isZerion"];for(const rt of tt)if(o[rt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(et){var o,tt;return(o=et==null?void 0:et.phantom)!=null&&o.ethereum?(tt=et.phantom)==null?void 0:tt.ethereum:findProvider(et,"isPhantom")}}};injected.type="injected";function injected(et={}){const{shimDisconnect:o=!0,unstable_shimAsyncInject:tt}=et;function rt(){const at=et.target;if(typeof at=="function"){const ct=at();if(ct)return ct}return typeof at=="object"?at:typeof at=="string"?{...targetMap[at]??{id:at,name:`${at[0].toUpperCase()}${at.slice(1)}`,provider:`is${at[0].toUpperCase()}${at.slice(1)}`}}:{id:"injected",name:"Injected",provider(ct){return ct==null?void 0:ct.ethereum}}}let nt,ot,it,st;return at=>({get icon(){return rt().icon},get id(){return rt().id},get name(){return rt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&et.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),nt||(nt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",nt)))},async connect({chainId:ct,isReconnecting:lt}={}){var mt,ft,pt,gt,yt,bt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(o)try{ht=(gt=(pt=(ft=(mt=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:mt.caveats)==null?void 0:ft[0])==null?void 0:pt.value)==null?void 0:gt.map(vt=>getAddress(vt)),ht.length>0&&(ht=await this.getAccounts())}catch(xt){const vt=xt;if(vt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(vt);if(vt.code===ResourceUnavailableRpcError.code)throw vt}try{!(ht!=null&&ht.length)&&!lt&&(ht=(await dt.request({method:"eth_requestAccounts"})).map(Et=>getAddress(Et))),it&&(dt.removeListener("connect",it),it=void 0),nt||(nt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let xt=await this.getChainId();if(ct&&xt!==ct){const vt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:xt}});xt=(vt==null?void 0:vt.id)??xt}return o&&await((yt=at.storage)==null?void 0:yt.removeItem(`${this.id}.disconnected`)),et.target||await((bt=at.storage)==null?void 0:bt.setItem("injected.connected",!0)),{accounts:ht,chainId:xt}}catch(xt){const vt=xt;throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):vt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(vt):vt}},async disconnect(){var lt,dt;const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;ot&&(ct.removeListener("chainChanged",ot),ot=void 0),st&&(ct.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),ct.on("connect",it));try{await withTimeout(()=>ct.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}o&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),et.target||await((dt=at.storage)==null?void 0:dt.removeItem("injected.connected"))},async getAccounts(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;return(await ct.request({method:"eth_accounts"})).map(dt=>getAddress(dt))},async getChainId(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;const lt=await ct.request({method:"eth_chainId"});return Number(lt)},async getProvider(){if(typeof window>"u")return;let ct;const lt=rt();return typeof lt.provider=="function"?ct=lt.provider(window):typeof lt.provider=="string"?ct=findProvider(window,lt.provider):ct=lt.provider,ct&&!ct.removeListener&&("off"in ct&&typeof ct.off=="function"?ct.removeListener=ct.off:ct.removeListener=()=>{}),ct},async isAuthorized(){var ct,lt;try{if(o&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!et.target&&!await((lt=at.storage)==null?void 0:lt.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(tt!==void 0&&tt!==!1){const ft=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",ft),!!await this.getProvider()),pt=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(yt=>window.addEventListener("ethereum#initialized",()=>yt(ft()),{once:!0}))]:[],new Promise(yt=>setTimeout(()=>yt(ft()),pt))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,ft,pt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(yt=>yt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);try{return await Promise.all([dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt)}]}).then(async()=>{await this.getChainId()===lt&&at.emitter.emit("change",{chainId:lt})}),new Promise(yt=>{const bt=xt=>{"chainId"in xt&&xt.chainId===lt&&(at.emitter.off("change",bt),yt())};at.emitter.on("change",bt)})]),ht}catch(yt){const bt=yt;if(bt.code===4902||((ft=(mt=bt==null?void 0:bt.data)==null?void 0:mt.originalError)==null?void 0:ft.code)===4902)try{const{default:xt,...vt}=ht.blockExplorers??{};let Et;ct!=null&&ct.blockExplorerUrls?Et=ct.blockExplorerUrls:xt&&(Et=[xt.url,...Object.values(vt).map(kt=>kt.url)]);let Ct;(pt=ct==null?void 0:ct.rpcUrls)!=null&&pt.length?Ct=ct.rpcUrls:Ct=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const St={blockExplorerUrls:Et,chainId:numberToHex(lt),chainName:(ct==null?void 0:ct.chainName)??ht.name,iconUrls:ct==null?void 0:ct.iconUrls,nativeCurrency:(ct==null?void 0:ct.nativeCurrency)??ht.nativeCurrency,rpcUrls:Ct};if(await dt.request({method:"wallet_addEthereumChain",params:[St]}),await this.getChainId()!==lt)throw new UserRejectedRequestError(new Error("User rejected switch after adding network."));return ht}catch(xt){throw new UserRejectedRequestError(xt)}throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):new SwitchChainError(bt)}},async onAccountsChanged(ct){var lt;if(ct.length===0)this.onDisconnect();else if(at.emitter.listenerCount("connect")){const dt=(await this.getChainId()).toString();this.onConnect({chainId:dt}),o&&await((lt=at.storage)==null?void 0:lt.removeItem(`${this.id}.disconnected`))}else at.emitter.emit("change",{accounts:ct.map(dt=>getAddress(dt))})},onChainChanged(ct){const lt=Number(ct);at.emitter.emit("change",{chainId:lt})},async onConnect(ct){const lt=await this.getAccounts();if(lt.length===0)return;const dt=Number(ct.chainId);at.emitter.emit("connect",{accounts:lt,chainId:dt});const ht=await this.getProvider();ht&&(it&&(ht.removeListener("connect",it),it=void 0),nt||(nt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),ht.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),ht.on("disconnect",st)))},async onDisconnect(ct){const lt=await this.getProvider();ct&&ct.code===1013&<&&(await this.getAccounts()).length||(at.emitter.emit("disconnect"),lt&&(ot&&(lt.removeListener("chainChanged",ot),ot=void 0),st&&(lt.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),lt.on("connect",it))))}})}function findProvider(et,o){function tt(nt){return typeof o=="function"?o(nt):typeof o=="string"?nt[o]:!0}const rt=et.ethereum;if(rt!=null&&rt.providers)return rt.providers.find(nt=>tt(nt));if(rt&&tt(rt))return rt}function requestProviders(et){if(typeof window>"u")return;const o=tt=>et(tt.detail);return window.addEventListener("eip6963:announceProvider",o),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",o)}function createStore$1(){const et=new Set;let o=[];const tt=()=>requestProviders(nt=>{o.some(({info:ot})=>ot.uuid===nt.info.uuid)||(o=[...o,nt],et.forEach(ot=>ot(o,{added:[nt]})))});let rt=tt();return{_listeners(){return et},clear(){et.forEach(nt=>nt([],{removed:[...o]})),o=[]},destroy(){this.clear(),et.clear(),rt==null||rt()},findProvider({rdns:nt}){return o.find(ot=>ot.info.rdns===nt)},getProviders(){return o},reset(){this.clear(),rt==null||rt(),rt=tt()},subscribe(nt,{emitImmediately:ot}={}){return et.add(nt),ot&&nt(o,{added:o}),()=>et.delete(nt)}}}const __vite_import_meta_env__$2={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1},subscribeWithSelectorImpl=et=>(o,tt,rt)=>{const nt=rt.subscribe;return rt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(rt.getState());ct=ht=>{const mt=it(ht);if(!lt(dt,mt)){const ft=dt;st(dt=mt,ft)}},at!=null&&at.fireImmediately&&st(dt,dt)}return nt(ct)},et(o,tt,rt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(et,o){let tt;try{tt=et()}catch{return}return{getItem:nt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(nt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(nt,ot)=>tt.setItem(nt,JSON.stringify(ot,void 0)),removeItem:nt=>tt.removeItem(nt)}}const toThenable=et=>o=>{try{const tt=et(o);return tt instanceof Promise?tt:{then(rt){return toThenable(rt)(tt)},catch(rt){return this}}}catch(tt){return{then(rt){return this},catch(rt){return toThenable(rt)(tt)}}}},oldImpl=(et,o)=>(tt,rt,nt)=>{let ot={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:gt=>gt,version:0,merge:(gt,yt)=>({...yt,...gt}),...o},it=!1;const st=new Set,at=new Set;let ct;try{ct=ot.getStorage()}catch{}if(!ct)return et((...gt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...gt)},rt,nt);const lt=toThenable(ot.serialize),dt=()=>{const gt=ot.partialize({...rt()});let yt;const bt=lt({state:gt,version:ot.version}).then(xt=>ct.setItem(ot.name,xt)).catch(xt=>{yt=xt});if(yt)throw yt;return bt},ht=nt.setState;nt.setState=(gt,yt)=>{ht(gt,yt),dt()};const mt=et((...gt)=>{tt(...gt),dt()},rt,nt);let ft;const pt=()=>{var gt;if(!ct)return;it=!1,st.forEach(bt=>bt(rt()));const yt=((gt=ot.onRehydrateStorage)==null?void 0:gt.call(ot,rt()))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(bt=>{if(bt)return ot.deserialize(bt)}).then(bt=>{if(bt)if(typeof bt.version=="number"&&bt.version!==ot.version){if(ot.migrate)return ot.migrate(bt.state,bt.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return bt.state}).then(bt=>{var xt;return ft=ot.merge(bt,(xt=rt())!=null?xt:mt),tt(ft,!0),dt()}).then(()=>{yt==null||yt(ft,void 0),it=!0,at.forEach(bt=>bt(ft))}).catch(bt=>{yt==null||yt(void 0,bt)})};return nt.persist={setOptions:gt=>{ot={...ot,...gt},gt.getStorage&&(ct=gt.getStorage())},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>pt(),hasHydrated:()=>it,onHydrate:gt=>(st.add(gt),()=>{st.delete(gt)}),onFinishHydration:gt=>(at.add(gt),()=>{at.delete(gt)})},pt(),ft||mt},newImpl=(et,o)=>(tt,rt,nt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:pt=>pt,version:0,merge:(pt,gt)=>({...gt,...pt}),...o},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return et((...pt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...pt)},rt,nt);const lt=()=>{const pt=ot.partialize({...rt()});return ct.setItem(ot.name,{state:pt,version:ot.version})},dt=nt.setState;nt.setState=(pt,gt)=>{dt(pt,gt),lt()};const ht=et((...pt)=>{tt(...pt),lt()},rt,nt);let mt;const ft=()=>{var pt,gt;if(!ct)return;it=!1,st.forEach(bt=>{var xt;return bt((xt=rt())!=null?xt:ht)});const yt=((gt=ot.onRehydrateStorage)==null?void 0:gt.call(ot,(pt=rt())!=null?pt:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(bt=>{if(bt)if(typeof bt.version=="number"&&bt.version!==ot.version){if(ot.migrate)return ot.migrate(bt.state,bt.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return bt.state}).then(bt=>{var xt;return mt=ot.merge(bt,(xt=rt())!=null?xt:ht),tt(mt,!0),lt()}).then(()=>{yt==null||yt(mt,void 0),mt=rt(),it=!0,at.forEach(bt=>bt(mt))}).catch(bt=>{yt==null||yt(void 0,bt)})};return nt.persist={setOptions:pt=>{ot={...ot,...pt},pt.storage&&(ct=pt.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>ft(),hasHydrated:()=>it,onHydrate:pt=>(st.add(pt),()=>{st.delete(pt)}),onFinishHydration:pt=>(at.add(pt),()=>{at.delete(pt)})},ot.skipHydration||ft(),mt||ht},persistImpl=(et,o)=>"getStorage"in o||"serialize"in o||"deserialize"in o?((__vite_import_meta_env__$2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),oldImpl(et,o)):newImpl(et,o),persist=persistImpl,__vite_import_meta_env__$1={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1},createStoreImpl=et=>{let o;const tt=new Set,rt=(at,ct)=>{const lt=typeof at=="function"?at(o):at;if(!Object.is(lt,o)){const dt=o;o=ct??typeof lt!="object"?lt:Object.assign({},o,lt),tt.forEach(ht=>ht(o,dt))}},nt=()=>o,st={setState:rt,getState:nt,subscribe:at=>(tt.add(at),()=>tt.delete(at)),destroy:()=>{(__vite_import_meta_env__$1?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),tt.clear()}};return o=et(rt,nt,st),st},createStore=et=>et?createStoreImpl(et):createStoreImpl;var eventemitter3={exports:{}};(function(et){var o=Object.prototype.hasOwnProperty,tt="~";function rt(){}Object.create&&(rt.prototype=Object.create(null),new rt().__proto__||(tt=!1));function nt(at,ct,lt){this.fn=at,this.context=ct,this.once=lt||!1}function ot(at,ct,lt,dt,ht){if(typeof lt!="function")throw new TypeError("The listener must be a function");var mt=new nt(lt,dt||at,ht),ft=tt?tt+ct:ct;return at._events[ft]?at._events[ft].fn?at._events[ft]=[at._events[ft],mt]:at._events[ft].push(mt):(at._events[ft]=mt,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new rt:delete at._events[ct]}function st(){this._events=new rt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)o.call(lt,dt)&&ct.push(tt?dt.slice(1):dt);return Object.getOwnPropertySymbols?ct.concat(Object.getOwnPropertySymbols(lt)):ct},st.prototype.listeners=function(ct){var lt=tt?tt+ct:ct,dt=this._events[lt];if(!dt)return[];if(dt.fn)return[dt.fn];for(var ht=0,mt=dt.length,ft=new Array(mt);ht{let nt=rt;return(nt==null?void 0:nt.__type)==="bigint"&&(nt=BigInt(nt.value)),(nt==null?void 0:nt.__type)==="Map"&&(nt=new Map(nt.value)),(o==null?void 0:o(tt,nt))??nt})}function getReferenceKey(et,o){return et.slice(0,o).join(".")||"."}function getCutoff(et,o){const{length:tt}=et;for(let rt=0;rt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(o==null?void 0:o(nt,it))??it},rt),tt??void 0)}function createStorage(et){const{deserialize:o=deserialize$1,key:tt="wagmi",serialize:rt=serialize$1,storage:nt=noopStorage}=et;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...nt,key:tt,async getItem(it,st){const at=nt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?o(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(nt.removeItem(at)):await ot(nt.setItem(at,rt(st)))},async removeItem(it){await ot(nt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer$1;function uid(et=11){if(!buffer$1||index$2+et>size*2){buffer$1="",index$2=0;for(let o=0;oot.chains),at=createStore(()=>[...ot.connectors??[],...nt?[]:(it==null?void 0:it.getProviders().map(lt))??[]].map(ct));function ct(Et){var At;const Ct=createEmitter(uid()),St={...Et({emitter:Ct,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:Ct,uid:Ct.uid};return Ct.on("connect",xt),(At=St.setup)==null||At.call(St),St}function lt(Et){const{info:Ct}=Et,St=Et.provider;return injected({target:{...Ct,id:Ct.rdns,provider:St}})}const dt=new Map;function ht(Et={}){const Ct=Et.chainId??gt.getState().chainId,St=st.getState().find(kt=>kt.id===Ct);if(Et.chainId&&!St)throw new ChainNotConfiguredError;{const kt=dt.get(gt.getState().chainId);if(kt&&!St)return kt;if(!St)throw new ChainNotConfiguredError}{const kt=dt.get(Ct);if(kt)return kt}let At;if(ot.client)At=ot.client({chain:St});else{const kt=St.id,It=st.getState().map(Yt=>Yt.id),Ot={},Nt=Object.entries(ot);for(const[Yt,Ft]of Nt)if(!(Yt==="chains"||Yt==="client"||Yt==="connectors"||Yt==="transports"))if(typeof Ft=="object")if(kt in Ft)Ot[Yt]=Ft[kt];else{if(It.some(Qt=>Qt in Ft))continue;Ot[Yt]=Ft}else Ot[Yt]=Ft;At=createClient({...Ot,chain:St,batch:Ot.batch??{multicall:!0},transport:Yt=>ot.transports[kt]({...Yt,connectors:at})})}return dt.set(Ct,At),At}function mt(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let ft;const pt="0.0.0-canary-";version$6.startsWith(pt)?ft=Number.parseInt(version$6.replace(pt,"")):ft=Number.parseInt(version$6.split(".")[0]??"0");const gt=createStore(subscribeWithSelector(tt?persist(mt,{migrate(Et,Ct){if(Ct===ft)return Et;const St=mt(),At=yt(Et,St.chainId);return{...St,chainId:At}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([Ct,St])=>{const{id:At,name:kt,type:It,uid:Ot}=St.connector;return[Ct,{...St,connector:{id:At,name:kt,type:It,uid:Ot}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,Ct){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const St=yt(Et,Ct.chainId);return{...Ct,...Et,chainId:St}},skipHydration:nt,storage:tt,version:ft}):mt));function yt(Et,Ct){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(St=>St.id===Et.chainId)?Et.chainId:Ct}rt&>.subscribe(({connections:Et,current:Ct})=>{var St;return Ct?(St=Et.get(Ct))==null?void 0:St.chainId:void 0},Et=>{if(st.getState().some(St=>St.id===Et))return gt.setState(St=>({...St,chainId:Et??St.chainId}))}),it==null||it.subscribe(Et=>{const Ct=new Map;for(const At of at.getState())Ct.set(At.id,!0);const St=[];for(const At of Et){const kt=ct(lt(At));Ct.has(kt.id)||St.push(kt)}tt&&!gt.persist.hasHydrated()||at.setState(At=>[...At,...St],!0)});function bt(Et){gt.setState(Ct=>{const St=Ct.connections.get(Et.uid);return St?{...Ct,connections:new Map(Ct.connections).set(Et.uid,{accounts:Et.accounts??St.accounts,chainId:Et.chainId??St.chainId,connector:St.connector})}:Ct})}function xt(Et){gt.getState().status==="connecting"||gt.getState().status==="reconnecting"||gt.setState(Ct=>{const St=at.getState().find(At=>At.uid===Et.uid);return St?(St.emitter.listenerCount("connect")&&St.emitter.off("connect",bt),St.emitter.listenerCount("change")||St.emitter.on("change",bt),St.emitter.listenerCount("disconnect")||St.emitter.on("disconnect",vt),{...Ct,connections:new Map(Ct.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:St}),current:Et.uid,status:"connected"}):Ct})}function vt(Et){gt.setState(Ct=>{const St=Ct.connections.get(Et.uid);if(St){const kt=St.connector;kt.emitter.listenerCount("change")&&St.connector.emitter.off("change",bt),kt.emitter.listenerCount("disconnect")&&St.connector.emitter.off("disconnect",vt),kt.emitter.listenerCount("connect")||St.connector.emitter.on("connect",xt)}if(Ct.connections.delete(Et.uid),Ct.connections.size===0)return{...Ct,connections:new Map,current:null,status:"disconnected"};const At=Ct.connections.values().next().value;return{...Ct,connections:new Map(Ct.connections),current:At.connector.uid}})}return{get chains(){return st.getState()},get connectors(){return at.getState()},storage:tt,getClient:ht,get state(){return gt.getState()},setState(Et){let Ct;typeof Et=="function"?Ct=Et(gt.getState()):Ct=Et;const St=mt();typeof Ct!="object"&&(Ct=St),Object.keys(St).some(kt=>!(kt in Ct))&&(Ct=St),gt.setState(Ct,!0)},subscribe(Et,Ct,St){return gt.subscribe(Et,Ct,St?{...St,fireImmediately:St.emitImmediately}:void 0)},_internal:{mipd:it,store:gt,ssr:!!nt,syncConnectedChain:rt,transports:ot.transports,chains:{setState(Et){const Ct=typeof Et=="function"?Et(st.getState()):Et;if(Ct.length!==0)return st.setState(Ct,!0)},subscribe(Et){return st.subscribe(Et)}},connectors:{providerDetailToConnector:lt,setup:ct,setState(Et){return at.setState(typeof Et=="function"?Et(at.getState()):Et,!0)},subscribe(Et){return at.subscribe(Et)}},events:{change:bt,connect:xt,disconnect:vt}}}}function hydrate(et,o){const{initialState:tt,reconnectOnMount:rt}=o;return tt&&!et._internal.store.persist.hasHydrated()&&et.setState({...tt,chainId:et.chains.some(nt=>nt.id===tt.chainId)?tt.chainId:et.chains[0].id,connections:rt?tt.connections:new Map,status:rt?"reconnecting":"disconnected"}),{async onMount(){var nt;if(et._internal.ssr){await et._internal.store.persist.rehydrate();const ot=(nt=et._internal.mipd)==null?void 0:nt.getProviders().map(et._internal.connectors.providerDetailToConnector).map(et._internal.connectors.setup);et._internal.connectors.setState(it=>[...it,...ot??[]])}rt?reconnect(et):et.storage&&et.setState(ot=>({...ot,connections:new Map}))}}}function extractRpcUrls(et){var ot,it,st;const{chain:o}=et,tt=o.rpcUrls.default.http[0];if(!et.transports)return[tt];const rt=(it=(ot=et.transports)==null?void 0:ot[o.id])==null?void 0:it.call(ot,{chain:o});return(((st=rt==null?void 0:rt.value)==null?void 0:st.transports)||[rt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(et){const{children:o,config:tt,initialState:rt,reconnectOnMount:nt=!0}=et,{onMount:ot}=hydrate(tt,{initialState:rt,reconnectOnMount:nt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),o}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(et){const{children:o,config:tt}=et,rt={value:tt};return reactExports.createElement(Hydrate,et,reactExports.createElement(WagmiContext.Provider,rt,o))}const version$5="2.12.19",getVersion=()=>`wagmi@${version$5}`;class BaseError extends BaseError$1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return getVersion()}}class WagmiProviderNotFoundError extends BaseError{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function useConfig(et={}){const o=et.config??reactExports.useContext(WagmiContext);if(!o)throw new WagmiProviderNotFoundError;return o}function watchChains(et,o){const{onChange:tt}=o;return et._internal.chains.subscribe((rt,nt)=>{tt(rt,nt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -87,7 +87,7 @@ ${prettyStateOverride(mt)}`),super(o.shortMessage,{cause:o,docsPath:rt,metaMessa * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var h$3=reactExports,n$2=shimExports;function p$2(et,o){return et===o&&(et!==0||1/et===1/o)||et!==et&&o!==o}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(et,o,tt,rt,nt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(mt){if(!ct){if(ct=!0,lt=mt,mt=rt(mt),nt!==void 0&&it.hasValue){var ft=it.value;if(nt(ft,mt))return dt=ft}return dt=mt}if(ft=dt,q$3(lt,mt))return ft;var pt=rt(mt);return nt!==void 0&&nt(ft,pt)?ft:(lt=mt,dt=pt)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(o())},ht===null?void 0:function(){return at(ht())}]},[o,tt,rt,nt]);var st=r$3(et,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=et=>typeof et=="object"&&!Array.isArray(et);function useSyncExternalStoreWithTracked(et,o,tt=o,rt=deepEqual){const nt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(et,o,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&nt.current.length){for(const at of nt.current)if(!rt(it[at],st[at]))return!1;return!0}return rt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(nt.current.includes(at)||nt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(et={}){const o=useConfig(et);return useSyncExternalStoreWithTracked(tt=>watchAccount(o,{onChange:tt}),()=>getAccount(o))}function useAccountEffect(et={}){const{onConnect:o,onDisconnect:tt}=et,rt=useConfig(et);reactExports.useEffect(()=>watchAccount(rt,{onChange(nt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&nt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=nt,dt=ot.status==="reconnecting"||ot.status===void 0;o==null||o({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&nt.status==="disconnected"&&(tt==null||tt())}}),[rt,o,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(et){return this.listeners.add(et),this.onSubscribe(),()=>{this.listeners.delete(et),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(et,o){return typeof et=="function"?et(o):et}function isValidTimeout(et){return typeof et=="number"&&et>=0&&et!==1/0}function timeUntilStale(et,o){return Math.max(et+(o||0)-Date.now(),0)}function resolveStaleTime(et,o){return typeof et=="function"?et(o):et}function resolveEnabled(et,o){return typeof et=="function"?et(o):et}function matchQuery(et,o){const{type:tt="all",exact:rt,fetchStatus:nt,predicate:ot,queryKey:it,stale:st}=et;if(it){if(rt){if(o.queryHash!==hashQueryKeyByOptions(it,o.options))return!1}else if(!partialMatchKey(o.queryKey,it))return!1}if(tt!=="all"){const at=o.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&o.isStale()!==st||nt&&nt!==o.state.fetchStatus||ot&&!ot(o))}function matchMutation(et,o){const{exact:tt,status:rt,predicate:nt,mutationKey:ot}=et;if(ot){if(!o.options.mutationKey)return!1;if(tt){if(hashKey(o.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(o.options.mutationKey,ot))return!1}return!(rt&&o.state.status!==rt||nt&&!nt(o))}function hashQueryKeyByOptions(et,o){return((o==null?void 0:o.queryKeyHashFn)||hashKey)(et)}function hashKey(et){return JSON.stringify(et,(o,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((rt,nt)=>(rt[nt]=tt[nt],rt),{}):tt)}function partialMatchKey(et,o){return et===o?!0:typeof et!=typeof o?!1:et&&o&&typeof et=="object"&&typeof o=="object"?!Object.keys(o).some(tt=>!partialMatchKey(et[tt],o[tt])):!1}function replaceEqualDeep(et,o){if(et===o)return et;const tt=isPlainArray(et)&&isPlainArray(o);if(tt||isPlainObject$3(et)&&isPlainObject$3(o)){const rt=tt?et:Object.keys(et),nt=rt.length,ot=tt?o:Object.keys(o),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(o,et)})}function replaceData(et,o,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(et,o):tt.structuralSharing!==!1?replaceEqualDeep(et,o):o}function addToEnd(et,o,tt=0){const rt=[...et,o];return tt&&rt.length>tt?rt.slice(1):rt}function addToStart(et,o,tt=0){const rt=[o,...et];return tt&&rt.length>tt?rt.slice(0,-1):rt}var skipToken=Symbol();function ensureQueryFn(et,o){return!et.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!et.queryFn||et.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${et.queryHash}'`)):et.queryFn}var kn,hn,Mn,Us,FocusManager=(Us=class extends Subscribable{constructor(){super();hr(this,kn);hr(this,hn);hr(this,Mn);ur(this,Mn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Lt(this,hn)||this.setEventListener(Lt(this,Mn))}onUnsubscribe(){var o;this.hasListeners()||((o=Lt(this,hn))==null||o.call(this),ur(this,hn,void 0))}setEventListener(o){var tt;ur(this,Mn,o),(tt=Lt(this,hn))==null||tt.call(this),ur(this,hn,o(rt=>{typeof rt=="boolean"?this.setFocused(rt):this.onFocus()}))}setFocused(o){Lt(this,kn)!==o&&(ur(this,kn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(tt=>{tt(o)})}isFocused(){var o;return typeof Lt(this,kn)=="boolean"?Lt(this,kn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},kn=new WeakMap,hn=new WeakMap,Mn=new WeakMap,Us),focusManager=new FocusManager,Bn,fn,Fn,zs,OnlineManager=(zs=class extends Subscribable{constructor(){super();hr(this,Bn,!0);hr(this,fn);hr(this,Fn);ur(this,Fn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o(!0),rt=()=>o(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",rt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",rt)}}})}onSubscribe(){Lt(this,fn)||this.setEventListener(Lt(this,Fn))}onUnsubscribe(){var o;this.hasListeners()||((o=Lt(this,fn))==null||o.call(this),ur(this,fn,void 0))}setEventListener(o){var tt;ur(this,Fn,o),(tt=Lt(this,fn))==null||tt.call(this),ur(this,fn,o(this.setOnline.bind(this)))}setOnline(o){Lt(this,Bn)!==o&&(ur(this,Bn,o),this.listeners.forEach(rt=>{rt(o)}))}isOnline(){return Lt(this,Bn)}},Bn=new WeakMap,fn=new WeakMap,Fn=new WeakMap,zs),onlineManager=new OnlineManager;function pendingThenable(){let et,o;const tt=new Promise((nt,ot)=>{et=nt,o=ot});tt.status="pending",tt.catch(()=>{});function rt(nt){Object.assign(tt,nt),delete tt.resolve,delete tt.reject}return tt.resolve=nt=>{rt({status:"fulfilled",value:nt}),et(nt)},tt.reject=nt=>{rt({status:"rejected",reason:nt}),o(nt)},tt}function defaultRetryDelay(et){return Math.min(1e3*2**et,3e4)}function canFetch(et){return(et??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(et){super("CancelledError"),this.revert=et==null?void 0:et.revert,this.silent=et==null?void 0:et.silent}};function isCancelledError(et){return et instanceof CancelledError}function createRetryer(et){let o=!1,tt=0,rt=!1,nt;const ot=pendingThenable(),it=pt=>{var gt;rt||(ht(new CancelledError(pt)),(gt=et.abort)==null||gt.call(et))},st=()=>{o=!0},at=()=>{o=!1},ct=()=>focusManager.isFocused()&&(et.networkMode==="always"||onlineManager.isOnline())&&et.canRun(),lt=()=>canFetch(et.networkMode)&&et.canRun(),dt=pt=>{var gt;rt||(rt=!0,(gt=et.onSuccess)==null||gt.call(et,pt),nt==null||nt(),ot.resolve(pt))},ht=pt=>{var gt;rt||(rt=!0,(gt=et.onError)==null||gt.call(et,pt),nt==null||nt(),ot.reject(pt))},mt=()=>new Promise(pt=>{var gt;nt=yt=>{(rt||ct())&&pt(yt)},(gt=et.onPause)==null||gt.call(et)}).then(()=>{var pt;nt=void 0,rt||(pt=et.onContinue)==null||pt.call(et)}),ft=()=>{if(rt)return;let pt;const gt=tt===0?et.initialPromise:void 0;try{pt=gt??et.fn()}catch(yt){pt=Promise.reject(yt)}Promise.resolve(pt).then(dt).catch(yt=>{var Ct;if(rt)return;const bt=et.retry??(isServer?0:3),xt=et.retryDelay??defaultRetryDelay,vt=typeof xt=="function"?xt(tt,yt):xt,Et=bt===!0||typeof bt=="number"&&ttct()?void 0:mt()).then(()=>{o?ht(yt):ft()})})};return{promise:ot,cancel:it,continue:()=>(nt==null||nt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?ft():mt().then(ft),ot)}}function createNotifyManager(){let et=[],o=0,tt=st=>{st()},rt=st=>{st()},nt=st=>setTimeout(st,0);const ot=st=>{o?et.push(st):nt(()=>{tt(st)})},it=()=>{const st=et;et=[],st.length&&nt(()=>{rt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;o++;try{at=st()}finally{o--,o||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{rt=st},setScheduler:st=>{nt=st}}}var notifyManager=createNotifyManager(),_n,Vs,Removable=(Vs=class{constructor(){hr(this,_n)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&ur(this,_n,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(et){this.gcTime=Math.max(this.gcTime||0,et??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Lt(this,_n)&&(clearTimeout(Lt(this,_n)),ur(this,_n,void 0))}},_n=new WeakMap,Vs),Un,zn,Vr,Or,io,Rn,Gr,nn,Hs,Query=(Hs=class extends Removable{constructor(o){super();hr(this,Gr);hr(this,Un);hr(this,zn);hr(this,Vr);hr(this,Or);hr(this,io);hr(this,Rn);ur(this,Rn,!1),ur(this,io,o.defaultOptions),this.setOptions(o.options),this.observers=[],ur(this,Vr,o.cache),this.queryKey=o.queryKey,this.queryHash=o.queryHash,ur(this,Un,getDefaultState$1(this.options)),this.state=o.state??Lt(this,Un),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var o;return(o=Lt(this,Or))==null?void 0:o.promise}setOptions(o){this.options={...Lt(this,io),...o},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Lt(this,Vr).remove(this)}setData(o,tt){const rt=replaceData(this.state.data,o,this.options);return fr(this,Gr,nn).call(this,{data:rt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),rt}setState(o,tt){fr(this,Gr,nn).call(this,{type:"setState",state:o,setStateOptions:tt})}cancel(o){var rt,nt;const tt=(rt=Lt(this,Or))==null?void 0:rt.promise;return(nt=Lt(this,Or))==null||nt.cancel(o),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Lt(this,Un))}isActive(){return this.observers.some(o=>resolveEnabled(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(o=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,o)}onFocus(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(tt=Lt(this,Or))==null||tt.continue()}onOnline(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(tt=Lt(this,Or))==null||tt.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),Lt(this,Vr).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(tt=>tt!==o),this.observers.length||(Lt(this,Or)&&(Lt(this,Rn)?Lt(this,Or).cancel({revert:!0}):Lt(this,Or).cancelRetry()),this.scheduleGc()),Lt(this,Vr).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,Gr,nn).call(this,{type:"invalidate"})}fetch(o,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(Lt(this,Or))return Lt(this,Or).continueRetry(),Lt(this,Or).promise}if(o&&this.setOptions(o),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const rt=new AbortController,nt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(ur(this,Rn,!0),rt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return nt(ht),ur(this,Rn,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};nt(it),(at=this.options.behavior)==null||at.onFetch(it,this),ur(this,zn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&fr(this,Gr,nn).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,mt,ft,pt;isCancelledError(dt)&&dt.silent||fr(this,Gr,nn).call(this,{type:"error",error:dt}),isCancelledError(dt)||((mt=(ht=Lt(this,Vr).config).onError)==null||mt.call(ht,dt,this),(pt=(ft=Lt(this,Vr).config).onSettled)==null||pt.call(ft,this.state.data,dt,this)),this.scheduleGc()};return ur(this,Or,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:rt.abort.bind(rt),onSuccess:dt=>{var ht,mt,ft,pt;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(gt){st(gt);return}(mt=(ht=Lt(this,Vr).config).onSuccess)==null||mt.call(ht,dt,this),(pt=(ft=Lt(this,Vr).config).onSettled)==null||pt.call(ft,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{fr(this,Gr,nn).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{fr(this,Gr,nn).call(this,{type:"pause"})},onContinue:()=>{fr(this,Gr,nn).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Lt(this,Or).start()}},Un=new WeakMap,zn=new WeakMap,Vr=new WeakMap,Or=new WeakMap,io=new WeakMap,Rn=new WeakMap,Gr=new WeakSet,nn=function(o){const tt=rt=>{switch(o.type){case"failed":return{...rt,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...rt,fetchStatus:"paused"};case"continue":return{...rt,fetchStatus:"fetching"};case"fetch":return{...rt,...fetchState(rt.data,this.options),fetchMeta:o.meta??null};case"success":return{...rt,data:o.data,dataUpdateCount:rt.dataUpdateCount+1,dataUpdatedAt:o.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const nt=o.error;return isCancelledError(nt)&&nt.revert&&Lt(this,zn)?{...Lt(this,zn),fetchStatus:"idle"}:{...rt,error:nt,errorUpdateCount:rt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:rt.fetchFailureCount+1,fetchFailureReason:nt,fetchStatus:"idle",status:"error"};case"invalidate":return{...rt,isInvalidated:!0};case"setState":return{...rt,...o.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(rt=>{rt.onQueryUpdate()}),Lt(this,Vr).notify({query:this,type:"updated",action:o})})},Hs);function fetchState(et,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(o.networkMode)?"fetching":"paused",...et===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(et){const o=typeof et.initialData=="function"?et.initialData():et.initialData,tt=o!==void 0,rt=tt?typeof et.initialDataUpdatedAt=="function"?et.initialDataUpdatedAt():et.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:tt?rt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Zr,Ws,QueryCache=(Ws=class extends Subscribable{constructor(o={}){super();hr(this,Zr);this.config=o,ur(this,Zr,new Map)}build(o,tt,rt){const nt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(nt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:nt,queryHash:ot,options:o.defaultQueryOptions(tt),state:rt,defaultOptions:o.getQueryDefaults(nt)}),this.add(it)),it}add(o){Lt(this,Zr).has(o.queryHash)||(Lt(this,Zr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const tt=Lt(this,Zr).get(o.queryHash);tt&&(o.destroy(),tt===o&&Lt(this,Zr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return Lt(this,Zr).get(o)}getAll(){return[...Lt(this,Zr).values()]}find(o){const tt={exact:!0,...o};return this.getAll().find(rt=>matchQuery(tt,rt))}findAll(o={}){const tt=this.getAll();return Object.keys(o).length>0?tt.filter(rt=>matchQuery(o,rt)):tt}notify(o){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(o)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},Zr=new WeakMap,Ws),qr,Lr,Tn,Kr,un,Gs,Mutation=(Gs=class extends Removable{constructor(o){super();hr(this,Kr);hr(this,qr);hr(this,Lr);hr(this,Tn);this.mutationId=o.mutationId,ur(this,Lr,o.mutationCache),ur(this,qr,[]),this.state=o.state||getDefaultState(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){Lt(this,qr).includes(o)||(Lt(this,qr).push(o),this.clearGcTimeout(),Lt(this,Lr).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){ur(this,qr,Lt(this,qr).filter(tt=>tt!==o)),this.scheduleGc(),Lt(this,Lr).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){Lt(this,qr).length||(this.state.status==="pending"?this.scheduleGc():Lt(this,Lr).remove(this))}continue(){var o;return((o=Lt(this,Tn))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var nt,ot,it,st,at,ct,lt,dt,ht,mt,ft,pt,gt,yt,bt,xt,vt,Et,Ct,St;ur(this,Tn,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(o):Promise.reject(new Error("No mutationFn found")),onFail:(At,kt)=>{fr(this,Kr,un).call(this,{type:"failed",failureCount:At,error:kt})},onPause:()=>{fr(this,Kr,un).call(this,{type:"pause"})},onContinue:()=>{fr(this,Kr,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Lt(this,Lr).canRun(this)}));const tt=this.state.status==="pending",rt=!Lt(this,Tn).canStart();try{if(!tt){fr(this,Kr,un).call(this,{type:"pending",variables:o,isPaused:rt}),await((ot=(nt=Lt(this,Lr).config).onMutate)==null?void 0:ot.call(nt,o,this));const kt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,o));kt!==this.state.context&&fr(this,Kr,un).call(this,{type:"pending",context:kt,variables:o,isPaused:rt})}const At=await Lt(this,Tn).start();return await((ct=(at=Lt(this,Lr).config).onSuccess)==null?void 0:ct.call(at,At,o,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,At,o,this.state.context)),await((mt=(ht=Lt(this,Lr).config).onSettled)==null?void 0:mt.call(ht,At,null,this.state.variables,this.state.context,this)),await((pt=(ft=this.options).onSettled)==null?void 0:pt.call(ft,At,null,o,this.state.context)),fr(this,Kr,un).call(this,{type:"success",data:At}),At}catch(At){try{throw await((yt=(gt=Lt(this,Lr).config).onError)==null?void 0:yt.call(gt,At,o,this.state.context,this)),await((xt=(bt=this.options).onError)==null?void 0:xt.call(bt,At,o,this.state.context)),await((Et=(vt=Lt(this,Lr).config).onSettled)==null?void 0:Et.call(vt,void 0,At,this.state.variables,this.state.context,this)),await((St=(Ct=this.options).onSettled)==null?void 0:St.call(Ct,void 0,At,o,this.state.context)),At}finally{fr(this,Kr,un).call(this,{type:"error",error:At})}}finally{Lt(this,Lr).runNext(this)}}},qr=new WeakMap,Lr=new WeakMap,Tn=new WeakMap,Kr=new WeakSet,un=function(o){const tt=rt=>{switch(o.type){case"failed":return{...rt,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...rt,isPaused:!0};case"continue":return{...rt,isPaused:!1};case"pending":return{...rt,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...rt,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...rt,data:void 0,error:o.error,failureCount:rt.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{Lt(this,qr).forEach(rt=>{rt.onMutationUpdate(o)}),Lt(this,Lr).notify({mutation:this,type:"updated",action:o})})},Gs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zr,so,Zs,MutationCache=(Zs=class extends Subscribable{constructor(o={}){super();hr(this,zr);hr(this,so);this.config=o,ur(this,zr,new Map),ur(this,so,Date.now())}build(o,tt,rt){const nt=new Mutation({mutationCache:this,mutationId:++Cn(this,so)._,options:o.defaultMutationOptions(tt),state:rt});return this.add(nt),nt}add(o){const tt=scopeFor(o),rt=Lt(this,zr).get(tt)??[];rt.push(o),Lt(this,zr).set(tt,rt),this.notify({type:"added",mutation:o})}remove(o){var rt;const tt=scopeFor(o);if(Lt(this,zr).has(tt)){const nt=(rt=Lt(this,zr).get(tt))==null?void 0:rt.filter(ot=>ot!==o);nt&&(nt.length===0?Lt(this,zr).delete(tt):Lt(this,zr).set(tt,nt))}this.notify({type:"removed",mutation:o})}canRun(o){var rt;const tt=(rt=Lt(this,zr).get(scopeFor(o)))==null?void 0:rt.find(nt=>nt.state.status==="pending");return!tt||tt===o}runNext(o){var rt;const tt=(rt=Lt(this,zr).get(scopeFor(o)))==null?void 0:rt.find(nt=>nt!==o&&nt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}getAll(){return[...Lt(this,zr).values()].flat()}find(o){const tt={exact:!0,...o};return this.getAll().find(rt=>matchMutation(tt,rt))}findAll(o={}){return this.getAll().filter(tt=>matchMutation(o,tt))}notify(o){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(o)})})}resumePausedMutations(){const o=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(o.map(tt=>tt.continue().catch(noop$4))))}},zr=new WeakMap,so=new WeakMap,Zs);function scopeFor(et){var o;return((o=et.options.scope)==null?void 0:o.id)??String(et.mutationId)}function infiniteQueryBehavior(et){return{onFetch:(o,tt)=>{var lt,dt,ht,mt,ft;const rt=o.options,nt=(ht=(dt=(lt=o.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((mt=o.state.data)==null?void 0:mt.pages)||[],it=((ft=o.state.data)==null?void 0:ft.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let pt=!1;const gt=xt=>{Object.defineProperty(xt,"signal",{enumerable:!0,get:()=>(o.signal.aborted?pt=!0:o.signal.addEventListener("abort",()=>{pt=!0}),o.signal)})},yt=ensureQueryFn(o.options,o.fetchOptions),bt=async(xt,vt,Et)=>{if(pt)return Promise.reject();if(vt==null&&xt.pages.length)return Promise.resolve(xt);const Ct={queryKey:o.queryKey,pageParam:vt,direction:Et?"backward":"forward",meta:o.options.meta};gt(Ct);const St=await yt(Ct),{maxPages:At}=o.options,kt=Et?addToStart:addToEnd;return{pages:kt(xt.pages,St,At),pageParams:kt(xt.pageParams,vt,At)}};if(nt&&ot.length){const xt=nt==="backward",vt=xt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},Ct=vt(rt,Et);st=await bt(Et,Ct,xt)}else{const xt=et??ot.length;do{const vt=at===0?it[0]??rt.initialPageParam:getNextPageParam(rt,st);if(at>0&&vt==null)break;st=await bt(st,vt),at++}while(at{var pt,gt;return(gt=(pt=o.options).persister)==null?void 0:gt.call(pt,ct,{queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},tt)}:o.fetchFn=ct}}}function getNextPageParam(et,{pages:o,pageParams:tt}){const rt=o.length-1;return o.length>0?et.getNextPageParam(o[rt],o,tt[rt],tt):void 0}function getPreviousPageParam(et,{pages:o,pageParams:tt}){var rt;return o.length>0?(rt=et.getPreviousPageParam)==null?void 0:rt.call(et,o[0],o,tt[0],tt):void 0}var Ir,pn,mn,Vn,Hn,gn,Wn,Gn,qs,QueryClient=(qs=class{constructor(et={}){hr(this,Ir);hr(this,pn);hr(this,mn);hr(this,Vn);hr(this,Hn);hr(this,gn);hr(this,Wn);hr(this,Gn);ur(this,Ir,et.queryCache||new QueryCache),ur(this,pn,et.mutationCache||new MutationCache),ur(this,mn,et.defaultOptions||{}),ur(this,Vn,new Map),ur(this,Hn,new Map),ur(this,gn,0)}mount(){Cn(this,gn)._++,Lt(this,gn)===1&&(ur(this,Wn,focusManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Lt(this,Ir).onFocus())})),ur(this,Gn,onlineManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Lt(this,Ir).onOnline())})))}unmount(){var et,o;Cn(this,gn)._--,Lt(this,gn)===0&&((et=Lt(this,Wn))==null||et.call(this),ur(this,Wn,void 0),(o=Lt(this,Gn))==null||o.call(this),ur(this,Gn,void 0))}isFetching(et){return Lt(this,Ir).findAll({...et,fetchStatus:"fetching"}).length}isMutating(et){return Lt(this,pn).findAll({...et,status:"pending"}).length}getQueryData(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Lt(this,Ir).get(o.queryHash))==null?void 0:tt.state.data}ensureQueryData(et){const o=this.getQueryData(et.queryKey);if(o===void 0)return this.fetchQuery(et);{const tt=this.defaultQueryOptions(et),rt=Lt(this,Ir).build(this,tt);return et.revalidateIfStale&&rt.isStaleByTime(resolveStaleTime(tt.staleTime,rt))&&this.prefetchQuery(tt),Promise.resolve(o)}}getQueriesData(et){return Lt(this,Ir).findAll(et).map(({queryKey:o,state:tt})=>{const rt=tt.data;return[o,rt]})}setQueryData(et,o,tt){const rt=this.defaultQueryOptions({queryKey:et}),nt=Lt(this,Ir).get(rt.queryHash),ot=nt==null?void 0:nt.state.data,it=functionalUpdate(o,ot);if(it!==void 0)return Lt(this,Ir).build(this,rt).setData(it,{...tt,manual:!0})}setQueriesData(et,o,tt){return notifyManager.batch(()=>Lt(this,Ir).findAll(et).map(({queryKey:rt})=>[rt,this.setQueryData(rt,o,tt)]))}getQueryState(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Lt(this,Ir).get(o.queryHash))==null?void 0:tt.state}removeQueries(et){const o=Lt(this,Ir);notifyManager.batch(()=>{o.findAll(et).forEach(tt=>{o.remove(tt)})})}resetQueries(et,o){const tt=Lt(this,Ir),rt={type:"active",...et};return notifyManager.batch(()=>(tt.findAll(et).forEach(nt=>{nt.reset()}),this.refetchQueries(rt,o)))}cancelQueries(et={},o={}){const tt={revert:!0,...o},rt=notifyManager.batch(()=>Lt(this,Ir).findAll(et).map(nt=>nt.cancel(tt)));return Promise.all(rt).then(noop$4).catch(noop$4)}invalidateQueries(et={},o={}){return notifyManager.batch(()=>{if(Lt(this,Ir).findAll(et).forEach(rt=>{rt.invalidate()}),et.refetchType==="none")return Promise.resolve();const tt={...et,type:et.refetchType??et.type??"active"};return this.refetchQueries(tt,o)})}refetchQueries(et={},o){const tt={...o,cancelRefetch:(o==null?void 0:o.cancelRefetch)??!0},rt=notifyManager.batch(()=>Lt(this,Ir).findAll(et).filter(nt=>!nt.isDisabled()).map(nt=>{let ot=nt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),nt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(rt).then(noop$4)}fetchQuery(et){const o=this.defaultQueryOptions(et);o.retry===void 0&&(o.retry=!1);const tt=Lt(this,Ir).build(this,o);return tt.isStaleByTime(resolveStaleTime(o.staleTime,tt))?tt.fetch(o):Promise.resolve(tt.state.data)}prefetchQuery(et){return this.fetchQuery(et).then(noop$4).catch(noop$4)}fetchInfiniteQuery(et){return et.behavior=infiniteQueryBehavior(et.pages),this.fetchQuery(et)}prefetchInfiniteQuery(et){return this.fetchInfiniteQuery(et).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(et){return et.behavior=infiniteQueryBehavior(et.pages),this.ensureQueryData(et)}resumePausedMutations(){return onlineManager.isOnline()?Lt(this,pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return Lt(this,Ir)}getMutationCache(){return Lt(this,pn)}getDefaultOptions(){return Lt(this,mn)}setDefaultOptions(et){ur(this,mn,et)}setQueryDefaults(et,o){Lt(this,Vn).set(hashKey(et),{queryKey:et,defaultOptions:o})}getQueryDefaults(et){const o=[...Lt(this,Vn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.queryKey)&&(tt={...tt,...rt.defaultOptions})}),tt}setMutationDefaults(et,o){Lt(this,Hn).set(hashKey(et),{mutationKey:et,defaultOptions:o})}getMutationDefaults(et){const o=[...Lt(this,Hn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.mutationKey)&&(tt={...tt,...rt.defaultOptions})}),tt}defaultQueryOptions(et){if(et._defaulted)return et;const o={...Lt(this,mn).queries,...this.getQueryDefaults(et.queryKey),...et,_defaulted:!0};return o.queryHash||(o.queryHash=hashQueryKeyByOptions(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.enabled!==!0&&o.queryFn===skipToken&&(o.enabled=!1),o}defaultMutationOptions(et){return et!=null&&et._defaulted?et:{...Lt(this,mn).mutations,...(et==null?void 0:et.mutationKey)&&this.getMutationDefaults(et.mutationKey),...et,_defaulted:!0}}clear(){Lt(this,Ir).clear(),Lt(this,pn).clear()}},Ir=new WeakMap,pn=new WeakMap,mn=new WeakMap,Vn=new WeakMap,Hn=new WeakMap,gn=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,qs),Br,Cr,ao,Mr,In,Zn,yn,Qr,co,qn,Kn,Pn,jn,bn,Qn,kr,oo,Rs,Ts,Is,Ps,js,Ns,Ds,ru,Ks,QueryObserver=(Ks=class extends Subscribable{constructor(o,tt){super();hr(this,kr);hr(this,Br);hr(this,Cr);hr(this,ao);hr(this,Mr);hr(this,In);hr(this,Zn);hr(this,yn);hr(this,Qr);hr(this,co);hr(this,qn);hr(this,Kn);hr(this,Pn);hr(this,jn);hr(this,bn);hr(this,Qn,new Set);this.options=tt,ur(this,Br,o),ur(this,Qr,null),ur(this,yn,pendingThenable()),this.options.experimental_prefetchInRender||Lt(this,yn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Lt(this,Cr).addObserver(this),shouldFetchOnMount(Lt(this,Cr),this.options)?fr(this,kr,oo).call(this):this.updateResult(),fr(this,kr,Ps).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Lt(this,Cr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Lt(this,Cr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,kr,js).call(this),fr(this,kr,Ns).call(this),Lt(this,Cr).removeObserver(this)}setOptions(o,tt){const rt=this.options,nt=Lt(this,Cr);if(this.options=Lt(this,Br).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Lt(this,Cr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,kr,Ds).call(this),Lt(this,Cr).setOptions(this.options),rt._defaulted&&!shallowEqualObjects(this.options,rt)&&Lt(this,Br).getQueryCache().notify({type:"observerOptionsUpdated",query:Lt(this,Cr),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Lt(this,Cr),nt,this.options,rt)&&fr(this,kr,oo).call(this),this.updateResult(tt),ot&&(Lt(this,Cr)!==nt||resolveEnabled(this.options.enabled,Lt(this,Cr))!==resolveEnabled(rt.enabled,Lt(this,Cr))||resolveStaleTime(this.options.staleTime,Lt(this,Cr))!==resolveStaleTime(rt.staleTime,Lt(this,Cr)))&&fr(this,kr,Rs).call(this);const it=fr(this,kr,Ts).call(this);ot&&(Lt(this,Cr)!==nt||resolveEnabled(this.options.enabled,Lt(this,Cr))!==resolveEnabled(rt.enabled,Lt(this,Cr))||it!==Lt(this,bn))&&fr(this,kr,Is).call(this,it)}getOptimisticResult(o){const tt=Lt(this,Br).getQueryCache().build(Lt(this,Br),o),rt=this.createResult(tt,o);return shouldAssignObserverCurrentProperties(this,rt)&&(ur(this,Mr,rt),ur(this,Zn,this.options),ur(this,In,Lt(this,Cr).state)),rt}getCurrentResult(){return Lt(this,Mr)}trackResult(o,tt){const rt={};return Object.keys(o).forEach(nt=>{Object.defineProperty(rt,nt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(nt),tt==null||tt(nt),o[nt])})}),rt}trackProp(o){Lt(this,Qn).add(o)}getCurrentQuery(){return Lt(this,Cr)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const tt=Lt(this,Br).defaultQueryOptions(o),rt=Lt(this,Br).getQueryCache().build(Lt(this,Br),tt);return rt.fetch().then(()=>this.createResult(rt,tt))}fetch(o){return fr(this,kr,oo).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),Lt(this,Mr)))}createResult(o,tt){var At;const rt=Lt(this,Cr),nt=this.options,ot=Lt(this,Mr),it=Lt(this,In),st=Lt(this,Zn),ct=o!==rt?o.state:Lt(this,ao),{state:lt}=o;let dt={...lt},ht=!1,mt;if(tt._optimisticResults){const kt=this.hasListeners(),It=!kt&&shouldFetchOnMount(o,tt),Ot=kt&&shouldFetchOptionally(o,rt,tt,nt);(It||Ot)&&(dt={...dt,...fetchState(lt.data,o.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:ft,errorUpdatedAt:pt,status:gt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Lt(this,co))mt=Lt(this,qn);else try{ur(this,co,tt.select),mt=tt.select(dt.data),mt=replaceData(ot==null?void 0:ot.data,mt,tt),ur(this,qn,mt),ur(this,Qr,null)}catch(kt){ur(this,Qr,kt)}else mt=dt.data;if(tt.placeholderData!==void 0&&mt===void 0&>==="pending"){let kt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))kt=ot.data;else if(kt=typeof tt.placeholderData=="function"?tt.placeholderData((At=Lt(this,Kn))==null?void 0:At.state.data,Lt(this,Kn)):tt.placeholderData,tt.select&&kt!==void 0)try{kt=tt.select(kt),ur(this,Qr,null)}catch(It){ur(this,Qr,It)}kt!==void 0&&(gt="success",mt=replaceData(ot==null?void 0:ot.data,kt,tt),ht=!0)}Lt(this,Qr)&&(ft=Lt(this,Qr),mt=Lt(this,qn),pt=Date.now(),gt="error");const yt=dt.fetchStatus==="fetching",bt=gt==="pending",xt=gt==="error",vt=bt&&yt,Et=mt!==void 0,St={status:gt,fetchStatus:dt.fetchStatus,isPending:bt,isSuccess:gt==="success",isError:xt,isInitialLoading:vt,isLoading:vt,data:mt,dataUpdatedAt:dt.dataUpdatedAt,error:ft,errorUpdatedAt:pt,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:yt,isRefetching:yt&&!bt,isLoadingError:xt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:xt&&Et,isStale:isStale(o,tt),refetch:this.refetch,promise:Lt(this,yn)};if(this.options.experimental_prefetchInRender){const kt=Nt=>{St.status==="error"?Nt.reject(St.error):St.data!==void 0&&Nt.resolve(St.data)},It=()=>{const Nt=ur(this,yn,St.promise=pendingThenable());kt(Nt)},Ot=Lt(this,yn);switch(Ot.status){case"pending":o.queryHash===rt.queryHash&&kt(Ot);break;case"fulfilled":(St.status==="error"||St.data!==Ot.value)&&It();break;case"rejected":(St.status!=="error"||St.error!==Ot.reason)&&It();break}}return St}updateResult(o){const tt=Lt(this,Mr),rt=this.createResult(Lt(this,Cr),this.options);if(ur(this,In,Lt(this,Cr).state),ur(this,Zn,this.options),Lt(this,In).data!==void 0&&ur(this,Kn,Lt(this,Cr)),shallowEqualObjects(rt,tt))return;ur(this,Mr,rt);const nt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!Lt(this,Qn).size)return!0;const at=new Set(st??Lt(this,Qn));return this.options.throwOnError&&at.add("error"),Object.keys(Lt(this,Mr)).some(ct=>{const lt=ct;return Lt(this,Mr)[lt]!==tt[lt]&&at.has(lt)})};(o==null?void 0:o.listeners)!==!1&&ot()&&(nt.listeners=!0),fr(this,kr,ru).call(this,{...nt,...o})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,kr,Ps).call(this)}},Br=new WeakMap,Cr=new WeakMap,ao=new WeakMap,Mr=new WeakMap,In=new WeakMap,Zn=new WeakMap,yn=new WeakMap,Qr=new WeakMap,co=new WeakMap,qn=new WeakMap,Kn=new WeakMap,Pn=new WeakMap,jn=new WeakMap,bn=new WeakMap,Qn=new WeakMap,kr=new WeakSet,oo=function(o){fr(this,kr,Ds).call(this);let tt=Lt(this,Cr).fetch(this.options,o);return o!=null&&o.throwOnError||(tt=tt.catch(noop$4)),tt},Rs=function(){fr(this,kr,js).call(this);const o=resolveStaleTime(this.options.staleTime,Lt(this,Cr));if(isServer||Lt(this,Mr).isStale||!isValidTimeout(o))return;const rt=timeUntilStale(Lt(this,Mr).dataUpdatedAt,o)+1;ur(this,Pn,setTimeout(()=>{Lt(this,Mr).isStale||this.updateResult()},rt))},Ts=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Lt(this,Cr)):this.options.refetchInterval)??!1},Is=function(o){fr(this,kr,Ns).call(this),ur(this,bn,o),!(isServer||resolveEnabled(this.options.enabled,Lt(this,Cr))===!1||!isValidTimeout(Lt(this,bn))||Lt(this,bn)===0)&&ur(this,jn,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&fr(this,kr,oo).call(this)},Lt(this,bn)))},Ps=function(){fr(this,kr,Rs).call(this),fr(this,kr,Is).call(this,fr(this,kr,Ts).call(this))},js=function(){Lt(this,Pn)&&(clearTimeout(Lt(this,Pn)),ur(this,Pn,void 0))},Ns=function(){Lt(this,jn)&&(clearInterval(Lt(this,jn)),ur(this,jn,void 0))},Ds=function(){const o=Lt(this,Br).getQueryCache().build(Lt(this,Br),this.options);if(o===Lt(this,Cr))return;const tt=Lt(this,Cr);ur(this,Cr,o),ur(this,ao,o.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),o.addObserver(this))},ru=function(o){notifyManager.batch(()=>{o.listeners&&this.listeners.forEach(tt=>{tt(Lt(this,Mr))}),Lt(this,Br).getQueryCache().notify({query:Lt(this,Cr),type:"observerResultsUpdated"})})},Ks);function shouldLoadOnMount(et,o){return resolveEnabled(o.enabled,et)!==!1&&et.state.data===void 0&&!(et.state.status==="error"&&o.retryOnMount===!1)}function shouldFetchOnMount(et,o){return shouldLoadOnMount(et,o)||et.state.data!==void 0&&shouldFetchOn(et,o,o.refetchOnMount)}function shouldFetchOn(et,o,tt){if(resolveEnabled(o.enabled,et)!==!1){const rt=typeof tt=="function"?tt(et):tt;return rt==="always"||rt!==!1&&isStale(et,o)}return!1}function shouldFetchOptionally(et,o,tt,rt){return(et!==o||resolveEnabled(rt.enabled,et)===!1)&&(!tt.suspense||et.state.status!=="error")&&isStale(et,tt)}function isStale(et,o){return resolveEnabled(o.enabled,et)!==!1&&et.isStaleByTime(resolveStaleTime(o.staleTime,et))}function shouldAssignObserverCurrentProperties(et,o){return!shallowEqualObjects(et.getCurrentResult(),o)}var xn,vn,Fr,sn,ln,Xo,Os,Qs,MutationObserver$1=(Qs=class extends Subscribable{constructor(tt,rt){super();hr(this,ln);hr(this,xn);hr(this,vn);hr(this,Fr);hr(this,sn);ur(this,xn,tt),this.setOptions(rt),this.bindMethods(),fr(this,ln,Xo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var nt;const rt=this.options;this.options=Lt(this,xn).defaultMutationOptions(tt),shallowEqualObjects(this.options,rt)||Lt(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Lt(this,Fr),observer:this}),rt!=null&&rt.mutationKey&&this.options.mutationKey&&hashKey(rt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((nt=Lt(this,Fr))==null?void 0:nt.state.status)==="pending"&&Lt(this,Fr).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Lt(this,Fr))==null||tt.removeObserver(this)}onMutationUpdate(tt){fr(this,ln,Xo).call(this),fr(this,ln,Os).call(this,tt)}getCurrentResult(){return Lt(this,vn)}reset(){var tt;(tt=Lt(this,Fr))==null||tt.removeObserver(this),ur(this,Fr,void 0),fr(this,ln,Xo).call(this),fr(this,ln,Os).call(this)}mutate(tt,rt){var nt;return ur(this,sn,rt),(nt=Lt(this,Fr))==null||nt.removeObserver(this),ur(this,Fr,Lt(this,xn).getMutationCache().build(Lt(this,xn),this.options)),Lt(this,Fr).addObserver(this),Lt(this,Fr).execute(tt)}},xn=new WeakMap,vn=new WeakMap,Fr=new WeakMap,sn=new WeakMap,ln=new WeakSet,Xo=function(){var rt;const tt=((rt=Lt(this,Fr))==null?void 0:rt.state)??getDefaultState();ur(this,vn,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(tt){notifyManager.batch(()=>{var rt,nt,ot,it,st,at,ct,lt;if(Lt(this,sn)&&this.hasListeners()){const dt=Lt(this,vn).variables,ht=Lt(this,vn).context;(tt==null?void 0:tt.type)==="success"?((nt=(rt=Lt(this,sn)).onSuccess)==null||nt.call(rt,tt.data,dt,ht),(it=(ot=Lt(this,sn)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Lt(this,sn)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Lt(this,sn)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Lt(this,vn))})})},Qs);function hashFn(et){return JSON.stringify(et,(o,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((rt,nt)=>(rt[nt]=tt[nt],rt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(et){if(!hasObjectPrototype(et))return!1;const o=et.constructor;if(typeof o>"u")return!0;const tt=o.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(et){return Object.prototype.toString.call(et)==="[object Object]"}function filterQueryOptions(et){const{_defaulted:o,behavior:tt,gcTime:rt,initialData:nt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:mt,retryDelay:ft,structuralSharing:pt,getPreviousPageParam:gt,getNextPageParam:yt,initialPageParam:bt,_optimisticResults:xt,enabled:vt,notifyOnChangeProps:Et,placeholderData:Ct,refetchInterval:St,refetchIntervalInBackground:At,refetchOnMount:kt,refetchOnReconnect:It,refetchOnWindowFocus:Ot,retryOnMount:Nt,select:Yt,staleTime:Ft,suspense:Ht,throwOnError:Qt,config:Vt,connector:Bt,query:Wt,...jt}=et;return jt}function connectMutationOptions(et){return{mutationFn(o){return connect$1(et,o)},mutationKey:["connect"]}}function disconnectMutationOptions(et){return{mutationFn(o){return disconnect(et,o)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{address:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("address is required");return await getBalance(et,{...ot,address:rt})??null},queryKey:getBalanceQueryKey(o)}}function getBalanceQueryKey(et={}){return["balance",filterQueryOptions(et)]}function getBlockNumberQueryOptions(et,o={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:rt,...nt}=tt[1];return await getBlockNumber(et,nt)??null},queryKey:getBlockNumberQueryKey(o)}}function getBlockNumberQueryKey(et={}){return["blockNumber",filterQueryOptions(et)]}function getEnsAddressQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{name:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("name is required");return getEnsAddress(et,{...ot,name:rt})},queryKey:getEnsAddressQueryKey(o)}}function getEnsAddressQueryKey(et={}){return["ensAddress",filterQueryOptions(et)]}function getEnsAvatarQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{name:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("name is required");return getEnsAvatar(et,{...ot,name:rt})},queryKey:getEnsAvatarQueryKey(o)}}function getEnsAvatarQueryKey(et={}){return["ensAvatar",filterQueryOptions(et)]}function getEnsNameQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{address:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("address is required");return getEnsName(et,{...ot,address:rt})},queryKey:getEnsNameQueryKey(o)}}function getEnsNameQueryKey(et={}){return["ensName",filterQueryOptions(et)]}function signMessageMutationOptions(et){return{mutationFn(o){return signMessage(et,o)},mutationKey:["signMessage"]}}function switchChainMutationOptions(et){return{mutationFn(o){return switchChain(et,o)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=et=>{const o=reactExports.useContext(QueryClientContext);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},QueryClientProvider=({client:et,children:o})=>(reactExports.useEffect(()=>(et.mount(),()=>{et.unmount()}),[et]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:et,children:o})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let et=!1;return{clearReset:()=>{et=!1},reset:()=>{et=!0},isReset:()=>et}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(et,o){return typeof et=="function"?et(...o):!!et}function noop$3(){}var ensurePreventErrorBoundaryRetry=(et,o)=>{(et.suspense||et.throwOnError)&&(o.isReset()||(et.retryOnMount=!1))},useClearResetErrorBoundary=et=>{reactExports.useEffect(()=>{et.clearReset()},[et])},getHasError=({result:et,errorResetBoundary:o,throwOnError:tt,query:rt})=>et.isError&&!o.isReset()&&!et.isFetching&&rt&&shouldThrowError(tt,[et.error,rt]),ensureSuspenseTimers=et=>{et.suspense&&(et.staleTime===void 0&&(et.staleTime=1e3),typeof et.gcTime=="number"&&(et.gcTime=Math.max(et.gcTime,1e3)))},willFetch=(et,o)=>et.isLoading&&et.isFetching&&!o,shouldSuspend=(et,o)=>(et==null?void 0:et.suspense)&&o.isPending,fetchOptimistic=(et,o,tt)=>o.fetchOptimistic(et).catch(()=>{tt.clearReset()});function useBaseQuery(et,o,tt){var lt,dt,ht,mt,ft;const rt=useQueryClient(),nt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=rt.defaultQueryOptions(et);(dt=(lt=rt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=nt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!rt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new o(rt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(pt=>{const gt=nt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),gt},[at,nt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:rt.getQueryCache().get(it.queryHash)}))throw ct.error;if((mt=(ht=rt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||mt.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,nt)){const pt=st?fetchOptimistic(it,at,ot):(ft=rt.getQueryCache().get(it.queryHash))==null?void 0:ft.promise;pt==null||pt.catch(noop$3).finally(()=>{at.hasListeners()||at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(et,o){return useBaseQuery(et,QueryObserver)}function useMutation(et,o){const tt=useQueryClient(),[rt]=reactExports.useState(()=>new MutationObserver$1(tt,et));reactExports.useEffect(()=>{rt.setOptions(et)},[rt,et]);const nt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>rt.subscribe(notifyManager.batchCalls(it)),[rt]),()=>rt.getCurrentResult(),()=>rt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{rt.mutate(it,st).catch(noop$3)},[rt]);if(nt.error&&shouldThrowError(rt.options.throwOnError,[nt.error]))throw nt.error;return{...nt,mutate:ot,mutateAsync:nt.mutate}}function useQuery(et){const o=useQuery$1({...et,queryKeyHashFn:hashFn});return o.queryKey=et.queryKey,o}function useChainId(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchChainId(o,{onChange:tt}),()=>getChainId(o),()=>getChainId(o))}function useBalance(et={}){const{address:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getBalanceQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(et={}){const{enabled:o=!0,onBlockNumber:tt,config:rt,...nt}=et,ot=useConfig(et),it=useChainId({config:ot}),st=et.chainId??it;reactExports.useEffect(()=>{if(o&&tt)return watchBlockNumber(ot,{...nt,chainId:st,onBlockNumber:tt})},[st,ot,o,tt,nt.onError,nt.emitMissed,nt.emitOnBegin,nt.poll,nt.pollingInterval,nt.syncConnectedChain])}function useBlockNumber(et={}){const{query:o={},watch:tt}=et,rt=useConfig(et),nt=useQueryClient(),ot=useChainId({config:rt}),it=et.chainId??ot,st=getBlockNumberQueryOptions(rt,{...et,chainId:it});return useWatchBlockNumber({config:et.config,chainId:et.chainId,...typeof tt=="object"?tt:{},enabled:!!((o.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){nt.setQueryData(st.queryKey,at)}}),useQuery({...o,...st})}function useChains$1(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchChains(o,{onChange:tt}),()=>getChains(o),()=>getChains(o))}function useConnectors$1(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchConnectors(o,{onChange:tt}),()=>getConnectors(o),()=>getConnectors(o))}function useConnect$1(et={}){const{mutation:o}=et,tt=useConfig(et),rt=connectMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:nt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchConnections(o,{onChange:tt}),()=>getConnections(o),()=>getConnections(o))}function useDisconnect(et={}){const{mutation:o}=et,tt=useConfig(et),rt=disconnectMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:nt,disconnectAsync:ot}}function useEnsAddress(et={}){const{name:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsAddressQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(et={}){const{name:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsAvatarQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(et={}){const{address:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsNameQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(et={}){const{mutation:o}=et,tt=useConfig(et),rt=signMessageMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,signMessage:nt,signMessageAsync:ot}}function useSwitchChain(et={}){const{mutation:o}=et,tt=useConfig(et),rt=switchChainMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,chains:useChains$1({config:tt}),switchChain:nt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(et){var tt;return{transactions:(tt=et.transactions)==null?void 0:tt.map(rt=>{if(typeof rt=="string")return rt;const nt=formatTransaction(rt);return nt.typeHex==="0x7e"&&(nt.isSystemTx=rt.isSystemTx,nt.mint=rt.mint?hexToBigInt(rt.mint):void 0,nt.sourceHash=rt.sourceHash,nt.type="deposit"),nt}),stateRoot:et.stateRoot}}}),transaction:defineTransaction({format(et){const o={};return et.type==="0x7e"&&(o.isSystemTx=et.isSystemTx,o.mint=et.mint?hexToBigInt(et.mint):void 0,o.sourceHash=et.sourceHash,o.type="deposit"),o}}),transactionReceipt:defineTransactionReceipt({format(et){return{l1GasPrice:et.l1GasPrice?hexToBigInt(et.l1GasPrice):null,l1GasUsed:et.l1GasUsed?hexToBigInt(et.l1GasUsed):null,l1Fee:et.l1Fee?hexToBigInt(et.l1Fee):null,l1FeeScalar:et.l1FeeScalar?Number(et.l1FeeScalar):null}}})};function serializeTransaction(et,o){return isDeposit(et)?serializeTransactionDeposit(et):serializeTransaction$1(et,o)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(et){assertTransactionDeposit(et);const{sourceHash:o,data:tt,from:rt,gas:nt,isSystemTx:ot,mint:it,to:st,value:at}=et,ct=[o,rt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(et){return et.type==="deposit"||typeof et.sourceHash<"u"}function assertTransactionDeposit(et){const{from:o,to:tt}=et;if(o&&!isAddress(o))throw new InvalidAddressError({address:o});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({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}}}),sourceId=1,optimism=defineChain({...chainConfig,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:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(et={}){return et.version==="3"||et.headlessMode?version3(et):version4(et)}function version4(et){let o,tt,rt,nt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));rt||(rt=this.onAccountsChanged.bind(this),at.on("accountsChanged",rt)),nt||(nt=this.onChainChanged.bind(this),at.on("chainChanged",nt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();rt&&(st.removeListener("accountsChanged",rt),rt=void 0),nt&&(st.removeListener("chainChanged",nt),nt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const{default:at}=await __vitePreload(async()=>{const{default:ct}=await import("./index-D2uqR4Ry.js").then(lt=>lt.i);return{default:ct}},__vite__mapDeps([0,1,2,3]));return typeof at!="function"&&typeof at.default=="function"?at.default:at})();o=new st({...et,appChainIds:it.chains.map(at=>at.id)}),tt=o.makeWeb3Provider({...et,options:et.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,mt,ft;const ct=it.chains.find(pt=>pt.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(pt){if(pt.code===4902)try{let gt;st!=null&&st.blockExplorerUrls?gt=st.blockExplorerUrls:gt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let yt;(mt=st==null?void 0:st.rpcUrls)!=null&&mt.length?yt=st.rpcUrls:yt=[((ft=ct.rpcUrls.default)==null?void 0:ft.http[0])??""];const bt={blockExplorerUrls:gt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:yt};return await lt.request({method:"wallet_addEthereumChain",params:[bt]}),ct}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(pt)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),nt&&(at.removeListener("chainChanged",nt),nt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(et){let tt,rt,nt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));nt||(nt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(mt=>{if(mt.code===UserRejectedRequestError.code)throw mt;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!rt){const ct=await(async()=>{const{default:ft}=await __vitePreload(async()=>{const{default:pt}=await import("./index-FH8NN1-S.js").then(gt=>gt.i);return{default:pt}},__vite__mapDeps([4,3,1,2]));return typeof ft!="function"&&typeof ft.default=="function"?ft.default:ft})();tt=new ct({...et,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(ft=>et.chainId?ft.id===et.chainId:ft.id===lt)||st.chains[0],ht=et.chainId||(dt==null?void 0:dt.id),mt=et.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);rt=tt.makeWeb3Provider(mt,ht)}return rt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,mt,ft,pt;const lt=st.chains.find(gt=>gt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(gt){if(gt.code===4902)try{let yt;at!=null&&at.blockExplorerUrls?yt=at.blockExplorerUrls:yt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(mt=lt.blockExplorers)==null?void 0:mt.default.url]:[];let bt;(ft=at==null?void 0:at.rpcUrls)!=null&&ft.length?bt=at.rpcUrls:bt=[((pt=lt.rpcUrls.default)==null?void 0:pt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:bt};return await dt.request({method:"wallet_addEthereumChain",params:[xt]}),lt}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(gt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();nt&&(ct.removeListener("accountsChanged",nt),nt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(et={}){const{shimDisconnect:o=!1}=et;let tt,rt;return nt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return rt||(rt=this.onDisconnect.bind(this),ot.on("disconnect",rt)),o&&await((at=nt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;rt&&(ot.removeListener("disconnect",rt),rt=void 0),o&&await((it=nt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-Rg7xls9w.js");return{default:lt}},[]),st=new it(et),at=await withTimeout(()=>st.safe.getInfo(),{timeout:et.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const{SafeAppProvider:ct}=await __vitePreload(async()=>{const{SafeAppProvider:lt}=await import("./index-Dz_NkDRB.js").then(dt=>dt.i);return{SafeAppProvider:lt}},__vite__mapDeps([5,2]));tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return o&&await((ot=nt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){nt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(et){const o=et.isNewChainsStale??!0;let tt,rt;const nt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...mt}={}){var ft,pt;try{const gt=await this.getProvider();if(!gt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,gt.on("display_uri",at));let yt=ht;if(!yt){const Et=await((ft=dt.storage)==null?void 0:ft.getItem("state"))??{};dt.chains.some(St=>St.id===Et.chainId)?yt=Et.chainId:yt=(pt=dt.chains[0])==null?void 0:pt.id}if(!yt)throw new Error("No chains found on connector.");const bt=await this.isChainsStale();if(gt.session&&bt&&await gt.disconnect(),!gt.session||bt){const Et=dt.chains.filter(Ct=>Ct.id!==yt).map(Ct=>Ct.id);await gt.connect({optionalChains:[yt,...Et],..."pairingTopic"in mt?{pairingTopic:mt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(Ct=>Ct.id))}const xt=(await gt.enable()).map(Et=>getAddress(Et)),vt=await this.getChainId();return at&&(gt.removeListener("display_uri",at),at=void 0),st&&(gt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),gt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),gt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),gt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),gt.on("session_delete",ct)),{accounts:xt,chainId:vt}}catch(gt){throw/(user rejected|connection request reset)/i.test(gt==null?void 0:gt.message)?new UserRejectedRequestError(gt):gt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(mt){if(!/No matching key/i.test(mt.message))throw mt}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(mt=>getAddress(mt))},async getProvider({chainId:ht}={}){var ft;async function mt(){const pt=dt.chains.map(yt=>yt.id);if(!pt.length)return;const{EthereumProvider:gt}=await __vitePreload(async()=>{const{EthereumProvider:yt}=await import("./index.es-KLKTVizS.js");return{EthereumProvider:yt}},__vite__mapDeps([6,2,3]));return await gt.init({...et,disableProviderPing:!0,optionalChains:pt,projectId:et.projectId,rpcMap:Object.fromEntries(dt.chains.map(yt=>{const[bt]=extractRpcUrls({chain:yt,transports:dt.transports});return[yt.id,bt]})),showQrModal:et.showQrModal??!0})}return tt||(rt||(rt=mt()),tt=await rt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((ft=this.switchChain)==null?void 0:ft.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,mt]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&mt.session?(await mt.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:mt}){var gt,yt,bt;const ft=await this.getProvider();if(!ft)throw new ProviderNotFoundError;const pt=dt.chains.find(xt=>xt.id===mt);if(!pt)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(vt=>{const Et=({chainId:Ct})=>{Ct===mt&&(dt.emitter.off("change",Et),vt())};dt.emitter.on("change",Et)}),ft.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(mt)}]})]);const xt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...xt,mt]),pt}catch(xt){const vt=xt;if(/(user rejected)/i.test(vt.message))throw new UserRejectedRequestError(vt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(gt=pt.blockExplorers)!=null&>.default.url?[(yt=pt.blockExplorers)==null?void 0:yt.default.url]:[];let Ct;(bt=ht==null?void 0:ht.rpcUrls)!=null&&bt.length?Ct=ht.rpcUrls:Ct=[...pt.rpcUrls.default.http];const St={blockExplorerUrls:Et,chainId:numberToHex(mt),chainName:(ht==null?void 0:ht.chainName)??pt.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??pt.nativeCurrency,rpcUrls:Ct};await ft.request({method:"wallet_addEthereumChain",params:[St]});const At=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...At,mt]),pt}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(mt=>getAddress(mt))})},onChainChanged(ht){const mt=Number(ht);dt.emitter.emit("change",{chainId:mt})},async onConnect(ht){const mt=Number(ht.chainId),ft=await this.getAccounts();dt.emitter.emit("connect",{accounts:ft,chainId:mt})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const mt=await this.getProvider();ot&&(mt.removeListener("accountsChanged",ot),ot=void 0),it&&(mt.removeListener("chainChanged",it),it=void 0),lt&&(mt.removeListener("disconnect",lt),lt=void 0),ct&&(mt.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),mt.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var mt,ft,pt;return tt?((pt=(ft=(mt=tt.session)==null?void 0:mt.namespaces[nt])==null?void 0:ft.accounts)==null?void 0:pt.map(gt=>Number.parseInt(gt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!o)return!1;const ht=dt.chains.map(pt=>pt.id),mt=this.getNamespaceChainsIds();if(mt.length&&!mt.some(pt=>ht.includes(pt)))return!1;const ft=await this.getRequestedChainsIds();return!ht.every(pt=>ft.includes(pt))},async setRequestedChainsIds(ht){var mt;await((mt=dt.storage)==null?void 0:mt.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var __spreadArray$1=function(et,o,tt){if(tt||arguments.length===2)for(var rt=0,nt=o.length,ot;rt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(et){return et!==""&&userAgentRules.reduce(function(o,tt){var rt=tt[0],nt=tt[1];if(o)return o;var ot=nt.exec(et);return!!ot&&[rt,ot]},!1)}function parseUserAgent(et){var o=matchUserAgent(et);if(!o)return null;var tt=o[0],rt=o[1];if(tt==="searchbot")return new BotInfo;var nt=rt[1]&&rt[1].split(".").join("_").split("_").slice(0,3);nt?nt.length0)throw new Error("Invalid string. Length must be a multiple of 4");var tt=et.indexOf("=");tt===-1&&(tt=o);var rt=tt===o?0:4-tt%4;return[tt,rt]}function byteLength(et){var o=getLens(et),tt=o[0],rt=o[1];return(tt+rt)*3/4-rt}function _byteLength(et,o,tt){return(o+tt)*3/4-tt}function toByteArray(et){var o,tt=getLens(et),rt=tt[0],nt=tt[1],ot=new Arr(_byteLength(et,rt,nt)),it=0,st=nt>0?rt-4:rt,at;for(at=0;at>16&255,ot[it++]=o>>8&255,ot[it++]=o&255;return nt===2&&(o=revLookup[et.charCodeAt(at)]<<2|revLookup[et.charCodeAt(at+1)]>>4,ot[it++]=o&255),nt===1&&(o=revLookup[et.charCodeAt(at)]<<10|revLookup[et.charCodeAt(at+1)]<<4|revLookup[et.charCodeAt(at+2)]>>2,ot[it++]=o>>8&255,ot[it++]=o&255),ot}function tripletToBase64(et){return lookup[et>>18&63]+lookup[et>>12&63]+lookup[et>>6&63]+lookup[et&63]}function encodeChunk(et,o,tt){for(var rt,nt=[],ot=o;otst?st:it+ot));return rt===1?(o=et[tt-1],nt.push(lookup[o>>2]+lookup[o<<4&63]+"==")):rt===2&&(o=(et[tt-2]<<8)+et[tt-1],nt.push(lookup[o>>10]+lookup[o>>4&63]+lookup[o<<2&63]+"=")),nt.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(et,o,tt,rt,nt){var ot,it,st=nt*8-rt-1,at=(1<>1,lt=-7,dt=tt?nt-1:0,ht=tt?-1:1,mt=et[o+dt];for(dt+=ht,ot=mt&(1<<-lt)-1,mt>>=-lt,lt+=st;lt>0;ot=ot*256+et[o+dt],dt+=ht,lt-=8);for(it=ot&(1<<-lt)-1,ot>>=-lt,lt+=rt;lt>0;it=it*256+et[o+dt],dt+=ht,lt-=8);if(ot===0)ot=1-ct;else{if(ot===at)return it?NaN:(mt?-1:1)*(1/0);it=it+Math.pow(2,rt),ot=ot-ct}return(mt?-1:1)*it*Math.pow(2,ot-rt)};ieee754.write=function(et,o,tt,rt,nt,ot){var it,st,at,ct=ot*8-nt-1,lt=(1<>1,ht=nt===23?Math.pow(2,-24)-Math.pow(2,-77):0,mt=rt?0:ot-1,ft=rt?1:-1,pt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(st=isNaN(o)?1:0,it=lt):(it=Math.floor(Math.log(o)/Math.LN2),o*(at=Math.pow(2,-it))<1&&(it--,at*=2),it+dt>=1?o+=ht/at:o+=ht*Math.pow(2,1-dt),o*at>=2&&(it++,at/=2),it+dt>=lt?(st=0,it=lt):it+dt>=1?(st=(o*at-1)*Math.pow(2,nt),it=it+dt):(st=o*Math.pow(2,dt-1)*Math.pow(2,nt),it=0));nt>=8;et[tt+mt]=st&255,mt+=ft,st/=256,nt-=8);for(it=it<0;et[tt+mt]=it&255,mt+=ft,it/=256,ct-=8);et[tt+mt-ft]|=pt*128};/*! + */var h$3=reactExports,n$2=shimExports;function p$2(et,o){return et===o&&(et!==0||1/et===1/o)||et!==et&&o!==o}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(et,o,tt,rt,nt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(mt){if(!ct){if(ct=!0,lt=mt,mt=rt(mt),nt!==void 0&&it.hasValue){var ft=it.value;if(nt(ft,mt))return dt=ft}return dt=mt}if(ft=dt,q$3(lt,mt))return ft;var pt=rt(mt);return nt!==void 0&&nt(ft,pt)?ft:(lt=mt,dt=pt)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(o())},ht===null?void 0:function(){return at(ht())}]},[o,tt,rt,nt]);var st=r$3(et,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=et=>typeof et=="object"&&!Array.isArray(et);function useSyncExternalStoreWithTracked(et,o,tt=o,rt=deepEqual){const nt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(et,o,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&nt.current.length){for(const at of nt.current)if(!rt(it[at],st[at]))return!1;return!0}return rt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(nt.current.includes(at)||nt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(et={}){const o=useConfig(et);return useSyncExternalStoreWithTracked(tt=>watchAccount(o,{onChange:tt}),()=>getAccount(o))}function useAccountEffect(et={}){const{onConnect:o,onDisconnect:tt}=et,rt=useConfig(et);reactExports.useEffect(()=>watchAccount(rt,{onChange(nt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&nt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=nt,dt=ot.status==="reconnecting"||ot.status===void 0;o==null||o({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&nt.status==="disconnected"&&(tt==null||tt())}}),[rt,o,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(et){return this.listeners.add(et),this.onSubscribe(),()=>{this.listeners.delete(et),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(et,o){return typeof et=="function"?et(o):et}function isValidTimeout(et){return typeof et=="number"&&et>=0&&et!==1/0}function timeUntilStale(et,o){return Math.max(et+(o||0)-Date.now(),0)}function resolveStaleTime(et,o){return typeof et=="function"?et(o):et}function resolveEnabled(et,o){return typeof et=="function"?et(o):et}function matchQuery(et,o){const{type:tt="all",exact:rt,fetchStatus:nt,predicate:ot,queryKey:it,stale:st}=et;if(it){if(rt){if(o.queryHash!==hashQueryKeyByOptions(it,o.options))return!1}else if(!partialMatchKey(o.queryKey,it))return!1}if(tt!=="all"){const at=o.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&o.isStale()!==st||nt&&nt!==o.state.fetchStatus||ot&&!ot(o))}function matchMutation(et,o){const{exact:tt,status:rt,predicate:nt,mutationKey:ot}=et;if(ot){if(!o.options.mutationKey)return!1;if(tt){if(hashKey(o.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(o.options.mutationKey,ot))return!1}return!(rt&&o.state.status!==rt||nt&&!nt(o))}function hashQueryKeyByOptions(et,o){return((o==null?void 0:o.queryKeyHashFn)||hashKey)(et)}function hashKey(et){return JSON.stringify(et,(o,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((rt,nt)=>(rt[nt]=tt[nt],rt),{}):tt)}function partialMatchKey(et,o){return et===o?!0:typeof et!=typeof o?!1:et&&o&&typeof et=="object"&&typeof o=="object"?!Object.keys(o).some(tt=>!partialMatchKey(et[tt],o[tt])):!1}function replaceEqualDeep(et,o){if(et===o)return et;const tt=isPlainArray(et)&&isPlainArray(o);if(tt||isPlainObject$3(et)&&isPlainObject$3(o)){const rt=tt?et:Object.keys(et),nt=rt.length,ot=tt?o:Object.keys(o),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(o,et)})}function replaceData(et,o,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(et,o):tt.structuralSharing!==!1?replaceEqualDeep(et,o):o}function addToEnd(et,o,tt=0){const rt=[...et,o];return tt&&rt.length>tt?rt.slice(1):rt}function addToStart(et,o,tt=0){const rt=[o,...et];return tt&&rt.length>tt?rt.slice(0,-1):rt}var skipToken=Symbol();function ensureQueryFn(et,o){return!et.queryFn&&(o!=null&&o.initialPromise)?()=>o.initialPromise:!et.queryFn||et.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${et.queryHash}'`)):et.queryFn}var kn,hn,Mn,Us,FocusManager=(Us=class extends Subscribable{constructor(){super();hr(this,kn);hr(this,hn);hr(this,Mn);ur(this,Mn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Lt(this,hn)||this.setEventListener(Lt(this,Mn))}onUnsubscribe(){var o;this.hasListeners()||((o=Lt(this,hn))==null||o.call(this),ur(this,hn,void 0))}setEventListener(o){var tt;ur(this,Mn,o),(tt=Lt(this,hn))==null||tt.call(this),ur(this,hn,o(rt=>{typeof rt=="boolean"?this.setFocused(rt):this.onFocus()}))}setFocused(o){Lt(this,kn)!==o&&(ur(this,kn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(tt=>{tt(o)})}isFocused(){var o;return typeof Lt(this,kn)=="boolean"?Lt(this,kn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},kn=new WeakMap,hn=new WeakMap,Mn=new WeakMap,Us),focusManager=new FocusManager,Bn,fn,Fn,zs,OnlineManager=(zs=class extends Subscribable{constructor(){super();hr(this,Bn,!0);hr(this,fn);hr(this,Fn);ur(this,Fn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o(!0),rt=()=>o(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",rt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",rt)}}})}onSubscribe(){Lt(this,fn)||this.setEventListener(Lt(this,Fn))}onUnsubscribe(){var o;this.hasListeners()||((o=Lt(this,fn))==null||o.call(this),ur(this,fn,void 0))}setEventListener(o){var tt;ur(this,Fn,o),(tt=Lt(this,fn))==null||tt.call(this),ur(this,fn,o(this.setOnline.bind(this)))}setOnline(o){Lt(this,Bn)!==o&&(ur(this,Bn,o),this.listeners.forEach(rt=>{rt(o)}))}isOnline(){return Lt(this,Bn)}},Bn=new WeakMap,fn=new WeakMap,Fn=new WeakMap,zs),onlineManager=new OnlineManager;function pendingThenable(){let et,o;const tt=new Promise((nt,ot)=>{et=nt,o=ot});tt.status="pending",tt.catch(()=>{});function rt(nt){Object.assign(tt,nt),delete tt.resolve,delete tt.reject}return tt.resolve=nt=>{rt({status:"fulfilled",value:nt}),et(nt)},tt.reject=nt=>{rt({status:"rejected",reason:nt}),o(nt)},tt}function defaultRetryDelay(et){return Math.min(1e3*2**et,3e4)}function canFetch(et){return(et??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(et){super("CancelledError"),this.revert=et==null?void 0:et.revert,this.silent=et==null?void 0:et.silent}};function isCancelledError(et){return et instanceof CancelledError}function createRetryer(et){let o=!1,tt=0,rt=!1,nt;const ot=pendingThenable(),it=pt=>{var gt;rt||(ht(new CancelledError(pt)),(gt=et.abort)==null||gt.call(et))},st=()=>{o=!0},at=()=>{o=!1},ct=()=>focusManager.isFocused()&&(et.networkMode==="always"||onlineManager.isOnline())&&et.canRun(),lt=()=>canFetch(et.networkMode)&&et.canRun(),dt=pt=>{var gt;rt||(rt=!0,(gt=et.onSuccess)==null||gt.call(et,pt),nt==null||nt(),ot.resolve(pt))},ht=pt=>{var gt;rt||(rt=!0,(gt=et.onError)==null||gt.call(et,pt),nt==null||nt(),ot.reject(pt))},mt=()=>new Promise(pt=>{var gt;nt=yt=>{(rt||ct())&&pt(yt)},(gt=et.onPause)==null||gt.call(et)}).then(()=>{var pt;nt=void 0,rt||(pt=et.onContinue)==null||pt.call(et)}),ft=()=>{if(rt)return;let pt;const gt=tt===0?et.initialPromise:void 0;try{pt=gt??et.fn()}catch(yt){pt=Promise.reject(yt)}Promise.resolve(pt).then(dt).catch(yt=>{var Ct;if(rt)return;const bt=et.retry??(isServer?0:3),xt=et.retryDelay??defaultRetryDelay,vt=typeof xt=="function"?xt(tt,yt):xt,Et=bt===!0||typeof bt=="number"&&ttct()?void 0:mt()).then(()=>{o?ht(yt):ft()})})};return{promise:ot,cancel:it,continue:()=>(nt==null||nt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?ft():mt().then(ft),ot)}}function createNotifyManager(){let et=[],o=0,tt=st=>{st()},rt=st=>{st()},nt=st=>setTimeout(st,0);const ot=st=>{o?et.push(st):nt(()=>{tt(st)})},it=()=>{const st=et;et=[],st.length&&nt(()=>{rt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;o++;try{at=st()}finally{o--,o||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{rt=st},setScheduler:st=>{nt=st}}}var notifyManager=createNotifyManager(),_n,Vs,Removable=(Vs=class{constructor(){hr(this,_n)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&ur(this,_n,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(et){this.gcTime=Math.max(this.gcTime||0,et??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Lt(this,_n)&&(clearTimeout(Lt(this,_n)),ur(this,_n,void 0))}},_n=new WeakMap,Vs),Un,zn,Vr,Or,io,Rn,Gr,nn,Hs,Query=(Hs=class extends Removable{constructor(o){super();hr(this,Gr);hr(this,Un);hr(this,zn);hr(this,Vr);hr(this,Or);hr(this,io);hr(this,Rn);ur(this,Rn,!1),ur(this,io,o.defaultOptions),this.setOptions(o.options),this.observers=[],ur(this,Vr,o.cache),this.queryKey=o.queryKey,this.queryHash=o.queryHash,ur(this,Un,getDefaultState$1(this.options)),this.state=o.state??Lt(this,Un),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var o;return(o=Lt(this,Or))==null?void 0:o.promise}setOptions(o){this.options={...Lt(this,io),...o},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Lt(this,Vr).remove(this)}setData(o,tt){const rt=replaceData(this.state.data,o,this.options);return fr(this,Gr,nn).call(this,{data:rt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),rt}setState(o,tt){fr(this,Gr,nn).call(this,{type:"setState",state:o,setStateOptions:tt})}cancel(o){var rt,nt;const tt=(rt=Lt(this,Or))==null?void 0:rt.promise;return(nt=Lt(this,Or))==null||nt.cancel(o),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Lt(this,Un))}isActive(){return this.observers.some(o=>resolveEnabled(o.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(o=>o.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(o=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,o)}onFocus(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnWindowFocus());o==null||o.refetch({cancelRefetch:!1}),(tt=Lt(this,Or))==null||tt.continue()}onOnline(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(tt=Lt(this,Or))==null||tt.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),Lt(this,Vr).notify({type:"observerAdded",query:this,observer:o}))}removeObserver(o){this.observers.includes(o)&&(this.observers=this.observers.filter(tt=>tt!==o),this.observers.length||(Lt(this,Or)&&(Lt(this,Rn)?Lt(this,Or).cancel({revert:!0}):Lt(this,Or).cancelRetry()),this.scheduleGc()),Lt(this,Vr).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,Gr,nn).call(this,{type:"invalidate"})}fetch(o,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(Lt(this,Or))return Lt(this,Or).continueRetry(),Lt(this,Or).promise}if(o&&this.setOptions(o),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const rt=new AbortController,nt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(ur(this,Rn,!0),rt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return nt(ht),ur(this,Rn,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};nt(it),(at=this.options.behavior)==null||at.onFetch(it,this),ur(this,zn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&fr(this,Gr,nn).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,mt,ft,pt;isCancelledError(dt)&&dt.silent||fr(this,Gr,nn).call(this,{type:"error",error:dt}),isCancelledError(dt)||((mt=(ht=Lt(this,Vr).config).onError)==null||mt.call(ht,dt,this),(pt=(ft=Lt(this,Vr).config).onSettled)==null||pt.call(ft,this.state.data,dt,this)),this.scheduleGc()};return ur(this,Or,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:rt.abort.bind(rt),onSuccess:dt=>{var ht,mt,ft,pt;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(gt){st(gt);return}(mt=(ht=Lt(this,Vr).config).onSuccess)==null||mt.call(ht,dt,this),(pt=(ft=Lt(this,Vr).config).onSettled)==null||pt.call(ft,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{fr(this,Gr,nn).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{fr(this,Gr,nn).call(this,{type:"pause"})},onContinue:()=>{fr(this,Gr,nn).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Lt(this,Or).start()}},Un=new WeakMap,zn=new WeakMap,Vr=new WeakMap,Or=new WeakMap,io=new WeakMap,Rn=new WeakMap,Gr=new WeakSet,nn=function(o){const tt=rt=>{switch(o.type){case"failed":return{...rt,fetchFailureCount:o.failureCount,fetchFailureReason:o.error};case"pause":return{...rt,fetchStatus:"paused"};case"continue":return{...rt,fetchStatus:"fetching"};case"fetch":return{...rt,...fetchState(rt.data,this.options),fetchMeta:o.meta??null};case"success":return{...rt,data:o.data,dataUpdateCount:rt.dataUpdateCount+1,dataUpdatedAt:o.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!o.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const nt=o.error;return isCancelledError(nt)&&nt.revert&&Lt(this,zn)?{...Lt(this,zn),fetchStatus:"idle"}:{...rt,error:nt,errorUpdateCount:rt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:rt.fetchFailureCount+1,fetchFailureReason:nt,fetchStatus:"idle",status:"error"};case"invalidate":return{...rt,isInvalidated:!0};case"setState":return{...rt,...o.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(rt=>{rt.onQueryUpdate()}),Lt(this,Vr).notify({query:this,type:"updated",action:o})})},Hs);function fetchState(et,o){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(o.networkMode)?"fetching":"paused",...et===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(et){const o=typeof et.initialData=="function"?et.initialData():et.initialData,tt=o!==void 0,rt=tt?typeof et.initialDataUpdatedAt=="function"?et.initialDataUpdatedAt():et.initialDataUpdatedAt:0;return{data:o,dataUpdateCount:0,dataUpdatedAt:tt?rt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Zr,Ws,QueryCache=(Ws=class extends Subscribable{constructor(o={}){super();hr(this,Zr);this.config=o,ur(this,Zr,new Map)}build(o,tt,rt){const nt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(nt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:nt,queryHash:ot,options:o.defaultQueryOptions(tt),state:rt,defaultOptions:o.getQueryDefaults(nt)}),this.add(it)),it}add(o){Lt(this,Zr).has(o.queryHash)||(Lt(this,Zr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const tt=Lt(this,Zr).get(o.queryHash);tt&&(o.destroy(),tt===o&&Lt(this,Zr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return Lt(this,Zr).get(o)}getAll(){return[...Lt(this,Zr).values()]}find(o){const tt={exact:!0,...o};return this.getAll().find(rt=>matchQuery(tt,rt))}findAll(o={}){const tt=this.getAll();return Object.keys(o).length>0?tt.filter(rt=>matchQuery(o,rt)):tt}notify(o){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(o)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(o=>{o.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(o=>{o.onOnline()})})}},Zr=new WeakMap,Ws),qr,Lr,Tn,Kr,un,Gs,Mutation=(Gs=class extends Removable{constructor(o){super();hr(this,Kr);hr(this,qr);hr(this,Lr);hr(this,Tn);this.mutationId=o.mutationId,ur(this,Lr,o.mutationCache),ur(this,qr,[]),this.state=o.state||getDefaultState(),this.setOptions(o.options),this.scheduleGc()}setOptions(o){this.options=o,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(o){Lt(this,qr).includes(o)||(Lt(this,qr).push(o),this.clearGcTimeout(),Lt(this,Lr).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){ur(this,qr,Lt(this,qr).filter(tt=>tt!==o)),this.scheduleGc(),Lt(this,Lr).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){Lt(this,qr).length||(this.state.status==="pending"?this.scheduleGc():Lt(this,Lr).remove(this))}continue(){var o;return((o=Lt(this,Tn))==null?void 0:o.continue())??this.execute(this.state.variables)}async execute(o){var nt,ot,it,st,at,ct,lt,dt,ht,mt,ft,pt,gt,yt,bt,xt,vt,Et,Ct,St;ur(this,Tn,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(o):Promise.reject(new Error("No mutationFn found")),onFail:(At,kt)=>{fr(this,Kr,un).call(this,{type:"failed",failureCount:At,error:kt})},onPause:()=>{fr(this,Kr,un).call(this,{type:"pause"})},onContinue:()=>{fr(this,Kr,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Lt(this,Lr).canRun(this)}));const tt=this.state.status==="pending",rt=!Lt(this,Tn).canStart();try{if(!tt){fr(this,Kr,un).call(this,{type:"pending",variables:o,isPaused:rt}),await((ot=(nt=Lt(this,Lr).config).onMutate)==null?void 0:ot.call(nt,o,this));const kt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,o));kt!==this.state.context&&fr(this,Kr,un).call(this,{type:"pending",context:kt,variables:o,isPaused:rt})}const At=await Lt(this,Tn).start();return await((ct=(at=Lt(this,Lr).config).onSuccess)==null?void 0:ct.call(at,At,o,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,At,o,this.state.context)),await((mt=(ht=Lt(this,Lr).config).onSettled)==null?void 0:mt.call(ht,At,null,this.state.variables,this.state.context,this)),await((pt=(ft=this.options).onSettled)==null?void 0:pt.call(ft,At,null,o,this.state.context)),fr(this,Kr,un).call(this,{type:"success",data:At}),At}catch(At){try{throw await((yt=(gt=Lt(this,Lr).config).onError)==null?void 0:yt.call(gt,At,o,this.state.context,this)),await((xt=(bt=this.options).onError)==null?void 0:xt.call(bt,At,o,this.state.context)),await((Et=(vt=Lt(this,Lr).config).onSettled)==null?void 0:Et.call(vt,void 0,At,this.state.variables,this.state.context,this)),await((St=(Ct=this.options).onSettled)==null?void 0:St.call(Ct,void 0,At,o,this.state.context)),At}finally{fr(this,Kr,un).call(this,{type:"error",error:At})}}finally{Lt(this,Lr).runNext(this)}}},qr=new WeakMap,Lr=new WeakMap,Tn=new WeakMap,Kr=new WeakSet,un=function(o){const tt=rt=>{switch(o.type){case"failed":return{...rt,failureCount:o.failureCount,failureReason:o.error};case"pause":return{...rt,isPaused:!0};case"continue":return{...rt,isPaused:!1};case"pending":return{...rt,context:o.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:o.isPaused,status:"pending",variables:o.variables,submittedAt:Date.now()};case"success":return{...rt,data:o.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...rt,data:void 0,error:o.error,failureCount:rt.failureCount+1,failureReason:o.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{Lt(this,qr).forEach(rt=>{rt.onMutationUpdate(o)}),Lt(this,Lr).notify({mutation:this,type:"updated",action:o})})},Gs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zr,so,Zs,MutationCache=(Zs=class extends Subscribable{constructor(o={}){super();hr(this,zr);hr(this,so);this.config=o,ur(this,zr,new Map),ur(this,so,Date.now())}build(o,tt,rt){const nt=new Mutation({mutationCache:this,mutationId:++Cn(this,so)._,options:o.defaultMutationOptions(tt),state:rt});return this.add(nt),nt}add(o){const tt=scopeFor(o),rt=Lt(this,zr).get(tt)??[];rt.push(o),Lt(this,zr).set(tt,rt),this.notify({type:"added",mutation:o})}remove(o){var rt;const tt=scopeFor(o);if(Lt(this,zr).has(tt)){const nt=(rt=Lt(this,zr).get(tt))==null?void 0:rt.filter(ot=>ot!==o);nt&&(nt.length===0?Lt(this,zr).delete(tt):Lt(this,zr).set(tt,nt))}this.notify({type:"removed",mutation:o})}canRun(o){var rt;const tt=(rt=Lt(this,zr).get(scopeFor(o)))==null?void 0:rt.find(nt=>nt.state.status==="pending");return!tt||tt===o}runNext(o){var rt;const tt=(rt=Lt(this,zr).get(scopeFor(o)))==null?void 0:rt.find(nt=>nt!==o&&nt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}getAll(){return[...Lt(this,zr).values()].flat()}find(o){const tt={exact:!0,...o};return this.getAll().find(rt=>matchMutation(tt,rt))}findAll(o={}){return this.getAll().filter(tt=>matchMutation(o,tt))}notify(o){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(o)})})}resumePausedMutations(){const o=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(o.map(tt=>tt.continue().catch(noop$4))))}},zr=new WeakMap,so=new WeakMap,Zs);function scopeFor(et){var o;return((o=et.options.scope)==null?void 0:o.id)??String(et.mutationId)}function infiniteQueryBehavior(et){return{onFetch:(o,tt)=>{var lt,dt,ht,mt,ft;const rt=o.options,nt=(ht=(dt=(lt=o.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((mt=o.state.data)==null?void 0:mt.pages)||[],it=((ft=o.state.data)==null?void 0:ft.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let pt=!1;const gt=xt=>{Object.defineProperty(xt,"signal",{enumerable:!0,get:()=>(o.signal.aborted?pt=!0:o.signal.addEventListener("abort",()=>{pt=!0}),o.signal)})},yt=ensureQueryFn(o.options,o.fetchOptions),bt=async(xt,vt,Et)=>{if(pt)return Promise.reject();if(vt==null&&xt.pages.length)return Promise.resolve(xt);const Ct={queryKey:o.queryKey,pageParam:vt,direction:Et?"backward":"forward",meta:o.options.meta};gt(Ct);const St=await yt(Ct),{maxPages:At}=o.options,kt=Et?addToStart:addToEnd;return{pages:kt(xt.pages,St,At),pageParams:kt(xt.pageParams,vt,At)}};if(nt&&ot.length){const xt=nt==="backward",vt=xt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},Ct=vt(rt,Et);st=await bt(Et,Ct,xt)}else{const xt=et??ot.length;do{const vt=at===0?it[0]??rt.initialPageParam:getNextPageParam(rt,st);if(at>0&&vt==null)break;st=await bt(st,vt),at++}while(at{var pt,gt;return(gt=(pt=o.options).persister)==null?void 0:gt.call(pt,ct,{queryKey:o.queryKey,meta:o.options.meta,signal:o.signal},tt)}:o.fetchFn=ct}}}function getNextPageParam(et,{pages:o,pageParams:tt}){const rt=o.length-1;return o.length>0?et.getNextPageParam(o[rt],o,tt[rt],tt):void 0}function getPreviousPageParam(et,{pages:o,pageParams:tt}){var rt;return o.length>0?(rt=et.getPreviousPageParam)==null?void 0:rt.call(et,o[0],o,tt[0],tt):void 0}var Ir,pn,mn,Vn,Hn,gn,Wn,Gn,qs,QueryClient=(qs=class{constructor(et={}){hr(this,Ir);hr(this,pn);hr(this,mn);hr(this,Vn);hr(this,Hn);hr(this,gn);hr(this,Wn);hr(this,Gn);ur(this,Ir,et.queryCache||new QueryCache),ur(this,pn,et.mutationCache||new MutationCache),ur(this,mn,et.defaultOptions||{}),ur(this,Vn,new Map),ur(this,Hn,new Map),ur(this,gn,0)}mount(){Cn(this,gn)._++,Lt(this,gn)===1&&(ur(this,Wn,focusManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Lt(this,Ir).onFocus())})),ur(this,Gn,onlineManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Lt(this,Ir).onOnline())})))}unmount(){var et,o;Cn(this,gn)._--,Lt(this,gn)===0&&((et=Lt(this,Wn))==null||et.call(this),ur(this,Wn,void 0),(o=Lt(this,Gn))==null||o.call(this),ur(this,Gn,void 0))}isFetching(et){return Lt(this,Ir).findAll({...et,fetchStatus:"fetching"}).length}isMutating(et){return Lt(this,pn).findAll({...et,status:"pending"}).length}getQueryData(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Lt(this,Ir).get(o.queryHash))==null?void 0:tt.state.data}ensureQueryData(et){const o=this.getQueryData(et.queryKey);if(o===void 0)return this.fetchQuery(et);{const tt=this.defaultQueryOptions(et),rt=Lt(this,Ir).build(this,tt);return et.revalidateIfStale&&rt.isStaleByTime(resolveStaleTime(tt.staleTime,rt))&&this.prefetchQuery(tt),Promise.resolve(o)}}getQueriesData(et){return Lt(this,Ir).findAll(et).map(({queryKey:o,state:tt})=>{const rt=tt.data;return[o,rt]})}setQueryData(et,o,tt){const rt=this.defaultQueryOptions({queryKey:et}),nt=Lt(this,Ir).get(rt.queryHash),ot=nt==null?void 0:nt.state.data,it=functionalUpdate(o,ot);if(it!==void 0)return Lt(this,Ir).build(this,rt).setData(it,{...tt,manual:!0})}setQueriesData(et,o,tt){return notifyManager.batch(()=>Lt(this,Ir).findAll(et).map(({queryKey:rt})=>[rt,this.setQueryData(rt,o,tt)]))}getQueryState(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Lt(this,Ir).get(o.queryHash))==null?void 0:tt.state}removeQueries(et){const o=Lt(this,Ir);notifyManager.batch(()=>{o.findAll(et).forEach(tt=>{o.remove(tt)})})}resetQueries(et,o){const tt=Lt(this,Ir),rt={type:"active",...et};return notifyManager.batch(()=>(tt.findAll(et).forEach(nt=>{nt.reset()}),this.refetchQueries(rt,o)))}cancelQueries(et={},o={}){const tt={revert:!0,...o},rt=notifyManager.batch(()=>Lt(this,Ir).findAll(et).map(nt=>nt.cancel(tt)));return Promise.all(rt).then(noop$4).catch(noop$4)}invalidateQueries(et={},o={}){return notifyManager.batch(()=>{if(Lt(this,Ir).findAll(et).forEach(rt=>{rt.invalidate()}),et.refetchType==="none")return Promise.resolve();const tt={...et,type:et.refetchType??et.type??"active"};return this.refetchQueries(tt,o)})}refetchQueries(et={},o){const tt={...o,cancelRefetch:(o==null?void 0:o.cancelRefetch)??!0},rt=notifyManager.batch(()=>Lt(this,Ir).findAll(et).filter(nt=>!nt.isDisabled()).map(nt=>{let ot=nt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),nt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(rt).then(noop$4)}fetchQuery(et){const o=this.defaultQueryOptions(et);o.retry===void 0&&(o.retry=!1);const tt=Lt(this,Ir).build(this,o);return tt.isStaleByTime(resolveStaleTime(o.staleTime,tt))?tt.fetch(o):Promise.resolve(tt.state.data)}prefetchQuery(et){return this.fetchQuery(et).then(noop$4).catch(noop$4)}fetchInfiniteQuery(et){return et.behavior=infiniteQueryBehavior(et.pages),this.fetchQuery(et)}prefetchInfiniteQuery(et){return this.fetchInfiniteQuery(et).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(et){return et.behavior=infiniteQueryBehavior(et.pages),this.ensureQueryData(et)}resumePausedMutations(){return onlineManager.isOnline()?Lt(this,pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return Lt(this,Ir)}getMutationCache(){return Lt(this,pn)}getDefaultOptions(){return Lt(this,mn)}setDefaultOptions(et){ur(this,mn,et)}setQueryDefaults(et,o){Lt(this,Vn).set(hashKey(et),{queryKey:et,defaultOptions:o})}getQueryDefaults(et){const o=[...Lt(this,Vn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.queryKey)&&(tt={...tt,...rt.defaultOptions})}),tt}setMutationDefaults(et,o){Lt(this,Hn).set(hashKey(et),{mutationKey:et,defaultOptions:o})}getMutationDefaults(et){const o=[...Lt(this,Hn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.mutationKey)&&(tt={...tt,...rt.defaultOptions})}),tt}defaultQueryOptions(et){if(et._defaulted)return et;const o={...Lt(this,mn).queries,...this.getQueryDefaults(et.queryKey),...et,_defaulted:!0};return o.queryHash||(o.queryHash=hashQueryKeyByOptions(o.queryKey,o)),o.refetchOnReconnect===void 0&&(o.refetchOnReconnect=o.networkMode!=="always"),o.throwOnError===void 0&&(o.throwOnError=!!o.suspense),!o.networkMode&&o.persister&&(o.networkMode="offlineFirst"),o.enabled!==!0&&o.queryFn===skipToken&&(o.enabled=!1),o}defaultMutationOptions(et){return et!=null&&et._defaulted?et:{...Lt(this,mn).mutations,...(et==null?void 0:et.mutationKey)&&this.getMutationDefaults(et.mutationKey),...et,_defaulted:!0}}clear(){Lt(this,Ir).clear(),Lt(this,pn).clear()}},Ir=new WeakMap,pn=new WeakMap,mn=new WeakMap,Vn=new WeakMap,Hn=new WeakMap,gn=new WeakMap,Wn=new WeakMap,Gn=new WeakMap,qs),Br,Cr,ao,Mr,In,Zn,yn,Qr,co,qn,Kn,Pn,jn,bn,Qn,kr,oo,Rs,Ts,Is,Ps,js,Ns,Ds,ru,Ks,QueryObserver=(Ks=class extends Subscribable{constructor(o,tt){super();hr(this,kr);hr(this,Br);hr(this,Cr);hr(this,ao);hr(this,Mr);hr(this,In);hr(this,Zn);hr(this,yn);hr(this,Qr);hr(this,co);hr(this,qn);hr(this,Kn);hr(this,Pn);hr(this,jn);hr(this,bn);hr(this,Qn,new Set);this.options=tt,ur(this,Br,o),ur(this,Qr,null),ur(this,yn,pendingThenable()),this.options.experimental_prefetchInRender||Lt(this,yn).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Lt(this,Cr).addObserver(this),shouldFetchOnMount(Lt(this,Cr),this.options)?fr(this,kr,oo).call(this):this.updateResult(),fr(this,kr,Ps).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Lt(this,Cr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Lt(this,Cr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,kr,js).call(this),fr(this,kr,Ns).call(this),Lt(this,Cr).removeObserver(this)}setOptions(o,tt){const rt=this.options,nt=Lt(this,Cr);if(this.options=Lt(this,Br).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Lt(this,Cr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,kr,Ds).call(this),Lt(this,Cr).setOptions(this.options),rt._defaulted&&!shallowEqualObjects(this.options,rt)&&Lt(this,Br).getQueryCache().notify({type:"observerOptionsUpdated",query:Lt(this,Cr),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Lt(this,Cr),nt,this.options,rt)&&fr(this,kr,oo).call(this),this.updateResult(tt),ot&&(Lt(this,Cr)!==nt||resolveEnabled(this.options.enabled,Lt(this,Cr))!==resolveEnabled(rt.enabled,Lt(this,Cr))||resolveStaleTime(this.options.staleTime,Lt(this,Cr))!==resolveStaleTime(rt.staleTime,Lt(this,Cr)))&&fr(this,kr,Rs).call(this);const it=fr(this,kr,Ts).call(this);ot&&(Lt(this,Cr)!==nt||resolveEnabled(this.options.enabled,Lt(this,Cr))!==resolveEnabled(rt.enabled,Lt(this,Cr))||it!==Lt(this,bn))&&fr(this,kr,Is).call(this,it)}getOptimisticResult(o){const tt=Lt(this,Br).getQueryCache().build(Lt(this,Br),o),rt=this.createResult(tt,o);return shouldAssignObserverCurrentProperties(this,rt)&&(ur(this,Mr,rt),ur(this,Zn,this.options),ur(this,In,Lt(this,Cr).state)),rt}getCurrentResult(){return Lt(this,Mr)}trackResult(o,tt){const rt={};return Object.keys(o).forEach(nt=>{Object.defineProperty(rt,nt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(nt),tt==null||tt(nt),o[nt])})}),rt}trackProp(o){Lt(this,Qn).add(o)}getCurrentQuery(){return Lt(this,Cr)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const tt=Lt(this,Br).defaultQueryOptions(o),rt=Lt(this,Br).getQueryCache().build(Lt(this,Br),tt);return rt.fetch().then(()=>this.createResult(rt,tt))}fetch(o){return fr(this,kr,oo).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),Lt(this,Mr)))}createResult(o,tt){var At;const rt=Lt(this,Cr),nt=this.options,ot=Lt(this,Mr),it=Lt(this,In),st=Lt(this,Zn),ct=o!==rt?o.state:Lt(this,ao),{state:lt}=o;let dt={...lt},ht=!1,mt;if(tt._optimisticResults){const kt=this.hasListeners(),It=!kt&&shouldFetchOnMount(o,tt),Ot=kt&&shouldFetchOptionally(o,rt,tt,nt);(It||Ot)&&(dt={...dt,...fetchState(lt.data,o.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:ft,errorUpdatedAt:pt,status:gt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Lt(this,co))mt=Lt(this,qn);else try{ur(this,co,tt.select),mt=tt.select(dt.data),mt=replaceData(ot==null?void 0:ot.data,mt,tt),ur(this,qn,mt),ur(this,Qr,null)}catch(kt){ur(this,Qr,kt)}else mt=dt.data;if(tt.placeholderData!==void 0&&mt===void 0&>==="pending"){let kt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))kt=ot.data;else if(kt=typeof tt.placeholderData=="function"?tt.placeholderData((At=Lt(this,Kn))==null?void 0:At.state.data,Lt(this,Kn)):tt.placeholderData,tt.select&&kt!==void 0)try{kt=tt.select(kt),ur(this,Qr,null)}catch(It){ur(this,Qr,It)}kt!==void 0&&(gt="success",mt=replaceData(ot==null?void 0:ot.data,kt,tt),ht=!0)}Lt(this,Qr)&&(ft=Lt(this,Qr),mt=Lt(this,qn),pt=Date.now(),gt="error");const yt=dt.fetchStatus==="fetching",bt=gt==="pending",xt=gt==="error",vt=bt&&yt,Et=mt!==void 0,St={status:gt,fetchStatus:dt.fetchStatus,isPending:bt,isSuccess:gt==="success",isError:xt,isInitialLoading:vt,isLoading:vt,data:mt,dataUpdatedAt:dt.dataUpdatedAt,error:ft,errorUpdatedAt:pt,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:yt,isRefetching:yt&&!bt,isLoadingError:xt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:xt&&Et,isStale:isStale(o,tt),refetch:this.refetch,promise:Lt(this,yn)};if(this.options.experimental_prefetchInRender){const kt=Nt=>{St.status==="error"?Nt.reject(St.error):St.data!==void 0&&Nt.resolve(St.data)},It=()=>{const Nt=ur(this,yn,St.promise=pendingThenable());kt(Nt)},Ot=Lt(this,yn);switch(Ot.status){case"pending":o.queryHash===rt.queryHash&&kt(Ot);break;case"fulfilled":(St.status==="error"||St.data!==Ot.value)&&It();break;case"rejected":(St.status!=="error"||St.error!==Ot.reason)&&It();break}}return St}updateResult(o){const tt=Lt(this,Mr),rt=this.createResult(Lt(this,Cr),this.options);if(ur(this,In,Lt(this,Cr).state),ur(this,Zn,this.options),Lt(this,In).data!==void 0&&ur(this,Kn,Lt(this,Cr)),shallowEqualObjects(rt,tt))return;ur(this,Mr,rt);const nt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!Lt(this,Qn).size)return!0;const at=new Set(st??Lt(this,Qn));return this.options.throwOnError&&at.add("error"),Object.keys(Lt(this,Mr)).some(ct=>{const lt=ct;return Lt(this,Mr)[lt]!==tt[lt]&&at.has(lt)})};(o==null?void 0:o.listeners)!==!1&&ot()&&(nt.listeners=!0),fr(this,kr,ru).call(this,{...nt,...o})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,kr,Ps).call(this)}},Br=new WeakMap,Cr=new WeakMap,ao=new WeakMap,Mr=new WeakMap,In=new WeakMap,Zn=new WeakMap,yn=new WeakMap,Qr=new WeakMap,co=new WeakMap,qn=new WeakMap,Kn=new WeakMap,Pn=new WeakMap,jn=new WeakMap,bn=new WeakMap,Qn=new WeakMap,kr=new WeakSet,oo=function(o){fr(this,kr,Ds).call(this);let tt=Lt(this,Cr).fetch(this.options,o);return o!=null&&o.throwOnError||(tt=tt.catch(noop$4)),tt},Rs=function(){fr(this,kr,js).call(this);const o=resolveStaleTime(this.options.staleTime,Lt(this,Cr));if(isServer||Lt(this,Mr).isStale||!isValidTimeout(o))return;const rt=timeUntilStale(Lt(this,Mr).dataUpdatedAt,o)+1;ur(this,Pn,setTimeout(()=>{Lt(this,Mr).isStale||this.updateResult()},rt))},Ts=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Lt(this,Cr)):this.options.refetchInterval)??!1},Is=function(o){fr(this,kr,Ns).call(this),ur(this,bn,o),!(isServer||resolveEnabled(this.options.enabled,Lt(this,Cr))===!1||!isValidTimeout(Lt(this,bn))||Lt(this,bn)===0)&&ur(this,jn,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&fr(this,kr,oo).call(this)},Lt(this,bn)))},Ps=function(){fr(this,kr,Rs).call(this),fr(this,kr,Is).call(this,fr(this,kr,Ts).call(this))},js=function(){Lt(this,Pn)&&(clearTimeout(Lt(this,Pn)),ur(this,Pn,void 0))},Ns=function(){Lt(this,jn)&&(clearInterval(Lt(this,jn)),ur(this,jn,void 0))},Ds=function(){const o=Lt(this,Br).getQueryCache().build(Lt(this,Br),this.options);if(o===Lt(this,Cr))return;const tt=Lt(this,Cr);ur(this,Cr,o),ur(this,ao,o.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),o.addObserver(this))},ru=function(o){notifyManager.batch(()=>{o.listeners&&this.listeners.forEach(tt=>{tt(Lt(this,Mr))}),Lt(this,Br).getQueryCache().notify({query:Lt(this,Cr),type:"observerResultsUpdated"})})},Ks);function shouldLoadOnMount(et,o){return resolveEnabled(o.enabled,et)!==!1&&et.state.data===void 0&&!(et.state.status==="error"&&o.retryOnMount===!1)}function shouldFetchOnMount(et,o){return shouldLoadOnMount(et,o)||et.state.data!==void 0&&shouldFetchOn(et,o,o.refetchOnMount)}function shouldFetchOn(et,o,tt){if(resolveEnabled(o.enabled,et)!==!1){const rt=typeof tt=="function"?tt(et):tt;return rt==="always"||rt!==!1&&isStale(et,o)}return!1}function shouldFetchOptionally(et,o,tt,rt){return(et!==o||resolveEnabled(rt.enabled,et)===!1)&&(!tt.suspense||et.state.status!=="error")&&isStale(et,tt)}function isStale(et,o){return resolveEnabled(o.enabled,et)!==!1&&et.isStaleByTime(resolveStaleTime(o.staleTime,et))}function shouldAssignObserverCurrentProperties(et,o){return!shallowEqualObjects(et.getCurrentResult(),o)}var xn,vn,Fr,sn,ln,Xo,Os,Qs,MutationObserver$1=(Qs=class extends Subscribable{constructor(tt,rt){super();hr(this,ln);hr(this,xn);hr(this,vn);hr(this,Fr);hr(this,sn);ur(this,xn,tt),this.setOptions(rt),this.bindMethods(),fr(this,ln,Xo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var nt;const rt=this.options;this.options=Lt(this,xn).defaultMutationOptions(tt),shallowEqualObjects(this.options,rt)||Lt(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Lt(this,Fr),observer:this}),rt!=null&&rt.mutationKey&&this.options.mutationKey&&hashKey(rt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((nt=Lt(this,Fr))==null?void 0:nt.state.status)==="pending"&&Lt(this,Fr).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Lt(this,Fr))==null||tt.removeObserver(this)}onMutationUpdate(tt){fr(this,ln,Xo).call(this),fr(this,ln,Os).call(this,tt)}getCurrentResult(){return Lt(this,vn)}reset(){var tt;(tt=Lt(this,Fr))==null||tt.removeObserver(this),ur(this,Fr,void 0),fr(this,ln,Xo).call(this),fr(this,ln,Os).call(this)}mutate(tt,rt){var nt;return ur(this,sn,rt),(nt=Lt(this,Fr))==null||nt.removeObserver(this),ur(this,Fr,Lt(this,xn).getMutationCache().build(Lt(this,xn),this.options)),Lt(this,Fr).addObserver(this),Lt(this,Fr).execute(tt)}},xn=new WeakMap,vn=new WeakMap,Fr=new WeakMap,sn=new WeakMap,ln=new WeakSet,Xo=function(){var rt;const tt=((rt=Lt(this,Fr))==null?void 0:rt.state)??getDefaultState();ur(this,vn,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},Os=function(tt){notifyManager.batch(()=>{var rt,nt,ot,it,st,at,ct,lt;if(Lt(this,sn)&&this.hasListeners()){const dt=Lt(this,vn).variables,ht=Lt(this,vn).context;(tt==null?void 0:tt.type)==="success"?((nt=(rt=Lt(this,sn)).onSuccess)==null||nt.call(rt,tt.data,dt,ht),(it=(ot=Lt(this,sn)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Lt(this,sn)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Lt(this,sn)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Lt(this,vn))})})},Qs);function hashFn(et){return JSON.stringify(et,(o,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((rt,nt)=>(rt[nt]=tt[nt],rt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(et){if(!hasObjectPrototype(et))return!1;const o=et.constructor;if(typeof o>"u")return!0;const tt=o.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(et){return Object.prototype.toString.call(et)==="[object Object]"}function filterQueryOptions(et){const{_defaulted:o,behavior:tt,gcTime:rt,initialData:nt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:mt,retryDelay:ft,structuralSharing:pt,getPreviousPageParam:gt,getNextPageParam:yt,initialPageParam:bt,_optimisticResults:xt,enabled:vt,notifyOnChangeProps:Et,placeholderData:Ct,refetchInterval:St,refetchIntervalInBackground:At,refetchOnMount:kt,refetchOnReconnect:It,refetchOnWindowFocus:Ot,retryOnMount:Nt,select:Yt,staleTime:Ft,suspense:Ht,throwOnError:Qt,config:Vt,connector:Bt,query:Wt,...jt}=et;return jt}function connectMutationOptions(et){return{mutationFn(o){return connect$1(et,o)},mutationKey:["connect"]}}function disconnectMutationOptions(et){return{mutationFn(o){return disconnect(et,o)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{address:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("address is required");return await getBalance(et,{...ot,address:rt})??null},queryKey:getBalanceQueryKey(o)}}function getBalanceQueryKey(et={}){return["balance",filterQueryOptions(et)]}function getBlockNumberQueryOptions(et,o={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:rt,...nt}=tt[1];return await getBlockNumber(et,nt)??null},queryKey:getBlockNumberQueryKey(o)}}function getBlockNumberQueryKey(et={}){return["blockNumber",filterQueryOptions(et)]}function getEnsAddressQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{name:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("name is required");return getEnsAddress(et,{...ot,name:rt})},queryKey:getEnsAddressQueryKey(o)}}function getEnsAddressQueryKey(et={}){return["ensAddress",filterQueryOptions(et)]}function getEnsAvatarQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{name:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("name is required");return getEnsAvatar(et,{...ot,name:rt})},queryKey:getEnsAvatarQueryKey(o)}}function getEnsAvatarQueryKey(et={}){return["ensAvatar",filterQueryOptions(et)]}function getEnsNameQueryOptions(et,o={}){return{async queryFn({queryKey:tt}){const{address:rt,scopeKey:nt,...ot}=tt[1];if(!rt)throw new Error("address is required");return getEnsName(et,{...ot,address:rt})},queryKey:getEnsNameQueryKey(o)}}function getEnsNameQueryKey(et={}){return["ensName",filterQueryOptions(et)]}function signMessageMutationOptions(et){return{mutationFn(o){return signMessage(et,o)},mutationKey:["signMessage"]}}function switchChainMutationOptions(et){return{mutationFn(o){return switchChain(et,o)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=et=>{const o=reactExports.useContext(QueryClientContext);if(!o)throw new Error("No QueryClient set, use QueryClientProvider to set one");return o},QueryClientProvider=({client:et,children:o})=>(reactExports.useEffect(()=>(et.mount(),()=>{et.unmount()}),[et]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:et,children:o})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let et=!1;return{clearReset:()=>{et=!1},reset:()=>{et=!0},isReset:()=>et}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(et,o){return typeof et=="function"?et(...o):!!et}function noop$3(){}var ensurePreventErrorBoundaryRetry=(et,o)=>{(et.suspense||et.throwOnError)&&(o.isReset()||(et.retryOnMount=!1))},useClearResetErrorBoundary=et=>{reactExports.useEffect(()=>{et.clearReset()},[et])},getHasError=({result:et,errorResetBoundary:o,throwOnError:tt,query:rt})=>et.isError&&!o.isReset()&&!et.isFetching&&rt&&shouldThrowError(tt,[et.error,rt]),ensureSuspenseTimers=et=>{et.suspense&&(et.staleTime===void 0&&(et.staleTime=1e3),typeof et.gcTime=="number"&&(et.gcTime=Math.max(et.gcTime,1e3)))},willFetch=(et,o)=>et.isLoading&&et.isFetching&&!o,shouldSuspend=(et,o)=>(et==null?void 0:et.suspense)&&o.isPending,fetchOptimistic=(et,o,tt)=>o.fetchOptimistic(et).catch(()=>{tt.clearReset()});function useBaseQuery(et,o,tt){var lt,dt,ht,mt,ft;const rt=useQueryClient(),nt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=rt.defaultQueryOptions(et);(dt=(lt=rt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=nt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!rt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new o(rt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(pt=>{const gt=nt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),gt},[at,nt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:rt.getQueryCache().get(it.queryHash)}))throw ct.error;if((mt=(ht=rt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||mt.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,nt)){const pt=st?fetchOptimistic(it,at,ot):(ft=rt.getQueryCache().get(it.queryHash))==null?void 0:ft.promise;pt==null||pt.catch(noop$3).finally(()=>{at.hasListeners()||at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(et,o){return useBaseQuery(et,QueryObserver)}function useMutation(et,o){const tt=useQueryClient(),[rt]=reactExports.useState(()=>new MutationObserver$1(tt,et));reactExports.useEffect(()=>{rt.setOptions(et)},[rt,et]);const nt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>rt.subscribe(notifyManager.batchCalls(it)),[rt]),()=>rt.getCurrentResult(),()=>rt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{rt.mutate(it,st).catch(noop$3)},[rt]);if(nt.error&&shouldThrowError(rt.options.throwOnError,[nt.error]))throw nt.error;return{...nt,mutate:ot,mutateAsync:nt.mutate}}function useQuery(et){const o=useQuery$1({...et,queryKeyHashFn:hashFn});return o.queryKey=et.queryKey,o}function useChainId(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchChainId(o,{onChange:tt}),()=>getChainId(o),()=>getChainId(o))}function useBalance(et={}){const{address:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getBalanceQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(et={}){const{enabled:o=!0,onBlockNumber:tt,config:rt,...nt}=et,ot=useConfig(et),it=useChainId({config:ot}),st=et.chainId??it;reactExports.useEffect(()=>{if(o&&tt)return watchBlockNumber(ot,{...nt,chainId:st,onBlockNumber:tt})},[st,ot,o,tt,nt.onError,nt.emitMissed,nt.emitOnBegin,nt.poll,nt.pollingInterval,nt.syncConnectedChain])}function useBlockNumber(et={}){const{query:o={},watch:tt}=et,rt=useConfig(et),nt=useQueryClient(),ot=useChainId({config:rt}),it=et.chainId??ot,st=getBlockNumberQueryOptions(rt,{...et,chainId:it});return useWatchBlockNumber({config:et.config,chainId:et.chainId,...typeof tt=="object"?tt:{},enabled:!!((o.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){nt.setQueryData(st.queryKey,at)}}),useQuery({...o,...st})}function useChains$1(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchChains(o,{onChange:tt}),()=>getChains(o),()=>getChains(o))}function useConnectors$1(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchConnectors(o,{onChange:tt}),()=>getConnectors(o),()=>getConnectors(o))}function useConnect$1(et={}){const{mutation:o}=et,tt=useConfig(et),rt=connectMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:nt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(et={}){const o=useConfig(et);return reactExports.useSyncExternalStore(tt=>watchConnections(o,{onChange:tt}),()=>getConnections(o),()=>getConnections(o))}function useDisconnect(et={}){const{mutation:o}=et,tt=useConfig(et),rt=disconnectMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:nt,disconnectAsync:ot}}function useEnsAddress(et={}){const{name:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsAddressQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(et={}){const{name:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsAvatarQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(et={}){const{address:o,query:tt={}}=et,rt=useConfig(et),nt=useChainId({config:rt}),ot=getEnsNameQueryOptions(rt,{...et,chainId:et.chainId??nt}),it=!!(o&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(et={}){const{mutation:o}=et,tt=useConfig(et),rt=signMessageMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,signMessage:nt,signMessageAsync:ot}}function useSwitchChain(et={}){const{mutation:o}=et,tt=useConfig(et),rt=switchChainMutationOptions(tt),{mutate:nt,mutateAsync:ot,...it}=useMutation({...o,...rt});return{...it,chains:useChains$1({config:tt}),switchChain:nt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(et){var tt;return{transactions:(tt=et.transactions)==null?void 0:tt.map(rt=>{if(typeof rt=="string")return rt;const nt=formatTransaction(rt);return nt.typeHex==="0x7e"&&(nt.isSystemTx=rt.isSystemTx,nt.mint=rt.mint?hexToBigInt(rt.mint):void 0,nt.sourceHash=rt.sourceHash,nt.type="deposit"),nt}),stateRoot:et.stateRoot}}}),transaction:defineTransaction({format(et){const o={};return et.type==="0x7e"&&(o.isSystemTx=et.isSystemTx,o.mint=et.mint?hexToBigInt(et.mint):void 0,o.sourceHash=et.sourceHash,o.type="deposit"),o}}),transactionReceipt:defineTransactionReceipt({format(et){return{l1GasPrice:et.l1GasPrice?hexToBigInt(et.l1GasPrice):null,l1GasUsed:et.l1GasUsed?hexToBigInt(et.l1GasUsed):null,l1Fee:et.l1Fee?hexToBigInt(et.l1Fee):null,l1FeeScalar:et.l1FeeScalar?Number(et.l1FeeScalar):null}}})};function serializeTransaction(et,o){return isDeposit(et)?serializeTransactionDeposit(et):serializeTransaction$1(et,o)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(et){assertTransactionDeposit(et);const{sourceHash:o,data:tt,from:rt,gas:nt,isSystemTx:ot,mint:it,to:st,value:at}=et,ct=[o,rt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(et){return et.type==="deposit"||typeof et.sourceHash<"u"}function assertTransactionDeposit(et){const{from:o,to:tt}=et;if(o&&!isAddress(o))throw new InvalidAddressError({address:o});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({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}}}),sourceId=1,optimism=defineChain({...chainConfig,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:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(et={}){return et.version==="3"||et.headlessMode?version3(et):version4(et)}function version4(et){let o,tt,rt,nt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));rt||(rt=this.onAccountsChanged.bind(this),at.on("accountsChanged",rt)),nt||(nt=this.onChainChanged.bind(this),at.on("chainChanged",nt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();rt&&(st.removeListener("accountsChanged",rt),rt=void 0),nt&&(st.removeListener("chainChanged",nt),nt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const{default:at}=await __vitePreload(async()=>{const{default:ct}=await import("./index-BNMaGkP5.js").then(lt=>lt.i);return{default:ct}},__vite__mapDeps([0,1,2,3]),import.meta.url);return typeof at!="function"&&typeof at.default=="function"?at.default:at})();o=new st({...et,appChainIds:it.chains.map(at=>at.id)}),tt=o.makeWeb3Provider({...et,options:et.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,mt,ft;const ct=it.chains.find(pt=>pt.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(pt){if(pt.code===4902)try{let gt;st!=null&&st.blockExplorerUrls?gt=st.blockExplorerUrls:gt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let yt;(mt=st==null?void 0:st.rpcUrls)!=null&&mt.length?yt=st.rpcUrls:yt=[((ft=ct.rpcUrls.default)==null?void 0:ft.http[0])??""];const bt={blockExplorerUrls:gt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:yt};return await lt.request({method:"wallet_addEthereumChain",params:[bt]}),ct}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(pt)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),nt&&(at.removeListener("chainChanged",nt),nt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(et){let tt,rt,nt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));nt||(nt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",nt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(mt=>{if(mt.code===UserRejectedRequestError.code)throw mt;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!rt){const ct=await(async()=>{const{default:ft}=await __vitePreload(async()=>{const{default:pt}=await import("./index-BSVGFq6n.js").then(gt=>gt.i);return{default:pt}},__vite__mapDeps([4,3,1,2]),import.meta.url);return typeof ft!="function"&&typeof ft.default=="function"?ft.default:ft})();tt=new ct({...et,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(ft=>et.chainId?ft.id===et.chainId:ft.id===lt)||st.chains[0],ht=et.chainId||(dt==null?void 0:dt.id),mt=et.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);rt=tt.makeWeb3Provider(mt,ht)}return rt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,mt,ft,pt;const lt=st.chains.find(gt=>gt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(gt){if(gt.code===4902)try{let yt;at!=null&&at.blockExplorerUrls?yt=at.blockExplorerUrls:yt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(mt=lt.blockExplorers)==null?void 0:mt.default.url]:[];let bt;(ft=at==null?void 0:at.rpcUrls)!=null&&ft.length?bt=at.rpcUrls:bt=[((pt=lt.rpcUrls.default)==null?void 0:pt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:bt};return await dt.request({method:"wallet_addEthereumChain",params:[xt]}),lt}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(gt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();nt&&(ct.removeListener("accountsChanged",nt),nt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(et={}){const{shimDisconnect:o=!1}=et;let tt,rt;return nt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return rt||(rt=this.onDisconnect.bind(this),ot.on("disconnect",rt)),o&&await((at=nt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;rt&&(ot.removeListener("disconnect",rt),rt=void 0),o&&await((it=nt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-i9SwLR_n.js");return{default:lt}},[],import.meta.url),st=new it(et),at=await withTimeout(()=>st.safe.getInfo(),{timeout:et.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const{SafeAppProvider:ct}=await __vitePreload(async()=>{const{SafeAppProvider:lt}=await import("./index-D0eaAjbe.js").then(dt=>dt.i);return{SafeAppProvider:lt}},__vite__mapDeps([5,2]),import.meta.url);tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return o&&await((ot=nt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){nt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(et){const o=et.isNewChainsStale??!0;let tt,rt;const nt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...mt}={}){var ft,pt;try{const gt=await this.getProvider();if(!gt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,gt.on("display_uri",at));let yt=ht;if(!yt){const Et=await((ft=dt.storage)==null?void 0:ft.getItem("state"))??{};dt.chains.some(St=>St.id===Et.chainId)?yt=Et.chainId:yt=(pt=dt.chains[0])==null?void 0:pt.id}if(!yt)throw new Error("No chains found on connector.");const bt=await this.isChainsStale();if(gt.session&&bt&&await gt.disconnect(),!gt.session||bt){const Et=dt.chains.filter(Ct=>Ct.id!==yt).map(Ct=>Ct.id);await gt.connect({optionalChains:[yt,...Et],..."pairingTopic"in mt?{pairingTopic:mt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(Ct=>Ct.id))}const xt=(await gt.enable()).map(Et=>getAddress(Et)),vt=await this.getChainId();return at&&(gt.removeListener("display_uri",at),at=void 0),st&&(gt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),gt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),gt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),gt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),gt.on("session_delete",ct)),{accounts:xt,chainId:vt}}catch(gt){throw/(user rejected|connection request reset)/i.test(gt==null?void 0:gt.message)?new UserRejectedRequestError(gt):gt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(mt){if(!/No matching key/i.test(mt.message))throw mt}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(mt=>getAddress(mt))},async getProvider({chainId:ht}={}){var ft;async function mt(){const pt=dt.chains.map(yt=>yt.id);if(!pt.length)return;const{EthereumProvider:gt}=await __vitePreload(async()=>{const{EthereumProvider:yt}=await import("./index.es-DaAD1bdq.js");return{EthereumProvider:yt}},__vite__mapDeps([6,2,3]),import.meta.url);return await gt.init({...et,disableProviderPing:!0,optionalChains:pt,projectId:et.projectId,rpcMap:Object.fromEntries(dt.chains.map(yt=>{const[bt]=extractRpcUrls({chain:yt,transports:dt.transports});return[yt.id,bt]})),showQrModal:et.showQrModal??!0})}return tt||(rt||(rt=mt()),tt=await rt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((ft=this.switchChain)==null?void 0:ft.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,mt]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&mt.session?(await mt.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:mt}){var gt,yt,bt;const ft=await this.getProvider();if(!ft)throw new ProviderNotFoundError;const pt=dt.chains.find(xt=>xt.id===mt);if(!pt)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(vt=>{const Et=({chainId:Ct})=>{Ct===mt&&(dt.emitter.off("change",Et),vt())};dt.emitter.on("change",Et)}),ft.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(mt)}]})]);const xt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...xt,mt]),pt}catch(xt){const vt=xt;if(/(user rejected)/i.test(vt.message))throw new UserRejectedRequestError(vt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(gt=pt.blockExplorers)!=null&>.default.url?[(yt=pt.blockExplorers)==null?void 0:yt.default.url]:[];let Ct;(bt=ht==null?void 0:ht.rpcUrls)!=null&&bt.length?Ct=ht.rpcUrls:Ct=[...pt.rpcUrls.default.http];const St={blockExplorerUrls:Et,chainId:numberToHex(mt),chainName:(ht==null?void 0:ht.chainName)??pt.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??pt.nativeCurrency,rpcUrls:Ct};await ft.request({method:"wallet_addEthereumChain",params:[St]});const At=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...At,mt]),pt}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(mt=>getAddress(mt))})},onChainChanged(ht){const mt=Number(ht);dt.emitter.emit("change",{chainId:mt})},async onConnect(ht){const mt=Number(ht.chainId),ft=await this.getAccounts();dt.emitter.emit("connect",{accounts:ft,chainId:mt})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const mt=await this.getProvider();ot&&(mt.removeListener("accountsChanged",ot),ot=void 0),it&&(mt.removeListener("chainChanged",it),it=void 0),lt&&(mt.removeListener("disconnect",lt),lt=void 0),ct&&(mt.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),mt.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var mt,ft,pt;return tt?((pt=(ft=(mt=tt.session)==null?void 0:mt.namespaces[nt])==null?void 0:ft.accounts)==null?void 0:pt.map(gt=>Number.parseInt(gt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!o)return!1;const ht=dt.chains.map(pt=>pt.id),mt=this.getNamespaceChainsIds();if(mt.length&&!mt.some(pt=>ht.includes(pt)))return!1;const ft=await this.getRequestedChainsIds();return!ht.every(pt=>ft.includes(pt))},async setRequestedChainsIds(ht){var mt;await((mt=dt.storage)==null?void 0:mt.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var __spreadArray$1=function(et,o,tt){if(tt||arguments.length===2)for(var rt=0,nt=o.length,ot;rt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(et){return et!==""&&userAgentRules.reduce(function(o,tt){var rt=tt[0],nt=tt[1];if(o)return o;var ot=nt.exec(et);return!!ot&&[rt,ot]},!1)}function parseUserAgent(et){var o=matchUserAgent(et);if(!o)return null;var tt=o[0],rt=o[1];if(tt==="searchbot")return new BotInfo;var nt=rt[1]&&rt[1].split(".").join("_").split("_").slice(0,3);nt?nt.length0)throw new Error("Invalid string. Length must be a multiple of 4");var tt=et.indexOf("=");tt===-1&&(tt=o);var rt=tt===o?0:4-tt%4;return[tt,rt]}function byteLength(et){var o=getLens(et),tt=o[0],rt=o[1];return(tt+rt)*3/4-rt}function _byteLength(et,o,tt){return(o+tt)*3/4-tt}function toByteArray(et){var o,tt=getLens(et),rt=tt[0],nt=tt[1],ot=new Arr(_byteLength(et,rt,nt)),it=0,st=nt>0?rt-4:rt,at;for(at=0;at>16&255,ot[it++]=o>>8&255,ot[it++]=o&255;return nt===2&&(o=revLookup[et.charCodeAt(at)]<<2|revLookup[et.charCodeAt(at+1)]>>4,ot[it++]=o&255),nt===1&&(o=revLookup[et.charCodeAt(at)]<<10|revLookup[et.charCodeAt(at+1)]<<4|revLookup[et.charCodeAt(at+2)]>>2,ot[it++]=o>>8&255,ot[it++]=o&255),ot}function tripletToBase64(et){return lookup[et>>18&63]+lookup[et>>12&63]+lookup[et>>6&63]+lookup[et&63]}function encodeChunk(et,o,tt){for(var rt,nt=[],ot=o;otst?st:it+ot));return rt===1?(o=et[tt-1],nt.push(lookup[o>>2]+lookup[o<<4&63]+"==")):rt===2&&(o=(et[tt-2]<<8)+et[tt-1],nt.push(lookup[o>>10]+lookup[o>>4&63]+lookup[o<<2&63]+"=")),nt.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(et,o,tt,rt,nt){var ot,it,st=nt*8-rt-1,at=(1<>1,lt=-7,dt=tt?nt-1:0,ht=tt?-1:1,mt=et[o+dt];for(dt+=ht,ot=mt&(1<<-lt)-1,mt>>=-lt,lt+=st;lt>0;ot=ot*256+et[o+dt],dt+=ht,lt-=8);for(it=ot&(1<<-lt)-1,ot>>=-lt,lt+=rt;lt>0;it=it*256+et[o+dt],dt+=ht,lt-=8);if(ot===0)ot=1-ct;else{if(ot===at)return it?NaN:(mt?-1:1)*(1/0);it=it+Math.pow(2,rt),ot=ot-ct}return(mt?-1:1)*it*Math.pow(2,ot-rt)};ieee754.write=function(et,o,tt,rt,nt,ot){var it,st,at,ct=ot*8-nt-1,lt=(1<>1,ht=nt===23?Math.pow(2,-24)-Math.pow(2,-77):0,mt=rt?0:ot-1,ft=rt?1:-1,pt=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(st=isNaN(o)?1:0,it=lt):(it=Math.floor(Math.log(o)/Math.LN2),o*(at=Math.pow(2,-it))<1&&(it--,at*=2),it+dt>=1?o+=ht/at:o+=ht*Math.pow(2,1-dt),o*at>=2&&(it++,at/=2),it+dt>=lt?(st=0,it=lt):it+dt>=1?(st=(o*at-1)*Math.pow(2,nt),it=it+dt):(st=o*Math.pow(2,dt-1)*Math.pow(2,nt),it=0));nt>=8;et[tt+mt]=st&255,mt+=ft,st/=256,nt-=8);for(it=it<0;et[tt+mt]=it&255,mt+=ft,it/=256,ct-=8);et[tt+mt-ft]|=pt*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh @@ -4269,4 +4269,4 @@ This document is licensed under CC-BY-SA. `});++rt0&&tt.push({type:"text",value:` `}),tt}function trimMarkdownSpaceStart(et){let o=0,tt=et.charCodeAt(o);for(;tt===9||tt===32;)o++,tt=et.charCodeAt(o);return et.slice(o)}function toHast(et,o){const tt=createState(et,o),rt=tt.one(et,void 0),nt=footer(tt),ot=Array.isArray(rt)?{type:"root",children:rt}:rt||{type:"root",children:[]};return nt&&ot.children.push({type:"text",value:` -`},nt),ot}function remarkRehype(et,o){return et&&"run"in et?async function(tt,rt){const nt=toHast(tt,{file:rt,...o});await et.run(nt,rt)}:function(tt,rt){return toHast(tt,{file:rt,...et||o})}}function bail(et){if(et)throw et}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function et(o){return typeof Array.isArray=="function"?Array.isArray(o):toStr.call(o)==="[object Array]"},isPlainObject$1=function et(o){if(!o||toStr.call(o)!=="[object Object]")return!1;var tt=hasOwn.call(o,"constructor"),rt=o.constructor&&o.constructor.prototype&&hasOwn.call(o.constructor.prototype,"isPrototypeOf");if(o.constructor&&!tt&&!rt)return!1;var nt;for(nt in o);return typeof nt>"u"||hasOwn.call(o,nt)},setProperty=function et(o,tt){defineProperty&&tt.name==="__proto__"?defineProperty(o,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):o[tt.name]=tt.newValue},getProperty=function et(o,tt){if(tt==="__proto__")if(hasOwn.call(o,tt)){if(gOPD)return gOPD(o,tt).value}else return;return o[tt]},extend=function et(){var o,tt,rt,nt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(nt);try{at=et.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return nt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,nt):at instanceof Error?nt(at):ot(at))}function nt(it,...st){tt||(tt=!0,o(it,...st))}function ot(it){nt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(et,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(et);let tt=0,rt=-1,nt=et.length,ot;if(o===void 0||o.length===0||o.length>et.length){for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else rt<0&&(ot=!0,rt=nt+1);return rt<0?"":et.slice(tt,rt)}if(o===et)return"";let it=-1,st=o.length-1;for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else it<0&&(ot=!0,it=nt+1),st>-1&&(et.codePointAt(nt)===o.codePointAt(st--)?st<0&&(rt=nt):(st=-1,rt=it));return tt===rt?rt=it:rt<0&&(rt=et.length),et.slice(tt,rt)}function dirname(et){if(assertPath$1(et),et.length===0)return".";let o=-1,tt=et.length,rt;for(;--tt;)if(et.codePointAt(tt)===47){if(rt){o=tt;break}}else rt||(rt=!0);return o<0?et.codePointAt(0)===47?"/":".":o===1&&et.codePointAt(0)===47?"//":et.slice(0,o)}function extname(et){assertPath$1(et);let o=et.length,tt=-1,rt=0,nt=-1,ot=0,it;for(;o--;){const st=et.codePointAt(o);if(st===47){if(it){rt=o+1;break}continue}tt<0&&(it=!0,tt=o+1),st===46?nt<0?nt=o:ot!==1&&(ot=1):nt>-1&&(ot=-1)}return nt<0||tt<0||ot===0||ot===1&&nt===tt-1&&nt===rt+1?"":et.slice(nt,tt)}function join(...et){let o=-1,tt;for(;++o0&&et.codePointAt(et.length-1)===47&&(tt+="/"),o?"/"+tt:tt}function normalizeString(et,o){let tt="",rt=0,nt=-1,ot=0,it=-1,st,at;for(;++it<=et.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",rt=0):(tt=tt.slice(0,at),rt=tt.length-1-tt.lastIndexOf("/")),nt=it,ot=0;continue}}else if(tt.length>0){tt="",rt=0,nt=it,ot=0;continue}}o&&(tt=tt.length>0?tt+"/..":"..",rt=2)}else tt.length>0?tt+="/"+et.slice(nt+1,it):tt=et.slice(nt+1,it),rt=it-nt-1;nt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(et){if(typeof et!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(et))}const minproc={cwd};function cwd(){return"/"}function isUrl(et){return!!(et!==null&&typeof et=="object"&&"href"in et&&et.href&&"protocol"in et&&et.protocol&&et.auth===void 0)}function urlToPath(et){if(typeof et=="string")et=new URL(et);else if(!isUrl(et)){const o=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+et+"`");throw o.code="ERR_INVALID_ARG_TYPE",o}if(et.protocol!=="file:"){const o=new TypeError("The URL must be of scheme file");throw o.code="ERR_INVALID_URL_SCHEME",o}return getPathFromURLPosix(et)}function getPathFromURLPosix(et){if(et.hostname!==""){const rt=new TypeError('File URL host must be "localhost" or empty on darwin');throw rt.code="ERR_INVALID_FILE_URL_HOST",rt}const o=et.pathname;let tt=-1;for(;++tt0){let[mt,...ft]=lt;const pt=rt[ht][1];isPlainObject(pt)&&isPlainObject(mt)&&(mt=extend$1(!0,pt,mt)),rt[ht]=[ct,mt,...ft]}}}}const unified=new Processor().freeze();function assertParser(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `parser`")}function assertCompiler(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `compiler`")}function assertUnfrozen(et,o){if(o)throw new Error("Cannot call `"+et+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(et){if(!isPlainObject(et)||typeof et.type!="string")throw new TypeError("Expected node, got `"+et+"`")}function assertDone(et,o,tt){if(!tt)throw new Error("`"+et+"` finished async. Use `"+o+"` instead")}function vfile(et){return looksLikeAVFile(et)?et:new VFile(et)}function looksLikeAVFile(et){return!!(et&&typeof et=="object"&&"message"in et&&"messages"in et)}function looksLikeAValue(et){return typeof et=="string"||isUint8Array(et)}function isUint8Array(et){return!!(et&&typeof et=="object"&&"byteLength"in et&&"byteOffset"in et)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(et){const o=et.allowedElements,tt=et.allowElement,rt=et.children||"",nt=et.className,ot=et.components,it=et.disallowedElements,st=et.rehypePlugins||emptyPlugins,at=et.remarkPlugins||emptyPlugins,ct=et.remarkRehypeOptions?{...et.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=et.skipHtml,dt=et.unwrapDisallowed,ht=et.urlTransform||defaultUrlTransform,mt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),ft=new VFile;typeof rt=="string"&&(ft.value=rt);for(const bt of deprecations)Object.hasOwn(et,bt.from)&&(""+bt.from+(bt.to?"use `"+bt.to+"` instead":"remove it")+changelog+bt.id,void 0);const pt=mt.parse(ft);let gt=mt.runSync(pt,ft);return nt&&(gt={type:"element",tagName:"div",properties:{className:nt},children:gt.type==="root"?gt.children:[gt]}),visit(gt,yt),toJsxRuntime(gt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function yt(bt,xt,vt){if(bt.type==="raw"&&vt&&typeof xt=="number")return lt?vt.children.splice(xt,1):vt.children[xt]={type:"text",value:bt.value},xt;if(bt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(bt.properties,Et)){const Ct=bt.properties[Et],St=urlAttributes[Et];(St===null||St.includes(bt.tagName))&&(bt.properties[Et]=ht(String(Ct||""),Et,bt))}}if(bt.type==="element"){let Et=o?!o.includes(bt.tagName):it?it.includes(bt.tagName):!1;if(!Et&&tt&&typeof xt=="number"&&(Et=!tt(bt,xt,vt)),Et&&vt&&typeof xt=="number")return dt&&bt.children?vt.children.splice(xt,1,...bt.children):vt.children.splice(xt,1),xt}}}function defaultUrlTransform(et){const o=et.indexOf(":"),tt=et.indexOf("?"),rt=et.indexOf("#"),nt=et.indexOf("/");return o<0||nt>-1&&o>nt||tt>-1&&o>tt||rt>-1&&o>rt||safeProtocol.test(et.slice(0,o))?et:""}const PrivacyPolicyOptIn=({onOptIn:et})=>{const[o,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>et(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>et(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:o,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[et,o]=reactExports.useState(!1);reactExports.useEffect(()=>{const rt=localStorage.getItem("privacyPolicyOptIn");rt!==null&&o(rt==="true")},[]);const tt=()=>{const rt=!et;o(rt),localStorage.setItem("privacyPolicyOptIn",rt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",et?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:et?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const{chainUUID:rt,blockUUID:nt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=et.find(ct=>ct.chainUUID===rt&&ct.blockUUID===nt);at&&it(at)},[et,rt,nt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:et,onSuccess:o})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})};function App(){const[et,o]=reactExports.useState(!1),[tt,rt]=reactExports.useState([]),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"}),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const gt=localStorage.getItem("telemetryOptIn");gt!==null&<(gt==="true")},[]),reactExports.useEffect(()=>{nt||!it||it.libp2p.getConnections().length===0||tt.length>0||et||(o(!0),ft())},[it,nt,st]);const mt=gt=>{lt(gt),localStorage.setItem("telemetryOptIn",gt.toString())};if(nt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const ft=async()=>{console.log("Starting message listening");try{at(yt=>({...yt,store:"in-progress"})),ht(!0);const gt=getMessagesFromStore(it);for await(const yt of gt)rt(bt=>bt.some(vt=>vt.blockUUID===yt.blockUUID)?bt:[...bt,yt]);at(yt=>({...yt,store:"success"}))}catch(gt){console.error("Error fetching messages from store:",gt),at(yt=>({...yt,store:"error"}))}finally{ht(!1)}try{at(gt=>({...gt,filter:"in-progress"})),await subscribeToFilter(it,gt=>{pt(gt)}),at(gt=>({...gt,filter:"success"}))}catch(gt){console.error("Error subscribing to filter:",gt),at(yt=>({...yt,filter:"error"}))}};if(ot)return jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const pt=gt=>{rt(yt=>yt.some(xt=>xt.blockUUID===gt.blockUUID)?yt:[...yt,gt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:mt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"/view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"/sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"/telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"/create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]});var util;(function(et){et.assertEqual=nt=>nt;function o(nt){}et.assertIs=o;function tt(nt){throw new Error}et.assertNever=tt,et.arrayToEnum=nt=>{const ot={};for(const it of nt)ot[it]=it;return ot},et.getValidEnumValues=nt=>{const ot=et.objectKeys(nt).filter(st=>typeof nt[nt[st]]!="number"),it={};for(const st of ot)it[st]=nt[st];return et.objectValues(it)},et.objectValues=nt=>et.objectKeys(nt).map(function(ot){return nt[ot]}),et.objectKeys=typeof Object.keys=="function"?nt=>Object.keys(nt):nt=>{const ot=[];for(const it in nt)Object.prototype.hasOwnProperty.call(nt,it)&&ot.push(it);return ot},et.find=(nt,ot)=>{for(const it of nt)if(ot(it))return it},et.isInteger=typeof Number.isInteger=="function"?nt=>Number.isInteger(nt):nt=>typeof nt=="number"&&isFinite(nt)&&Math.floor(nt)===nt;function rt(nt,ot=" | "){return nt.map(it=>typeof it=="string"?`'${it}'`:it).join(ot)}et.joinValues=rt,et.jsonStringifyReplacer=(nt,ot)=>typeof ot=="bigint"?ot.toString():ot})(util||(util={}));var objectUtil;(function(et){et.mergeShapes=(o,tt)=>({...o,...tt})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=et=>{switch(typeof et){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(et)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(et)?ZodParsedType.array:et===null?ZodParsedType.null:et.then&&typeof et.then=="function"&&et.catch&&typeof et.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&et instanceof Map?ZodParsedType.map:typeof Set<"u"&&et instanceof Set?ZodParsedType.set:typeof Date<"u"&&et instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=et=>JSON.stringify(et,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(o){super(),this.issues=[],this.addIssue=rt=>{this.issues=[...this.issues,rt]},this.addIssues=(rt=[])=>{this.issues=[...this.issues,...rt]};const tt=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,tt):this.__proto__=tt,this.name="ZodError",this.issues=o}get errors(){return this.issues}format(o){const tt=o||function(ot){return ot.message},rt={_errors:[]},nt=ot=>{for(const it of ot.issues)if(it.code==="invalid_union")it.unionErrors.map(nt);else if(it.code==="invalid_return_type")nt(it.returnTypeError);else if(it.code==="invalid_arguments")nt(it.argumentsError);else if(it.path.length===0)rt._errors.push(tt(it));else{let st=rt,at=0;for(;attt.message){const tt={},rt=[];for(const nt of this.issues)nt.path.length>0?(tt[nt.path[0]]=tt[nt.path[0]]||[],tt[nt.path[0]].push(o(nt))):rt.push(o(nt));return{formErrors:rt,fieldErrors:tt}}get formErrors(){return this.flatten()}}ZodError.create=et=>new ZodError(et);const errorMap=(et,o)=>{let tt;switch(et.code){case ZodIssueCode.invalid_type:et.received===ZodParsedType.undefined?tt="Required":tt=`Expected ${et.expected}, received ${et.received}`;break;case ZodIssueCode.invalid_literal:tt=`Invalid literal value, expected ${JSON.stringify(et.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:tt=`Unrecognized key(s) in object: ${util.joinValues(et.keys,", ")}`;break;case ZodIssueCode.invalid_union:tt="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:tt=`Invalid discriminator value. Expected ${util.joinValues(et.options)}`;break;case ZodIssueCode.invalid_enum_value:tt=`Invalid enum value. Expected ${util.joinValues(et.options)}, received '${et.received}'`;break;case ZodIssueCode.invalid_arguments:tt="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:tt="Invalid function return type";break;case ZodIssueCode.invalid_date:tt="Invalid date";break;case ZodIssueCode.invalid_string:typeof et.validation=="object"?"includes"in et.validation?(tt=`Invalid input: must include "${et.validation.includes}"`,typeof et.validation.position=="number"&&(tt=`${tt} at one or more positions greater than or equal to ${et.validation.position}`)):"startsWith"in et.validation?tt=`Invalid input: must start with "${et.validation.startsWith}"`:"endsWith"in et.validation?tt=`Invalid input: must end with "${et.validation.endsWith}"`:util.assertNever(et.validation):et.validation!=="regex"?tt=`Invalid ${et.validation}`:tt="Invalid";break;case ZodIssueCode.too_small:et.type==="array"?tt=`Array must contain ${et.exact?"exactly":et.inclusive?"at least":"more than"} ${et.minimum} element(s)`:et.type==="string"?tt=`String must contain ${et.exact?"exactly":et.inclusive?"at least":"over"} ${et.minimum} character(s)`:et.type==="number"?tt=`Number must be ${et.exact?"exactly equal to ":et.inclusive?"greater than or equal to ":"greater than "}${et.minimum}`:et.type==="date"?tt=`Date must be ${et.exact?"exactly equal to ":et.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(et.minimum))}`:tt="Invalid input";break;case ZodIssueCode.too_big:et.type==="array"?tt=`Array must contain ${et.exact?"exactly":et.inclusive?"at most":"less than"} ${et.maximum} element(s)`:et.type==="string"?tt=`String must contain ${et.exact?"exactly":et.inclusive?"at most":"under"} ${et.maximum} character(s)`:et.type==="number"?tt=`Number must be ${et.exact?"exactly":et.inclusive?"less than or equal to":"less than"} ${et.maximum}`:et.type==="bigint"?tt=`BigInt must be ${et.exact?"exactly":et.inclusive?"less than or equal to":"less than"} ${et.maximum}`:et.type==="date"?tt=`Date must be ${et.exact?"exactly":et.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(et.maximum))}`:tt="Invalid input";break;case ZodIssueCode.custom:tt="Invalid input";break;case ZodIssueCode.invalid_intersection_types:tt="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:tt=`Number must be a multiple of ${et.multipleOf}`;break;case ZodIssueCode.not_finite:tt="Number must be finite";break;default:tt=o.defaultError,util.assertNever(et)}return{message:tt}};let overrideErrorMap=errorMap;function setErrorMap(et){overrideErrorMap=et}function getErrorMap(){return overrideErrorMap}const makeIssue=et=>{const{data:o,path:tt,errorMaps:rt,issueData:nt}=et,ot=[...tt,...nt.path||[]],it={...nt,path:ot};if(nt.message!==void 0)return{...nt,path:ot,message:nt.message};let st="";const at=rt.filter(ct=>!!ct).slice().reverse();for(const ct of at)st=ct(it,{data:o,defaultError:st}).message;return{...nt,path:ot,message:st}},EMPTY_PATH=[];function addIssueToContext(et,o){const tt=getErrorMap(),rt=makeIssue({issueData:o,data:et.data,path:et.path,errorMaps:[et.common.contextualErrorMap,et.schemaErrorMap,tt,tt===errorMap?void 0:errorMap].filter(nt=>!!nt)});et.common.issues.push(rt)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(o,tt){const rt=[];for(const nt of tt){if(nt.status==="aborted")return INVALID;nt.status==="dirty"&&o.dirty(),rt.push(nt.value)}return{status:o.value,value:rt}}static async mergeObjectAsync(o,tt){const rt=[];for(const nt of tt){const ot=await nt.key,it=await nt.value;rt.push({key:ot,value:it})}return ParseStatus.mergeObjectSync(o,rt)}static mergeObjectSync(o,tt){const rt={};for(const nt of tt){const{key:ot,value:it}=nt;if(ot.status==="aborted"||it.status==="aborted")return INVALID;ot.status==="dirty"&&o.dirty(),it.status==="dirty"&&o.dirty(),ot.value!=="__proto__"&&(typeof it.value<"u"||nt.alwaysSet)&&(rt[ot.value]=it.value)}return{status:o.value,value:rt}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=et=>({status:"dirty",value:et}),OK=et=>({status:"valid",value:et}),isAborted=et=>et.status==="aborted",isDirty=et=>et.status==="dirty",isValid=et=>et.status==="valid",isAsync=et=>typeof Promise<"u"&&et instanceof Promise;function __classPrivateFieldGet(et,o,tt,rt){if(typeof o=="function"?et!==o||!rt:!o.has(et))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o.get(et)}function __classPrivateFieldSet(et,o,tt,rt,nt){if(typeof o=="function"?et!==o||!nt:!o.has(et))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o.set(et,tt),tt}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(et){et.errToObj=o=>typeof o=="string"?{message:o}:o||{},et.toString=o=>typeof o=="string"?o:o==null?void 0:o.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(o,tt,rt,nt){this._cachedPath=[],this.parent=o,this.data=tt,this._path=rt,this._key=nt}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(et,o)=>{if(isValid(o))return{success:!0,data:o.value};if(!et.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const tt=new ZodError(et.common.issues);return this._error=tt,this._error}}};function processCreateParams(et){if(!et)return{};const{errorMap:o,invalid_type_error:tt,required_error:rt,description:nt}=et;if(o&&(tt||rt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return o?{errorMap:o,description:nt}:{errorMap:(it,st)=>{var at,ct;const{message:lt}=et;return it.code==="invalid_enum_value"?{message:lt??st.defaultError}:typeof st.data>"u"?{message:(at=lt??rt)!==null&&at!==void 0?at:st.defaultError}:it.code!=="invalid_type"?{message:st.defaultError}:{message:(ct=lt??tt)!==null&&ct!==void 0?ct:st.defaultError}},description:nt}}class ZodType{constructor(o){this.spa=this.safeParseAsync,this._def=o,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(o){return getParsedType(o.data)}_getOrReturnCtx(o,tt){return tt||{common:o.parent.common,data:o.data,parsedType:getParsedType(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}_processInputParams(o){return{status:new ParseStatus,ctx:{common:o.parent.common,data:o.data,parsedType:getParsedType(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}}_parseSync(o){const tt=this._parse(o);if(isAsync(tt))throw new Error("Synchronous parse encountered promise.");return tt}_parseAsync(o){const tt=this._parse(o);return Promise.resolve(tt)}parse(o,tt){const rt=this.safeParse(o,tt);if(rt.success)return rt.data;throw rt.error}safeParse(o,tt){var rt;const nt={common:{issues:[],async:(rt=tt==null?void 0:tt.async)!==null&&rt!==void 0?rt:!1,contextualErrorMap:tt==null?void 0:tt.errorMap},path:(tt==null?void 0:tt.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:getParsedType(o)},ot=this._parseSync({data:o,path:nt.path,parent:nt});return handleResult(nt,ot)}async parseAsync(o,tt){const rt=await this.safeParseAsync(o,tt);if(rt.success)return rt.data;throw rt.error}async safeParseAsync(o,tt){const rt={common:{issues:[],contextualErrorMap:tt==null?void 0:tt.errorMap,async:!0},path:(tt==null?void 0:tt.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:getParsedType(o)},nt=this._parse({data:o,path:rt.path,parent:rt}),ot=await(isAsync(nt)?nt:Promise.resolve(nt));return handleResult(rt,ot)}refine(o,tt){const rt=nt=>typeof tt=="string"||typeof tt>"u"?{message:tt}:typeof tt=="function"?tt(nt):tt;return this._refinement((nt,ot)=>{const it=o(nt),st=()=>ot.addIssue({code:ZodIssueCode.custom,...rt(nt)});return typeof Promise<"u"&&it instanceof Promise?it.then(at=>at?!0:(st(),!1)):it?!0:(st(),!1)})}refinement(o,tt){return this._refinement((rt,nt)=>o(rt)?!0:(nt.addIssue(typeof tt=="function"?tt(rt,nt):tt),!1))}_refinement(o){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:o}})}superRefine(o){return this._refinement(o)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(o){return ZodUnion.create([this,o],this._def)}and(o){return ZodIntersection.create(this,o,this._def)}transform(o){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:o}})}default(o){const tt=typeof o=="function"?o:()=>o;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:tt,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(o){const tt=typeof o=="function"?o:()=>o;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:tt,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(o){const tt=this.constructor;return new tt({...this._def,description:o})}pipe(o){return ZodPipeline.create(this,o)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(et){let o="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return et.precision?o=`${o}\\.\\d{${et.precision}}`:et.precision==null&&(o=`${o}(\\.\\d+)?`),o}function timeRegex(et){return new RegExp(`^${timeRegexSource(et)}$`)}function datetimeRegex(et){let o=`${dateRegexSource}T${timeRegexSource(et)}`;const tt=[];return tt.push(et.local?"Z?":"Z"),et.offset&&tt.push("([+-]\\d{2}:?\\d{2})"),o=`${o}(${tt.join("|")})`,new RegExp(`^${o}$`)}function isValidIP(et,o){return!!((o==="v4"||!o)&&ipv4Regex.test(et)||(o==="v6"||!o)&&ipv6Regex.test(et))}class ZodString extends ZodType{_parse(o){if(this._def.coerce&&(o.data=String(o.data)),this._getType(o)!==ZodParsedType.string){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:ot.parsedType}),INVALID}const rt=new ParseStatus;let nt;for(const ot of this._def.checks)if(ot.kind==="min")o.data.lengthot.value&&(nt=this._getOrReturnCtx(o,nt),addIssueToContext(nt,{code:ZodIssueCode.too_big,maximum:ot.value,type:"string",inclusive:!0,exact:!1,message:ot.message}),rt.dirty());else if(ot.kind==="length"){const it=o.data.length>ot.value,st=o.data.lengtho.test(nt),{validation:tt,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(rt)})}_addCheck(o){return new ZodString({...this._def,checks:[...this._def.checks,o]})}email(o){return this._addCheck({kind:"email",...errorUtil.errToObj(o)})}url(o){return this._addCheck({kind:"url",...errorUtil.errToObj(o)})}emoji(o){return this._addCheck({kind:"emoji",...errorUtil.errToObj(o)})}uuid(o){return this._addCheck({kind:"uuid",...errorUtil.errToObj(o)})}nanoid(o){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(o)})}cuid(o){return this._addCheck({kind:"cuid",...errorUtil.errToObj(o)})}cuid2(o){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(o)})}ulid(o){return this._addCheck({kind:"ulid",...errorUtil.errToObj(o)})}base64(o){return this._addCheck({kind:"base64",...errorUtil.errToObj(o)})}ip(o){return this._addCheck({kind:"ip",...errorUtil.errToObj(o)})}datetime(o){var tt,rt;return typeof o=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:o}):this._addCheck({kind:"datetime",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,offset:(tt=o==null?void 0:o.offset)!==null&&tt!==void 0?tt:!1,local:(rt=o==null?void 0:o.local)!==null&&rt!==void 0?rt:!1,...errorUtil.errToObj(o==null?void 0:o.message)})}date(o){return this._addCheck({kind:"date",message:o})}time(o){return typeof o=="string"?this._addCheck({kind:"time",precision:null,message:o}):this._addCheck({kind:"time",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,...errorUtil.errToObj(o==null?void 0:o.message)})}duration(o){return this._addCheck({kind:"duration",...errorUtil.errToObj(o)})}regex(o,tt){return this._addCheck({kind:"regex",regex:o,...errorUtil.errToObj(tt)})}includes(o,tt){return this._addCheck({kind:"includes",value:o,position:tt==null?void 0:tt.position,...errorUtil.errToObj(tt==null?void 0:tt.message)})}startsWith(o,tt){return this._addCheck({kind:"startsWith",value:o,...errorUtil.errToObj(tt)})}endsWith(o,tt){return this._addCheck({kind:"endsWith",value:o,...errorUtil.errToObj(tt)})}min(o,tt){return this._addCheck({kind:"min",value:o,...errorUtil.errToObj(tt)})}max(o,tt){return this._addCheck({kind:"max",value:o,...errorUtil.errToObj(tt)})}length(o,tt){return this._addCheck({kind:"length",value:o,...errorUtil.errToObj(tt)})}nonempty(o){return this.min(1,errorUtil.errToObj(o))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(o=>o.kind==="datetime")}get isDate(){return!!this._def.checks.find(o=>o.kind==="date")}get isTime(){return!!this._def.checks.find(o=>o.kind==="time")}get isDuration(){return!!this._def.checks.find(o=>o.kind==="duration")}get isEmail(){return!!this._def.checks.find(o=>o.kind==="email")}get isURL(){return!!this._def.checks.find(o=>o.kind==="url")}get isEmoji(){return!!this._def.checks.find(o=>o.kind==="emoji")}get isUUID(){return!!this._def.checks.find(o=>o.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(o=>o.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(o=>o.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(o=>o.kind==="cuid2")}get isULID(){return!!this._def.checks.find(o=>o.kind==="ulid")}get isIP(){return!!this._def.checks.find(o=>o.kind==="ip")}get isBase64(){return!!this._def.checks.find(o=>o.kind==="base64")}get minLength(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxLength(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.value{var o;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(o=et==null?void 0:et.coerce)!==null&&o!==void 0?o:!1,...processCreateParams(et)})};function floatSafeRemainder(et,o){const tt=(et.toString().split(".")[1]||"").length,rt=(o.toString().split(".")[1]||"").length,nt=tt>rt?tt:rt,ot=parseInt(et.toFixed(nt).replace(".","")),it=parseInt(o.toFixed(nt).replace(".",""));return ot%it/Math.pow(10,nt)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(o){if(this._def.coerce&&(o.data=Number(o.data)),this._getType(o)!==ZodParsedType.number){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:ot.parsedType}),INVALID}let rt;const nt=new ParseStatus;for(const ot of this._def.checks)ot.kind==="int"?util.isInteger(o.data)||(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:ot.message}),nt.dirty()):ot.kind==="min"?(ot.inclusive?o.dataot.value:o.data>=ot.value)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:ot.value,type:"number",inclusive:ot.inclusive,exact:!1,message:ot.message}),nt.dirty()):ot.kind==="multipleOf"?floatSafeRemainder(o.data,ot.value)!==0&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_multiple_of,multipleOf:ot.value,message:ot.message}),nt.dirty()):ot.kind==="finite"?Number.isFinite(o.data)||(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_finite,message:ot.message}),nt.dirty()):util.assertNever(ot);return{status:nt.value,value:o.data}}gte(o,tt){return this.setLimit("min",o,!0,errorUtil.toString(tt))}gt(o,tt){return this.setLimit("min",o,!1,errorUtil.toString(tt))}lte(o,tt){return this.setLimit("max",o,!0,errorUtil.toString(tt))}lt(o,tt){return this.setLimit("max",o,!1,errorUtil.toString(tt))}setLimit(o,tt,rt,nt){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:o,value:tt,inclusive:rt,message:errorUtil.toString(nt)}]})}_addCheck(o){return new ZodNumber({...this._def,checks:[...this._def.checks,o]})}int(o){return this._addCheck({kind:"int",message:errorUtil.toString(o)})}positive(o){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(o)})}multipleOf(o,tt){return this._addCheck({kind:"multipleOf",value:o,message:errorUtil.toString(tt)})}finite(o){return this._addCheck({kind:"finite",message:errorUtil.toString(o)})}safe(o){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(o)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(o)})}get minValue(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxValue(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.valueo.kind==="int"||o.kind==="multipleOf"&&util.isInteger(o.value))}get isFinite(){let o=null,tt=null;for(const rt of this._def.checks){if(rt.kind==="finite"||rt.kind==="int"||rt.kind==="multipleOf")return!0;rt.kind==="min"?(tt===null||rt.value>tt)&&(tt=rt.value):rt.kind==="max"&&(o===null||rt.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(et==null?void 0:et.coerce)||!1,...processCreateParams(et)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(o){if(this._def.coerce&&(o.data=BigInt(o.data)),this._getType(o)!==ZodParsedType.bigint){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:ot.parsedType}),INVALID}let rt;const nt=new ParseStatus;for(const ot of this._def.checks)ot.kind==="min"?(ot.inclusive?o.dataot.value:o.data>=ot.value)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.too_big,type:"bigint",maximum:ot.value,inclusive:ot.inclusive,message:ot.message}),nt.dirty()):ot.kind==="multipleOf"?o.data%ot.value!==BigInt(0)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_multiple_of,multipleOf:ot.value,message:ot.message}),nt.dirty()):util.assertNever(ot);return{status:nt.value,value:o.data}}gte(o,tt){return this.setLimit("min",o,!0,errorUtil.toString(tt))}gt(o,tt){return this.setLimit("min",o,!1,errorUtil.toString(tt))}lte(o,tt){return this.setLimit("max",o,!0,errorUtil.toString(tt))}lt(o,tt){return this.setLimit("max",o,!1,errorUtil.toString(tt))}setLimit(o,tt,rt,nt){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:o,value:tt,inclusive:rt,message:errorUtil.toString(nt)}]})}_addCheck(o){return new ZodBigInt({...this._def,checks:[...this._def.checks,o]})}positive(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(o)})}multipleOf(o,tt){return this._addCheck({kind:"multipleOf",value:o,message:errorUtil.toString(tt)})}get minValue(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxValue(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.value{var o;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(o=et==null?void 0:et.coerce)!==null&&o!==void 0?o:!1,...processCreateParams(et)})};class ZodBoolean extends ZodType{_parse(o){if(this._def.coerce&&(o.data=!!o.data),this._getType(o)!==ZodParsedType.boolean){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodBoolean.create=et=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(et==null?void 0:et.coerce)||!1,...processCreateParams(et)});class ZodDate extends ZodType{_parse(o){if(this._def.coerce&&(o.data=new Date(o.data)),this._getType(o)!==ZodParsedType.date){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:ot.parsedType}),INVALID}if(isNaN(o.data.getTime())){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_date}),INVALID}const rt=new ParseStatus;let nt;for(const ot of this._def.checks)ot.kind==="min"?o.data.getTime()ot.value&&(nt=this._getOrReturnCtx(o,nt),addIssueToContext(nt,{code:ZodIssueCode.too_big,message:ot.message,inclusive:!0,exact:!1,maximum:ot.value,type:"date"}),rt.dirty()):util.assertNever(ot);return{status:rt.value,value:new Date(o.data.getTime())}}_addCheck(o){return new ZodDate({...this._def,checks:[...this._def.checks,o]})}min(o,tt){return this._addCheck({kind:"min",value:o.getTime(),message:errorUtil.toString(tt)})}max(o,tt){return this._addCheck({kind:"max",value:o.getTime(),message:errorUtil.toString(tt)})}get minDate(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o!=null?new Date(o):null}get maxDate(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.valuenew ZodDate({checks:[],coerce:(et==null?void 0:et.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(et)});class ZodSymbol extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.symbol){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodSymbol.create=et=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(et)});class ZodUndefined extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.undefined){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodUndefined.create=et=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(et)});class ZodNull extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.null){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodNull.create=et=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(et)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(o){return OK(o.data)}}ZodAny.create=et=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(et)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(o){return OK(o.data)}}ZodUnknown.create=et=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(et)});class ZodNever extends ZodType{_parse(o){const tt=this._getOrReturnCtx(o);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:tt.parsedType}),INVALID}}ZodNever.create=et=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(et)});class ZodVoid extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.undefined){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodVoid.create=et=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(et)});class ZodArray extends ZodType{_parse(o){const{ctx:tt,status:rt}=this._processInputParams(o),nt=this._def;if(tt.parsedType!==ZodParsedType.array)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:tt.parsedType}),INVALID;if(nt.exactLength!==null){const it=tt.data.length>nt.exactLength.value,st=tt.data.lengthnt.maxLength.value&&(addIssueToContext(tt,{code:ZodIssueCode.too_big,maximum:nt.maxLength.value,type:"array",inclusive:!0,exact:!1,message:nt.maxLength.message}),rt.dirty()),tt.common.async)return Promise.all([...tt.data].map((it,st)=>nt.type._parseAsync(new ParseInputLazyPath(tt,it,tt.path,st)))).then(it=>ParseStatus.mergeArray(rt,it));const ot=[...tt.data].map((it,st)=>nt.type._parseSync(new ParseInputLazyPath(tt,it,tt.path,st)));return ParseStatus.mergeArray(rt,ot)}get element(){return this._def.type}min(o,tt){return new ZodArray({...this._def,minLength:{value:o,message:errorUtil.toString(tt)}})}max(o,tt){return new ZodArray({...this._def,maxLength:{value:o,message:errorUtil.toString(tt)}})}length(o,tt){return new ZodArray({...this._def,exactLength:{value:o,message:errorUtil.toString(tt)}})}nonempty(o){return this.min(1,o)}}ZodArray.create=(et,o)=>new ZodArray({type:et,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(o)});function deepPartialify(et){if(et instanceof ZodObject){const o={};for(const tt in et.shape){const rt=et.shape[tt];o[tt]=ZodOptional.create(deepPartialify(rt))}return new ZodObject({...et._def,shape:()=>o})}else return et instanceof ZodArray?new ZodArray({...et._def,type:deepPartialify(et.element)}):et instanceof ZodOptional?ZodOptional.create(deepPartialify(et.unwrap())):et instanceof ZodNullable?ZodNullable.create(deepPartialify(et.unwrap())):et instanceof ZodTuple?ZodTuple.create(et.items.map(o=>deepPartialify(o))):et}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const o=this._def.shape(),tt=util.objectKeys(o);return this._cached={shape:o,keys:tt}}_parse(o){if(this._getType(o)!==ZodParsedType.object){const ct=this._getOrReturnCtx(o);return addIssueToContext(ct,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ct.parsedType}),INVALID}const{status:rt,ctx:nt}=this._processInputParams(o),{shape:ot,keys:it}=this._getCached(),st=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const ct in nt.data)it.includes(ct)||st.push(ct);const at=[];for(const ct of it){const lt=ot[ct],dt=nt.data[ct];at.push({key:{status:"valid",value:ct},value:lt._parse(new ParseInputLazyPath(nt,dt,nt.path,ct)),alwaysSet:ct in nt.data})}if(this._def.catchall instanceof ZodNever){const ct=this._def.unknownKeys;if(ct==="passthrough")for(const lt of st)at.push({key:{status:"valid",value:lt},value:{status:"valid",value:nt.data[lt]}});else if(ct==="strict")st.length>0&&(addIssueToContext(nt,{code:ZodIssueCode.unrecognized_keys,keys:st}),rt.dirty());else if(ct!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ct=this._def.catchall;for(const lt of st){const dt=nt.data[lt];at.push({key:{status:"valid",value:lt},value:ct._parse(new ParseInputLazyPath(nt,dt,nt.path,lt)),alwaysSet:lt in nt.data})}}return nt.common.async?Promise.resolve().then(async()=>{const ct=[];for(const lt of at){const dt=await lt.key,ht=await lt.value;ct.push({key:dt,value:ht,alwaysSet:lt.alwaysSet})}return ct}).then(ct=>ParseStatus.mergeObjectSync(rt,ct)):ParseStatus.mergeObjectSync(rt,at)}get shape(){return this._def.shape()}strict(o){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...o!==void 0?{errorMap:(tt,rt)=>{var nt,ot,it,st;const at=(it=(ot=(nt=this._def).errorMap)===null||ot===void 0?void 0:ot.call(nt,tt,rt).message)!==null&&it!==void 0?it:rt.defaultError;return tt.code==="unrecognized_keys"?{message:(st=errorUtil.errToObj(o).message)!==null&&st!==void 0?st:at}:{message:at}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(o){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...o})})}merge(o){return new ZodObject({unknownKeys:o._def.unknownKeys,catchall:o._def.catchall,shape:()=>({...this._def.shape(),...o._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(o,tt){return this.augment({[o]:tt})}catchall(o){return new ZodObject({...this._def,catchall:o})}pick(o){const tt={};return util.objectKeys(o).forEach(rt=>{o[rt]&&this.shape[rt]&&(tt[rt]=this.shape[rt])}),new ZodObject({...this._def,shape:()=>tt})}omit(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{o[rt]||(tt[rt]=this.shape[rt])}),new ZodObject({...this._def,shape:()=>tt})}deepPartial(){return deepPartialify(this)}partial(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{const nt=this.shape[rt];o&&!o[rt]?tt[rt]=nt:tt[rt]=nt.optional()}),new ZodObject({...this._def,shape:()=>tt})}required(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{if(o&&!o[rt])tt[rt]=this.shape[rt];else{let ot=this.shape[rt];for(;ot instanceof ZodOptional;)ot=ot._def.innerType;tt[rt]=ot}}),new ZodObject({...this._def,shape:()=>tt})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(et,o)=>new ZodObject({shape:()=>et,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});ZodObject.strictCreate=(et,o)=>new ZodObject({shape:()=>et,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});ZodObject.lazycreate=(et,o)=>new ZodObject({shape:et,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});class ZodUnion extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt=this._def.options;function nt(ot){for(const st of ot)if(st.result.status==="valid")return st.result;for(const st of ot)if(st.result.status==="dirty")return tt.common.issues.push(...st.ctx.common.issues),st.result;const it=ot.map(st=>new ZodError(st.ctx.common.issues));return addIssueToContext(tt,{code:ZodIssueCode.invalid_union,unionErrors:it}),INVALID}if(tt.common.async)return Promise.all(rt.map(async ot=>{const it={...tt,common:{...tt.common,issues:[]},parent:null};return{result:await ot._parseAsync({data:tt.data,path:tt.path,parent:it}),ctx:it}})).then(nt);{let ot;const it=[];for(const at of rt){const ct={...tt,common:{...tt.common,issues:[]},parent:null},lt=at._parseSync({data:tt.data,path:tt.path,parent:ct});if(lt.status==="valid")return lt;lt.status==="dirty"&&!ot&&(ot={result:lt,ctx:ct}),ct.common.issues.length&&it.push(ct.common.issues)}if(ot)return tt.common.issues.push(...ot.ctx.common.issues),ot.result;const st=it.map(at=>new ZodError(at));return addIssueToContext(tt,{code:ZodIssueCode.invalid_union,unionErrors:st}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(et,o)=>new ZodUnion({options:et,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(o)});const getDiscriminator=et=>et instanceof ZodLazy?getDiscriminator(et.schema):et instanceof ZodEffects?getDiscriminator(et.innerType()):et instanceof ZodLiteral?[et.value]:et instanceof ZodEnum?et.options:et instanceof ZodNativeEnum?util.objectValues(et.enum):et instanceof ZodDefault?getDiscriminator(et._def.innerType):et instanceof ZodUndefined?[void 0]:et instanceof ZodNull?[null]:et instanceof ZodOptional?[void 0,...getDiscriminator(et.unwrap())]:et instanceof ZodNullable?[null,...getDiscriminator(et.unwrap())]:et instanceof ZodBranded||et instanceof ZodReadonly?getDiscriminator(et.unwrap()):et instanceof ZodCatch?getDiscriminator(et._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.object)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:tt.parsedType}),INVALID;const rt=this.discriminator,nt=tt.data[rt],ot=this.optionsMap.get(nt);return ot?tt.common.async?ot._parseAsync({data:tt.data,path:tt.path,parent:tt}):ot._parseSync({data:tt.data,path:tt.path,parent:tt}):(addIssueToContext(tt,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[rt]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(o,tt,rt){const nt=new Map;for(const ot of tt){const it=getDiscriminator(ot.shape[o]);if(!it.length)throw new Error(`A discriminator value for key \`${o}\` could not be extracted from all schema options`);for(const st of it){if(nt.has(st))throw new Error(`Discriminator property ${String(o)} has duplicate value ${String(st)}`);nt.set(st,ot)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:o,options:tt,optionsMap:nt,...processCreateParams(rt)})}}function mergeValues(et,o){const tt=getParsedType(et),rt=getParsedType(o);if(et===o)return{valid:!0,data:et};if(tt===ZodParsedType.object&&rt===ZodParsedType.object){const nt=util.objectKeys(o),ot=util.objectKeys(et).filter(st=>nt.indexOf(st)!==-1),it={...et,...o};for(const st of ot){const at=mergeValues(et[st],o[st]);if(!at.valid)return{valid:!1};it[st]=at.data}return{valid:!0,data:it}}else if(tt===ZodParsedType.array&&rt===ZodParsedType.array){if(et.length!==o.length)return{valid:!1};const nt=[];for(let ot=0;ot{if(isAborted(ot)||isAborted(it))return INVALID;const st=mergeValues(ot.value,it.value);return st.valid?((isDirty(ot)||isDirty(it))&&tt.dirty(),{status:tt.value,value:st.data}):(addIssueToContext(rt,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return rt.common.async?Promise.all([this._def.left._parseAsync({data:rt.data,path:rt.path,parent:rt}),this._def.right._parseAsync({data:rt.data,path:rt.path,parent:rt})]).then(([ot,it])=>nt(ot,it)):nt(this._def.left._parseSync({data:rt.data,path:rt.path,parent:rt}),this._def.right._parseSync({data:rt.data,path:rt.path,parent:rt}))}}ZodIntersection.create=(et,o,tt)=>new ZodIntersection({left:et,right:o,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(tt)});class ZodTuple extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.array)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:rt.parsedType}),INVALID;if(rt.data.lengththis._def.items.length&&(addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tt.dirty());const ot=[...rt.data].map((it,st)=>{const at=this._def.items[st]||this._def.rest;return at?at._parse(new ParseInputLazyPath(rt,it,rt.path,st)):null}).filter(it=>!!it);return rt.common.async?Promise.all(ot).then(it=>ParseStatus.mergeArray(tt,it)):ParseStatus.mergeArray(tt,ot)}get items(){return this._def.items}rest(o){return new ZodTuple({...this._def,rest:o})}}ZodTuple.create=(et,o)=>{if(!Array.isArray(et))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:et,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(o)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.object)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:rt.parsedType}),INVALID;const nt=[],ot=this._def.keyType,it=this._def.valueType;for(const st in rt.data)nt.push({key:ot._parse(new ParseInputLazyPath(rt,st,rt.path,st)),value:it._parse(new ParseInputLazyPath(rt,rt.data[st],rt.path,st)),alwaysSet:st in rt.data});return rt.common.async?ParseStatus.mergeObjectAsync(tt,nt):ParseStatus.mergeObjectSync(tt,nt)}get element(){return this._def.valueType}static create(o,tt,rt){return tt instanceof ZodType?new ZodRecord({keyType:o,valueType:tt,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(rt)}):new ZodRecord({keyType:ZodString.create(),valueType:o,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(tt)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.map)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:rt.parsedType}),INVALID;const nt=this._def.keyType,ot=this._def.valueType,it=[...rt.data.entries()].map(([st,at],ct)=>({key:nt._parse(new ParseInputLazyPath(rt,st,rt.path,[ct,"key"])),value:ot._parse(new ParseInputLazyPath(rt,at,rt.path,[ct,"value"]))}));if(rt.common.async){const st=new Map;return Promise.resolve().then(async()=>{for(const at of it){const ct=await at.key,lt=await at.value;if(ct.status==="aborted"||lt.status==="aborted")return INVALID;(ct.status==="dirty"||lt.status==="dirty")&&tt.dirty(),st.set(ct.value,lt.value)}return{status:tt.value,value:st}})}else{const st=new Map;for(const at of it){const ct=at.key,lt=at.value;if(ct.status==="aborted"||lt.status==="aborted")return INVALID;(ct.status==="dirty"||lt.status==="dirty")&&tt.dirty(),st.set(ct.value,lt.value)}return{status:tt.value,value:st}}}}ZodMap.create=(et,o,tt)=>new ZodMap({valueType:o,keyType:et,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(tt)});class ZodSet extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.set)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:rt.parsedType}),INVALID;const nt=this._def;nt.minSize!==null&&rt.data.sizent.maxSize.value&&(addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:nt.maxSize.value,type:"set",inclusive:!0,exact:!1,message:nt.maxSize.message}),tt.dirty());const ot=this._def.valueType;function it(at){const ct=new Set;for(const lt of at){if(lt.status==="aborted")return INVALID;lt.status==="dirty"&&tt.dirty(),ct.add(lt.value)}return{status:tt.value,value:ct}}const st=[...rt.data.values()].map((at,ct)=>ot._parse(new ParseInputLazyPath(rt,at,rt.path,ct)));return rt.common.async?Promise.all(st).then(at=>it(at)):it(st)}min(o,tt){return new ZodSet({...this._def,minSize:{value:o,message:errorUtil.toString(tt)}})}max(o,tt){return new ZodSet({...this._def,maxSize:{value:o,message:errorUtil.toString(tt)}})}size(o,tt){return this.min(o,tt).max(o,tt)}nonempty(o){return this.min(1,o)}}ZodSet.create=(et,o)=>new ZodSet({valueType:et,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(o)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.function)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:tt.parsedType}),INVALID;function rt(st,at){return makeIssue({data:st,path:tt.path,errorMaps:[tt.common.contextualErrorMap,tt.schemaErrorMap,getErrorMap(),errorMap].filter(ct=>!!ct),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:at}})}function nt(st,at){return makeIssue({data:st,path:tt.path,errorMaps:[tt.common.contextualErrorMap,tt.schemaErrorMap,getErrorMap(),errorMap].filter(ct=>!!ct),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:at}})}const ot={errorMap:tt.common.contextualErrorMap},it=tt.data;if(this._def.returns instanceof ZodPromise){const st=this;return OK(async function(...at){const ct=new ZodError([]),lt=await st._def.args.parseAsync(at,ot).catch(mt=>{throw ct.addIssue(rt(at,mt)),ct}),dt=await Reflect.apply(it,this,lt);return await st._def.returns._def.type.parseAsync(dt,ot).catch(mt=>{throw ct.addIssue(nt(dt,mt)),ct})})}else{const st=this;return OK(function(...at){const ct=st._def.args.safeParse(at,ot);if(!ct.success)throw new ZodError([rt(at,ct.error)]);const lt=Reflect.apply(it,this,ct.data),dt=st._def.returns.safeParse(lt,ot);if(!dt.success)throw new ZodError([nt(lt,dt.error)]);return dt.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...o){return new ZodFunction({...this._def,args:ZodTuple.create(o).rest(ZodUnknown.create())})}returns(o){return new ZodFunction({...this._def,returns:o})}implement(o){return this.parse(o)}strictImplement(o){return this.parse(o)}static create(o,tt,rt){return new ZodFunction({args:o||ZodTuple.create([]).rest(ZodUnknown.create()),returns:tt||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(rt)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(o){const{ctx:tt}=this._processInputParams(o);return this._def.getter()._parse({data:tt.data,path:tt.path,parent:tt})}}ZodLazy.create=(et,o)=>new ZodLazy({getter:et,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(o)});class ZodLiteral extends ZodType{_parse(o){if(o.data!==this._def.value){const tt=this._getOrReturnCtx(o);return addIssueToContext(tt,{received:tt.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:o.data}}get value(){return this._def.value}}ZodLiteral.create=(et,o)=>new ZodLiteral({value:et,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(o)});function createZodEnum(et,o){return new ZodEnum({values:et,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(o)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(o){if(typeof o.data!="string"){const tt=this._getOrReturnCtx(o),rt=this._def.values;return addIssueToContext(tt,{expected:util.joinValues(rt),received:tt.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(o.data)){const tt=this._getOrReturnCtx(o),rt=this._def.values;return addIssueToContext(tt,{received:tt.data,code:ZodIssueCode.invalid_enum_value,options:rt}),INVALID}return OK(o.data)}get options(){return this._def.values}get enum(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}get Values(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}get Enum(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}extract(o,tt=this._def){return ZodEnum.create(o,{...this._def,...tt})}exclude(o,tt=this._def){return ZodEnum.create(this.options.filter(rt=>!o.includes(rt)),{...this._def,...tt})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(o){const tt=util.getValidEnumValues(this._def.values),rt=this._getOrReturnCtx(o);if(rt.parsedType!==ZodParsedType.string&&rt.parsedType!==ZodParsedType.number){const nt=util.objectValues(tt);return addIssueToContext(rt,{expected:util.joinValues(nt),received:rt.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(o.data)){const nt=util.objectValues(tt);return addIssueToContext(rt,{received:rt.data,code:ZodIssueCode.invalid_enum_value,options:nt}),INVALID}return OK(o.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(et,o)=>new ZodNativeEnum({values:et,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(o)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.promise&&tt.common.async===!1)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:tt.parsedType}),INVALID;const rt=tt.parsedType===ZodParsedType.promise?tt.data:Promise.resolve(tt.data);return OK(rt.then(nt=>this._def.type.parseAsync(nt,{path:tt.path,errorMap:tt.common.contextualErrorMap})))}}ZodPromise.create=(et,o)=>new ZodPromise({type:et,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(o)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o),nt=this._def.effect||null,ot={addIssue:it=>{addIssueToContext(rt,it),it.fatal?tt.abort():tt.dirty()},get path(){return rt.path}};if(ot.addIssue=ot.addIssue.bind(ot),nt.type==="preprocess"){const it=nt.transform(rt.data,ot);if(rt.common.async)return Promise.resolve(it).then(async st=>{if(tt.value==="aborted")return INVALID;const at=await this._def.schema._parseAsync({data:st,path:rt.path,parent:rt});return at.status==="aborted"?INVALID:at.status==="dirty"||tt.value==="dirty"?DIRTY(at.value):at});{if(tt.value==="aborted")return INVALID;const st=this._def.schema._parseSync({data:it,path:rt.path,parent:rt});return st.status==="aborted"?INVALID:st.status==="dirty"||tt.value==="dirty"?DIRTY(st.value):st}}if(nt.type==="refinement"){const it=st=>{const at=nt.refinement(st,ot);if(rt.common.async)return Promise.resolve(at);if(at instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return st};if(rt.common.async===!1){const st=this._def.schema._parseSync({data:rt.data,path:rt.path,parent:rt});return st.status==="aborted"?INVALID:(st.status==="dirty"&&tt.dirty(),it(st.value),{status:tt.value,value:st.value})}else return this._def.schema._parseAsync({data:rt.data,path:rt.path,parent:rt}).then(st=>st.status==="aborted"?INVALID:(st.status==="dirty"&&tt.dirty(),it(st.value).then(()=>({status:tt.value,value:st.value}))))}if(nt.type==="transform")if(rt.common.async===!1){const it=this._def.schema._parseSync({data:rt.data,path:rt.path,parent:rt});if(!isValid(it))return it;const st=nt.transform(it.value,ot);if(st instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:tt.value,value:st}}else return this._def.schema._parseAsync({data:rt.data,path:rt.path,parent:rt}).then(it=>isValid(it)?Promise.resolve(nt.transform(it.value,ot)).then(st=>({status:tt.value,value:st})):it);util.assertNever(nt)}}ZodEffects.create=(et,o,tt)=>new ZodEffects({schema:et,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:o,...processCreateParams(tt)});ZodEffects.createWithPreprocess=(et,o,tt)=>new ZodEffects({schema:o,effect:{type:"preprocess",transform:et},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(tt)});class ZodOptional extends ZodType{_parse(o){return this._getType(o)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}ZodOptional.create=(et,o)=>new ZodOptional({innerType:et,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(o)});class ZodNullable extends ZodType{_parse(o){return this._getType(o)===ZodParsedType.null?OK(null):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}ZodNullable.create=(et,o)=>new ZodNullable({innerType:et,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(o)});class ZodDefault extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o);let rt=tt.data;return tt.parsedType===ZodParsedType.undefined&&(rt=this._def.defaultValue()),this._def.innerType._parse({data:rt,path:tt.path,parent:tt})}removeDefault(){return this._def.innerType}}ZodDefault.create=(et,o)=>new ZodDefault({innerType:et,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof o.default=="function"?o.default:()=>o.default,...processCreateParams(o)});class ZodCatch extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt={...tt,common:{...tt.common,issues:[]}},nt=this._def.innerType._parse({data:rt.data,path:rt.path,parent:{...rt}});return isAsync(nt)?nt.then(ot=>({status:"valid",value:ot.status==="valid"?ot.value:this._def.catchValue({get error(){return new ZodError(rt.common.issues)},input:rt.data})})):{status:"valid",value:nt.status==="valid"?nt.value:this._def.catchValue({get error(){return new ZodError(rt.common.issues)},input:rt.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(et,o)=>new ZodCatch({innerType:et,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof o.catch=="function"?o.catch:()=>o.catch,...processCreateParams(o)});class ZodNaN extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.nan){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:rt.parsedType}),INVALID}return{status:"valid",value:o.data}}}ZodNaN.create=et=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(et)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt=tt.data;return this._def.type._parse({data:rt,path:tt.path,parent:tt})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.common.async)return(async()=>{const ot=await this._def.in._parseAsync({data:rt.data,path:rt.path,parent:rt});return ot.status==="aborted"?INVALID:ot.status==="dirty"?(tt.dirty(),DIRTY(ot.value)):this._def.out._parseAsync({data:ot.value,path:rt.path,parent:rt})})();{const nt=this._def.in._parseSync({data:rt.data,path:rt.path,parent:rt});return nt.status==="aborted"?INVALID:nt.status==="dirty"?(tt.dirty(),{status:"dirty",value:nt.value}):this._def.out._parseSync({data:nt.value,path:rt.path,parent:rt})}}static create(o,tt){return new ZodPipeline({in:o,out:tt,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(o){const tt=this._def.innerType._parse(o),rt=nt=>(isValid(nt)&&(nt.value=Object.freeze(nt.value)),nt);return isAsync(tt)?tt.then(nt=>rt(nt)):rt(tt)}unwrap(){return this._def.innerType}}ZodReadonly.create=(et,o)=>new ZodReadonly({innerType:et,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(o)});function custom(et,o={},tt){return et?ZodAny.create().superRefine((rt,nt)=>{var ot,it;if(!et(rt)){const st=typeof o=="function"?o(rt):typeof o=="string"?{message:o}:o,at=(it=(ot=st.fatal)!==null&&ot!==void 0?ot:tt)!==null&&it!==void 0?it:!0,ct=typeof st=="string"?{message:st}:st;nt.addIssue({code:"custom",...ct,fatal:at})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(et){et.ZodString="ZodString",et.ZodNumber="ZodNumber",et.ZodNaN="ZodNaN",et.ZodBigInt="ZodBigInt",et.ZodBoolean="ZodBoolean",et.ZodDate="ZodDate",et.ZodSymbol="ZodSymbol",et.ZodUndefined="ZodUndefined",et.ZodNull="ZodNull",et.ZodAny="ZodAny",et.ZodUnknown="ZodUnknown",et.ZodNever="ZodNever",et.ZodVoid="ZodVoid",et.ZodArray="ZodArray",et.ZodObject="ZodObject",et.ZodUnion="ZodUnion",et.ZodDiscriminatedUnion="ZodDiscriminatedUnion",et.ZodIntersection="ZodIntersection",et.ZodTuple="ZodTuple",et.ZodRecord="ZodRecord",et.ZodMap="ZodMap",et.ZodSet="ZodSet",et.ZodFunction="ZodFunction",et.ZodLazy="ZodLazy",et.ZodLiteral="ZodLiteral",et.ZodEnum="ZodEnum",et.ZodEffects="ZodEffects",et.ZodNativeEnum="ZodNativeEnum",et.ZodOptional="ZodOptional",et.ZodNullable="ZodNullable",et.ZodDefault="ZodDefault",et.ZodCatch="ZodCatch",et.ZodPromise="ZodPromise",et.ZodBranded="ZodBranded",et.ZodPipeline="ZodPipeline",et.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(et,o={message:`Input not instance of ${et.name}`})=>custom(tt=>tt instanceof et,o),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:et=>ZodString.create({...et,coerce:!0}),number:et=>ZodNumber.create({...et,coerce:!0}),boolean:et=>ZodBoolean.create({...et,coerce:!0}),bigint:et=>ZodBigInt.create({...et,coerce:!0}),date:et=>ZodDate.create({...et,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError}),define_process_env_default={};function createEnv(et){const o=et.runtimeEnvStrict??et.runtimeEnv??define_process_env_default;if(et.emptyStringAsUndefined??!1)for(const[Ct,St]of Object.entries(o))St===""&&delete o[Ct];if(!!et.skipValidation)return o;const nt=typeof et.client=="object"?et.client:{},ot=typeof et.server=="object"?et.server:{},it=typeof et.shared=="object"?et.shared:{},st=z.object(nt),at=z.object(ot),ct=z.object(it),lt=et.isServer??typeof window>"u",dt=st.merge(ct),ht=at.merge(ct).merge(st),mt=lt?ht.safeParse(o):dt.safeParse(o),ft=et.onValidationError??(Ct=>{throw console.error("❌ Invalid environment variables:",Ct.flatten().fieldErrors),new Error("Invalid environment variables")}),pt=et.onInvalidAccess??(Ct=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(mt.success===!1)return ft(mt.error);const gt=Ct=>et.clientPrefix?!Ct.startsWith(et.clientPrefix)&&!(Ct in ct.shape):!0,yt=Ct=>lt||!gt(Ct),bt=Ct=>Ct==="__esModule"||Ct==="$$typeof",xt=(et.extends??[]).reduce((Ct,St)=>Object.assign(Ct,St),{}),vt=Object.assign(mt.data,xt);return new Proxy(vt,{get(Ct,St){if(typeof St=="string"&&!bt(St))return yt(St)?Reflect.get(Ct,St):pt(St)}})}const __vite_import_meta_env__={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},env=createEnv({clientPrefix:"VITE_",client:{VITE_WALLETCONNECT_PROJECT_ID:z.string().min(1)},runtimeEnv:__vite_import_meta_env__}),config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:env.VITE_WALLETCONNECT_PROJECT_ID,chains:[mainnet],transports:{[mainnet.id]:http()}})),queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BytesSizeMismatchError as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,stringToHex as a,bytesToHex$3 as b,concat$6 as c,commonjsGlobal as d,encodeAbiParameters as e,encodeFunctionData as f,getAugmentedNamespace as g,getDefaultExportFromCjs as h,isAddress as i,browserExports as j,keccak256$1 as k,tslib_es6$1 as l,buffer as m,numberToHex as n,allocUnsafe$h as o,BASES$1 as p,fromString$2 as q,detect as r,size$2 as s,toHex as t,__viteBrowserExternal$1 as u,BaseError$3 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; +`},nt),ot}function remarkRehype(et,o){return et&&"run"in et?async function(tt,rt){const nt=toHast(tt,{file:rt,...o});await et.run(nt,rt)}:function(tt,rt){return toHast(tt,{file:rt,...et||o})}}function bail(et){if(et)throw et}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function et(o){return typeof Array.isArray=="function"?Array.isArray(o):toStr.call(o)==="[object Array]"},isPlainObject$1=function et(o){if(!o||toStr.call(o)!=="[object Object]")return!1;var tt=hasOwn.call(o,"constructor"),rt=o.constructor&&o.constructor.prototype&&hasOwn.call(o.constructor.prototype,"isPrototypeOf");if(o.constructor&&!tt&&!rt)return!1;var nt;for(nt in o);return typeof nt>"u"||hasOwn.call(o,nt)},setProperty=function et(o,tt){defineProperty&&tt.name==="__proto__"?defineProperty(o,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):o[tt.name]=tt.newValue},getProperty=function et(o,tt){if(tt==="__proto__")if(hasOwn.call(o,tt)){if(gOPD)return gOPD(o,tt).value}else return;return o[tt]},extend=function et(){var o,tt,rt,nt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(nt);try{at=et.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return nt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,nt):at instanceof Error?nt(at):ot(at))}function nt(it,...st){tt||(tt=!0,o(it,...st))}function ot(it){nt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(et,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(et);let tt=0,rt=-1,nt=et.length,ot;if(o===void 0||o.length===0||o.length>et.length){for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else rt<0&&(ot=!0,rt=nt+1);return rt<0?"":et.slice(tt,rt)}if(o===et)return"";let it=-1,st=o.length-1;for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else it<0&&(ot=!0,it=nt+1),st>-1&&(et.codePointAt(nt)===o.codePointAt(st--)?st<0&&(rt=nt):(st=-1,rt=it));return tt===rt?rt=it:rt<0&&(rt=et.length),et.slice(tt,rt)}function dirname(et){if(assertPath$1(et),et.length===0)return".";let o=-1,tt=et.length,rt;for(;--tt;)if(et.codePointAt(tt)===47){if(rt){o=tt;break}}else rt||(rt=!0);return o<0?et.codePointAt(0)===47?"/":".":o===1&&et.codePointAt(0)===47?"//":et.slice(0,o)}function extname(et){assertPath$1(et);let o=et.length,tt=-1,rt=0,nt=-1,ot=0,it;for(;o--;){const st=et.codePointAt(o);if(st===47){if(it){rt=o+1;break}continue}tt<0&&(it=!0,tt=o+1),st===46?nt<0?nt=o:ot!==1&&(ot=1):nt>-1&&(ot=-1)}return nt<0||tt<0||ot===0||ot===1&&nt===tt-1&&nt===rt+1?"":et.slice(nt,tt)}function join(...et){let o=-1,tt;for(;++o0&&et.codePointAt(et.length-1)===47&&(tt+="/"),o?"/"+tt:tt}function normalizeString(et,o){let tt="",rt=0,nt=-1,ot=0,it=-1,st,at;for(;++it<=et.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",rt=0):(tt=tt.slice(0,at),rt=tt.length-1-tt.lastIndexOf("/")),nt=it,ot=0;continue}}else if(tt.length>0){tt="",rt=0,nt=it,ot=0;continue}}o&&(tt=tt.length>0?tt+"/..":"..",rt=2)}else tt.length>0?tt+="/"+et.slice(nt+1,it):tt=et.slice(nt+1,it),rt=it-nt-1;nt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(et){if(typeof et!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(et))}const minproc={cwd};function cwd(){return"/"}function isUrl(et){return!!(et!==null&&typeof et=="object"&&"href"in et&&et.href&&"protocol"in et&&et.protocol&&et.auth===void 0)}function urlToPath(et){if(typeof et=="string")et=new URL(et);else if(!isUrl(et)){const o=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+et+"`");throw o.code="ERR_INVALID_ARG_TYPE",o}if(et.protocol!=="file:"){const o=new TypeError("The URL must be of scheme file");throw o.code="ERR_INVALID_URL_SCHEME",o}return getPathFromURLPosix(et)}function getPathFromURLPosix(et){if(et.hostname!==""){const rt=new TypeError('File URL host must be "localhost" or empty on darwin');throw rt.code="ERR_INVALID_FILE_URL_HOST",rt}const o=et.pathname;let tt=-1;for(;++tt0){let[mt,...ft]=lt;const pt=rt[ht][1];isPlainObject(pt)&&isPlainObject(mt)&&(mt=extend$1(!0,pt,mt)),rt[ht]=[ct,mt,...ft]}}}}const unified=new Processor().freeze();function assertParser(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `parser`")}function assertCompiler(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `compiler`")}function assertUnfrozen(et,o){if(o)throw new Error("Cannot call `"+et+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(et){if(!isPlainObject(et)||typeof et.type!="string")throw new TypeError("Expected node, got `"+et+"`")}function assertDone(et,o,tt){if(!tt)throw new Error("`"+et+"` finished async. Use `"+o+"` instead")}function vfile(et){return looksLikeAVFile(et)?et:new VFile(et)}function looksLikeAVFile(et){return!!(et&&typeof et=="object"&&"message"in et&&"messages"in et)}function looksLikeAValue(et){return typeof et=="string"||isUint8Array(et)}function isUint8Array(et){return!!(et&&typeof et=="object"&&"byteLength"in et&&"byteOffset"in et)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(et){const o=et.allowedElements,tt=et.allowElement,rt=et.children||"",nt=et.className,ot=et.components,it=et.disallowedElements,st=et.rehypePlugins||emptyPlugins,at=et.remarkPlugins||emptyPlugins,ct=et.remarkRehypeOptions?{...et.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=et.skipHtml,dt=et.unwrapDisallowed,ht=et.urlTransform||defaultUrlTransform,mt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),ft=new VFile;typeof rt=="string"&&(ft.value=rt);for(const bt of deprecations)Object.hasOwn(et,bt.from)&&(""+bt.from+(bt.to?"use `"+bt.to+"` instead":"remove it")+changelog+bt.id,void 0);const pt=mt.parse(ft);let gt=mt.runSync(pt,ft);return nt&&(gt={type:"element",tagName:"div",properties:{className:nt},children:gt.type==="root"?gt.children:[gt]}),visit(gt,yt),toJsxRuntime(gt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function yt(bt,xt,vt){if(bt.type==="raw"&&vt&&typeof xt=="number")return lt?vt.children.splice(xt,1):vt.children[xt]={type:"text",value:bt.value},xt;if(bt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(bt.properties,Et)){const Ct=bt.properties[Et],St=urlAttributes[Et];(St===null||St.includes(bt.tagName))&&(bt.properties[Et]=ht(String(Ct||""),Et,bt))}}if(bt.type==="element"){let Et=o?!o.includes(bt.tagName):it?it.includes(bt.tagName):!1;if(!Et&&tt&&typeof xt=="number"&&(Et=!tt(bt,xt,vt)),Et&&vt&&typeof xt=="number")return dt&&bt.children?vt.children.splice(xt,1,...bt.children):vt.children.splice(xt,1),xt}}}function defaultUrlTransform(et){const o=et.indexOf(":"),tt=et.indexOf("?"),rt=et.indexOf("#"),nt=et.indexOf("/");return o<0||nt>-1&&o>nt||tt>-1&&o>tt||rt>-1&&o>rt||safeProtocol.test(et.slice(0,o))?et:""}const PrivacyPolicyOptIn=({onOptIn:et})=>{const[o,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>et(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>et(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:o,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[et,o]=reactExports.useState(!1);reactExports.useEffect(()=>{const rt=localStorage.getItem("privacyPolicyOptIn");rt!==null&&o(rt==="true")},[]);const tt=()=>{const rt=!et;o(rt),localStorage.setItem("privacyPolicyOptIn",rt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",et?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:et?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const{chainUUID:rt,blockUUID:nt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=et.find(ct=>ct.chainUUID===rt&&ct.blockUUID===nt);at&&it(at)},[et,rt,nt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:et,onSuccess:o})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})};function App(){const[et,o]=reactExports.useState(!1),[tt,rt]=reactExports.useState([]),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"}),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const gt=localStorage.getItem("telemetryOptIn");gt!==null&<(gt==="true")},[]),reactExports.useEffect(()=>{nt||!it||it.libp2p.getConnections().length===0||tt.length>0||et||(o(!0),ft())},[it,nt,st]);const mt=gt=>{lt(gt),localStorage.setItem("telemetryOptIn",gt.toString())};if(nt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const ft=async()=>{console.log("Starting message listening");try{at(yt=>({...yt,store:"in-progress"})),ht(!0);const gt=getMessagesFromStore(it);for await(const yt of gt)rt(bt=>bt.some(vt=>vt.blockUUID===yt.blockUUID)?bt:[...bt,yt]);at(yt=>({...yt,store:"success"}))}catch(gt){console.error("Error fetching messages from store:",gt),at(yt=>({...yt,store:"error"}))}finally{ht(!1)}try{at(gt=>({...gt,filter:"in-progress"})),await subscribeToFilter(it,gt=>{pt(gt)}),at(gt=>({...gt,filter:"success"}))}catch(gt){console.error("Error subscribing to filter:",gt),at(yt=>({...yt,filter:"error"}))}};if(ot)return jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const pt=gt=>{rt(yt=>yt.some(xt=>xt.blockUUID===gt.blockUUID)?yt:[...yt,gt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:mt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"/view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"/sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"/telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"/",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"/create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]});var util;(function(et){et.assertEqual=nt=>nt;function o(nt){}et.assertIs=o;function tt(nt){throw new Error}et.assertNever=tt,et.arrayToEnum=nt=>{const ot={};for(const it of nt)ot[it]=it;return ot},et.getValidEnumValues=nt=>{const ot=et.objectKeys(nt).filter(st=>typeof nt[nt[st]]!="number"),it={};for(const st of ot)it[st]=nt[st];return et.objectValues(it)},et.objectValues=nt=>et.objectKeys(nt).map(function(ot){return nt[ot]}),et.objectKeys=typeof Object.keys=="function"?nt=>Object.keys(nt):nt=>{const ot=[];for(const it in nt)Object.prototype.hasOwnProperty.call(nt,it)&&ot.push(it);return ot},et.find=(nt,ot)=>{for(const it of nt)if(ot(it))return it},et.isInteger=typeof Number.isInteger=="function"?nt=>Number.isInteger(nt):nt=>typeof nt=="number"&&isFinite(nt)&&Math.floor(nt)===nt;function rt(nt,ot=" | "){return nt.map(it=>typeof it=="string"?`'${it}'`:it).join(ot)}et.joinValues=rt,et.jsonStringifyReplacer=(nt,ot)=>typeof ot=="bigint"?ot.toString():ot})(util||(util={}));var objectUtil;(function(et){et.mergeShapes=(o,tt)=>({...o,...tt})})(objectUtil||(objectUtil={}));const ZodParsedType=util.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=et=>{switch(typeof et){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(et)?ZodParsedType.nan:ZodParsedType.number;case"boolean":return ZodParsedType.boolean;case"function":return ZodParsedType.function;case"bigint":return ZodParsedType.bigint;case"symbol":return ZodParsedType.symbol;case"object":return Array.isArray(et)?ZodParsedType.array:et===null?ZodParsedType.null:et.then&&typeof et.then=="function"&&et.catch&&typeof et.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&et instanceof Map?ZodParsedType.map:typeof Set<"u"&&et instanceof Set?ZodParsedType.set:typeof Date<"u"&&et instanceof Date?ZodParsedType.date:ZodParsedType.object;default:return ZodParsedType.unknown}},ZodIssueCode=util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),quotelessJson=et=>JSON.stringify(et,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(o){super(),this.issues=[],this.addIssue=rt=>{this.issues=[...this.issues,rt]},this.addIssues=(rt=[])=>{this.issues=[...this.issues,...rt]};const tt=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,tt):this.__proto__=tt,this.name="ZodError",this.issues=o}get errors(){return this.issues}format(o){const tt=o||function(ot){return ot.message},rt={_errors:[]},nt=ot=>{for(const it of ot.issues)if(it.code==="invalid_union")it.unionErrors.map(nt);else if(it.code==="invalid_return_type")nt(it.returnTypeError);else if(it.code==="invalid_arguments")nt(it.argumentsError);else if(it.path.length===0)rt._errors.push(tt(it));else{let st=rt,at=0;for(;attt.message){const tt={},rt=[];for(const nt of this.issues)nt.path.length>0?(tt[nt.path[0]]=tt[nt.path[0]]||[],tt[nt.path[0]].push(o(nt))):rt.push(o(nt));return{formErrors:rt,fieldErrors:tt}}get formErrors(){return this.flatten()}}ZodError.create=et=>new ZodError(et);const errorMap=(et,o)=>{let tt;switch(et.code){case ZodIssueCode.invalid_type:et.received===ZodParsedType.undefined?tt="Required":tt=`Expected ${et.expected}, received ${et.received}`;break;case ZodIssueCode.invalid_literal:tt=`Invalid literal value, expected ${JSON.stringify(et.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:tt=`Unrecognized key(s) in object: ${util.joinValues(et.keys,", ")}`;break;case ZodIssueCode.invalid_union:tt="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:tt=`Invalid discriminator value. Expected ${util.joinValues(et.options)}`;break;case ZodIssueCode.invalid_enum_value:tt=`Invalid enum value. Expected ${util.joinValues(et.options)}, received '${et.received}'`;break;case ZodIssueCode.invalid_arguments:tt="Invalid function arguments";break;case ZodIssueCode.invalid_return_type:tt="Invalid function return type";break;case ZodIssueCode.invalid_date:tt="Invalid date";break;case ZodIssueCode.invalid_string:typeof et.validation=="object"?"includes"in et.validation?(tt=`Invalid input: must include "${et.validation.includes}"`,typeof et.validation.position=="number"&&(tt=`${tt} at one or more positions greater than or equal to ${et.validation.position}`)):"startsWith"in et.validation?tt=`Invalid input: must start with "${et.validation.startsWith}"`:"endsWith"in et.validation?tt=`Invalid input: must end with "${et.validation.endsWith}"`:util.assertNever(et.validation):et.validation!=="regex"?tt=`Invalid ${et.validation}`:tt="Invalid";break;case ZodIssueCode.too_small:et.type==="array"?tt=`Array must contain ${et.exact?"exactly":et.inclusive?"at least":"more than"} ${et.minimum} element(s)`:et.type==="string"?tt=`String must contain ${et.exact?"exactly":et.inclusive?"at least":"over"} ${et.minimum} character(s)`:et.type==="number"?tt=`Number must be ${et.exact?"exactly equal to ":et.inclusive?"greater than or equal to ":"greater than "}${et.minimum}`:et.type==="date"?tt=`Date must be ${et.exact?"exactly equal to ":et.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(et.minimum))}`:tt="Invalid input";break;case ZodIssueCode.too_big:et.type==="array"?tt=`Array must contain ${et.exact?"exactly":et.inclusive?"at most":"less than"} ${et.maximum} element(s)`:et.type==="string"?tt=`String must contain ${et.exact?"exactly":et.inclusive?"at most":"under"} ${et.maximum} character(s)`:et.type==="number"?tt=`Number must be ${et.exact?"exactly":et.inclusive?"less than or equal to":"less than"} ${et.maximum}`:et.type==="bigint"?tt=`BigInt must be ${et.exact?"exactly":et.inclusive?"less than or equal to":"less than"} ${et.maximum}`:et.type==="date"?tt=`Date must be ${et.exact?"exactly":et.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(et.maximum))}`:tt="Invalid input";break;case ZodIssueCode.custom:tt="Invalid input";break;case ZodIssueCode.invalid_intersection_types:tt="Intersection results could not be merged";break;case ZodIssueCode.not_multiple_of:tt=`Number must be a multiple of ${et.multipleOf}`;break;case ZodIssueCode.not_finite:tt="Number must be finite";break;default:tt=o.defaultError,util.assertNever(et)}return{message:tt}};let overrideErrorMap=errorMap;function setErrorMap(et){overrideErrorMap=et}function getErrorMap(){return overrideErrorMap}const makeIssue=et=>{const{data:o,path:tt,errorMaps:rt,issueData:nt}=et,ot=[...tt,...nt.path||[]],it={...nt,path:ot};if(nt.message!==void 0)return{...nt,path:ot,message:nt.message};let st="";const at=rt.filter(ct=>!!ct).slice().reverse();for(const ct of at)st=ct(it,{data:o,defaultError:st}).message;return{...nt,path:ot,message:st}},EMPTY_PATH=[];function addIssueToContext(et,o){const tt=getErrorMap(),rt=makeIssue({issueData:o,data:et.data,path:et.path,errorMaps:[et.common.contextualErrorMap,et.schemaErrorMap,tt,tt===errorMap?void 0:errorMap].filter(nt=>!!nt)});et.common.issues.push(rt)}class ParseStatus{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(o,tt){const rt=[];for(const nt of tt){if(nt.status==="aborted")return INVALID;nt.status==="dirty"&&o.dirty(),rt.push(nt.value)}return{status:o.value,value:rt}}static async mergeObjectAsync(o,tt){const rt=[];for(const nt of tt){const ot=await nt.key,it=await nt.value;rt.push({key:ot,value:it})}return ParseStatus.mergeObjectSync(o,rt)}static mergeObjectSync(o,tt){const rt={};for(const nt of tt){const{key:ot,value:it}=nt;if(ot.status==="aborted"||it.status==="aborted")return INVALID;ot.status==="dirty"&&o.dirty(),it.status==="dirty"&&o.dirty(),ot.value!=="__proto__"&&(typeof it.value<"u"||nt.alwaysSet)&&(rt[ot.value]=it.value)}return{status:o.value,value:rt}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=et=>({status:"dirty",value:et}),OK=et=>({status:"valid",value:et}),isAborted=et=>et.status==="aborted",isDirty=et=>et.status==="dirty",isValid=et=>et.status==="valid",isAsync=et=>typeof Promise<"u"&&et instanceof Promise;function __classPrivateFieldGet(et,o,tt,rt){if(typeof o=="function"?et!==o||!rt:!o.has(et))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o.get(et)}function __classPrivateFieldSet(et,o,tt,rt,nt){if(typeof o=="function"?et!==o||!nt:!o.has(et))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o.set(et,tt),tt}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(et){et.errToObj=o=>typeof o=="string"?{message:o}:o||{},et.toString=o=>typeof o=="string"?o:o==null?void 0:o.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(o,tt,rt,nt){this._cachedPath=[],this.parent=o,this.data=tt,this._path=rt,this._key=nt}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(et,o)=>{if(isValid(o))return{success:!0,data:o.value};if(!et.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const tt=new ZodError(et.common.issues);return this._error=tt,this._error}}};function processCreateParams(et){if(!et)return{};const{errorMap:o,invalid_type_error:tt,required_error:rt,description:nt}=et;if(o&&(tt||rt))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return o?{errorMap:o,description:nt}:{errorMap:(it,st)=>{var at,ct;const{message:lt}=et;return it.code==="invalid_enum_value"?{message:lt??st.defaultError}:typeof st.data>"u"?{message:(at=lt??rt)!==null&&at!==void 0?at:st.defaultError}:it.code!=="invalid_type"?{message:st.defaultError}:{message:(ct=lt??tt)!==null&&ct!==void 0?ct:st.defaultError}},description:nt}}class ZodType{constructor(o){this.spa=this.safeParseAsync,this._def=o,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(o){return getParsedType(o.data)}_getOrReturnCtx(o,tt){return tt||{common:o.parent.common,data:o.data,parsedType:getParsedType(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}_processInputParams(o){return{status:new ParseStatus,ctx:{common:o.parent.common,data:o.data,parsedType:getParsedType(o.data),schemaErrorMap:this._def.errorMap,path:o.path,parent:o.parent}}}_parseSync(o){const tt=this._parse(o);if(isAsync(tt))throw new Error("Synchronous parse encountered promise.");return tt}_parseAsync(o){const tt=this._parse(o);return Promise.resolve(tt)}parse(o,tt){const rt=this.safeParse(o,tt);if(rt.success)return rt.data;throw rt.error}safeParse(o,tt){var rt;const nt={common:{issues:[],async:(rt=tt==null?void 0:tt.async)!==null&&rt!==void 0?rt:!1,contextualErrorMap:tt==null?void 0:tt.errorMap},path:(tt==null?void 0:tt.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:getParsedType(o)},ot=this._parseSync({data:o,path:nt.path,parent:nt});return handleResult(nt,ot)}async parseAsync(o,tt){const rt=await this.safeParseAsync(o,tt);if(rt.success)return rt.data;throw rt.error}async safeParseAsync(o,tt){const rt={common:{issues:[],contextualErrorMap:tt==null?void 0:tt.errorMap,async:!0},path:(tt==null?void 0:tt.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:o,parsedType:getParsedType(o)},nt=this._parse({data:o,path:rt.path,parent:rt}),ot=await(isAsync(nt)?nt:Promise.resolve(nt));return handleResult(rt,ot)}refine(o,tt){const rt=nt=>typeof tt=="string"||typeof tt>"u"?{message:tt}:typeof tt=="function"?tt(nt):tt;return this._refinement((nt,ot)=>{const it=o(nt),st=()=>ot.addIssue({code:ZodIssueCode.custom,...rt(nt)});return typeof Promise<"u"&&it instanceof Promise?it.then(at=>at?!0:(st(),!1)):it?!0:(st(),!1)})}refinement(o,tt){return this._refinement((rt,nt)=>o(rt)?!0:(nt.addIssue(typeof tt=="function"?tt(rt,nt):tt),!1))}_refinement(o){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:o}})}superRefine(o){return this._refinement(o)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(o){return ZodUnion.create([this,o],this._def)}and(o){return ZodIntersection.create(this,o,this._def)}transform(o){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:o}})}default(o){const tt=typeof o=="function"?o:()=>o;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:tt,typeName:ZodFirstPartyTypeKind.ZodDefault})}brand(){return new ZodBranded({typeName:ZodFirstPartyTypeKind.ZodBranded,type:this,...processCreateParams(this._def)})}catch(o){const tt=typeof o=="function"?o:()=>o;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:tt,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(o){const tt=this.constructor;return new tt({...this._def,description:o})}pipe(o){return ZodPipeline.create(this,o)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cuidRegex=/^c[^\s-]{8,}$/i,cuid2Regex=/^[0-9a-z]+$/,ulidRegex=/^[0-9A-HJKMNP-TV-Z]{26}$/,uuidRegex=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nanoidRegex=/^[a-z0-9_-]{21}$/i,durationRegex=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,emailRegex=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_emojiRegex="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let emojiRegex;const ipv4Regex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv6Regex=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,base64Regex=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dateRegexSource="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dateRegex=new RegExp(`^${dateRegexSource}$`);function timeRegexSource(et){let o="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return et.precision?o=`${o}\\.\\d{${et.precision}}`:et.precision==null&&(o=`${o}(\\.\\d+)?`),o}function timeRegex(et){return new RegExp(`^${timeRegexSource(et)}$`)}function datetimeRegex(et){let o=`${dateRegexSource}T${timeRegexSource(et)}`;const tt=[];return tt.push(et.local?"Z?":"Z"),et.offset&&tt.push("([+-]\\d{2}:?\\d{2})"),o=`${o}(${tt.join("|")})`,new RegExp(`^${o}$`)}function isValidIP(et,o){return!!((o==="v4"||!o)&&ipv4Regex.test(et)||(o==="v6"||!o)&&ipv6Regex.test(et))}class ZodString extends ZodType{_parse(o){if(this._def.coerce&&(o.data=String(o.data)),this._getType(o)!==ZodParsedType.string){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.string,received:ot.parsedType}),INVALID}const rt=new ParseStatus;let nt;for(const ot of this._def.checks)if(ot.kind==="min")o.data.lengthot.value&&(nt=this._getOrReturnCtx(o,nt),addIssueToContext(nt,{code:ZodIssueCode.too_big,maximum:ot.value,type:"string",inclusive:!0,exact:!1,message:ot.message}),rt.dirty());else if(ot.kind==="length"){const it=o.data.length>ot.value,st=o.data.lengtho.test(nt),{validation:tt,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(rt)})}_addCheck(o){return new ZodString({...this._def,checks:[...this._def.checks,o]})}email(o){return this._addCheck({kind:"email",...errorUtil.errToObj(o)})}url(o){return this._addCheck({kind:"url",...errorUtil.errToObj(o)})}emoji(o){return this._addCheck({kind:"emoji",...errorUtil.errToObj(o)})}uuid(o){return this._addCheck({kind:"uuid",...errorUtil.errToObj(o)})}nanoid(o){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(o)})}cuid(o){return this._addCheck({kind:"cuid",...errorUtil.errToObj(o)})}cuid2(o){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(o)})}ulid(o){return this._addCheck({kind:"ulid",...errorUtil.errToObj(o)})}base64(o){return this._addCheck({kind:"base64",...errorUtil.errToObj(o)})}ip(o){return this._addCheck({kind:"ip",...errorUtil.errToObj(o)})}datetime(o){var tt,rt;return typeof o=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:o}):this._addCheck({kind:"datetime",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,offset:(tt=o==null?void 0:o.offset)!==null&&tt!==void 0?tt:!1,local:(rt=o==null?void 0:o.local)!==null&&rt!==void 0?rt:!1,...errorUtil.errToObj(o==null?void 0:o.message)})}date(o){return this._addCheck({kind:"date",message:o})}time(o){return typeof o=="string"?this._addCheck({kind:"time",precision:null,message:o}):this._addCheck({kind:"time",precision:typeof(o==null?void 0:o.precision)>"u"?null:o==null?void 0:o.precision,...errorUtil.errToObj(o==null?void 0:o.message)})}duration(o){return this._addCheck({kind:"duration",...errorUtil.errToObj(o)})}regex(o,tt){return this._addCheck({kind:"regex",regex:o,...errorUtil.errToObj(tt)})}includes(o,tt){return this._addCheck({kind:"includes",value:o,position:tt==null?void 0:tt.position,...errorUtil.errToObj(tt==null?void 0:tt.message)})}startsWith(o,tt){return this._addCheck({kind:"startsWith",value:o,...errorUtil.errToObj(tt)})}endsWith(o,tt){return this._addCheck({kind:"endsWith",value:o,...errorUtil.errToObj(tt)})}min(o,tt){return this._addCheck({kind:"min",value:o,...errorUtil.errToObj(tt)})}max(o,tt){return this._addCheck({kind:"max",value:o,...errorUtil.errToObj(tt)})}length(o,tt){return this._addCheck({kind:"length",value:o,...errorUtil.errToObj(tt)})}nonempty(o){return this.min(1,errorUtil.errToObj(o))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(o=>o.kind==="datetime")}get isDate(){return!!this._def.checks.find(o=>o.kind==="date")}get isTime(){return!!this._def.checks.find(o=>o.kind==="time")}get isDuration(){return!!this._def.checks.find(o=>o.kind==="duration")}get isEmail(){return!!this._def.checks.find(o=>o.kind==="email")}get isURL(){return!!this._def.checks.find(o=>o.kind==="url")}get isEmoji(){return!!this._def.checks.find(o=>o.kind==="emoji")}get isUUID(){return!!this._def.checks.find(o=>o.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(o=>o.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(o=>o.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(o=>o.kind==="cuid2")}get isULID(){return!!this._def.checks.find(o=>o.kind==="ulid")}get isIP(){return!!this._def.checks.find(o=>o.kind==="ip")}get isBase64(){return!!this._def.checks.find(o=>o.kind==="base64")}get minLength(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxLength(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.value{var o;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(o=et==null?void 0:et.coerce)!==null&&o!==void 0?o:!1,...processCreateParams(et)})};function floatSafeRemainder(et,o){const tt=(et.toString().split(".")[1]||"").length,rt=(o.toString().split(".")[1]||"").length,nt=tt>rt?tt:rt,ot=parseInt(et.toFixed(nt).replace(".","")),it=parseInt(o.toFixed(nt).replace(".",""));return ot%it/Math.pow(10,nt)}class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(o){if(this._def.coerce&&(o.data=Number(o.data)),this._getType(o)!==ZodParsedType.number){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.number,received:ot.parsedType}),INVALID}let rt;const nt=new ParseStatus;for(const ot of this._def.checks)ot.kind==="int"?util.isInteger(o.data)||(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:ot.message}),nt.dirty()):ot.kind==="min"?(ot.inclusive?o.dataot.value:o.data>=ot.value)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:ot.value,type:"number",inclusive:ot.inclusive,exact:!1,message:ot.message}),nt.dirty()):ot.kind==="multipleOf"?floatSafeRemainder(o.data,ot.value)!==0&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_multiple_of,multipleOf:ot.value,message:ot.message}),nt.dirty()):ot.kind==="finite"?Number.isFinite(o.data)||(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_finite,message:ot.message}),nt.dirty()):util.assertNever(ot);return{status:nt.value,value:o.data}}gte(o,tt){return this.setLimit("min",o,!0,errorUtil.toString(tt))}gt(o,tt){return this.setLimit("min",o,!1,errorUtil.toString(tt))}lte(o,tt){return this.setLimit("max",o,!0,errorUtil.toString(tt))}lt(o,tt){return this.setLimit("max",o,!1,errorUtil.toString(tt))}setLimit(o,tt,rt,nt){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:o,value:tt,inclusive:rt,message:errorUtil.toString(nt)}]})}_addCheck(o){return new ZodNumber({...this._def,checks:[...this._def.checks,o]})}int(o){return this._addCheck({kind:"int",message:errorUtil.toString(o)})}positive(o){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(o)})}multipleOf(o,tt){return this._addCheck({kind:"multipleOf",value:o,message:errorUtil.toString(tt)})}finite(o){return this._addCheck({kind:"finite",message:errorUtil.toString(o)})}safe(o){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(o)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(o)})}get minValue(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxValue(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.valueo.kind==="int"||o.kind==="multipleOf"&&util.isInteger(o.value))}get isFinite(){let o=null,tt=null;for(const rt of this._def.checks){if(rt.kind==="finite"||rt.kind==="int"||rt.kind==="multipleOf")return!0;rt.kind==="min"?(tt===null||rt.value>tt)&&(tt=rt.value):rt.kind==="max"&&(o===null||rt.valuenew ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(et==null?void 0:et.coerce)||!1,...processCreateParams(et)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(o){if(this._def.coerce&&(o.data=BigInt(o.data)),this._getType(o)!==ZodParsedType.bigint){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.bigint,received:ot.parsedType}),INVALID}let rt;const nt=new ParseStatus;for(const ot of this._def.checks)ot.kind==="min"?(ot.inclusive?o.dataot.value:o.data>=ot.value)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.too_big,type:"bigint",maximum:ot.value,inclusive:ot.inclusive,message:ot.message}),nt.dirty()):ot.kind==="multipleOf"?o.data%ot.value!==BigInt(0)&&(rt=this._getOrReturnCtx(o,rt),addIssueToContext(rt,{code:ZodIssueCode.not_multiple_of,multipleOf:ot.value,message:ot.message}),nt.dirty()):util.assertNever(ot);return{status:nt.value,value:o.data}}gte(o,tt){return this.setLimit("min",o,!0,errorUtil.toString(tt))}gt(o,tt){return this.setLimit("min",o,!1,errorUtil.toString(tt))}lte(o,tt){return this.setLimit("max",o,!0,errorUtil.toString(tt))}lt(o,tt){return this.setLimit("max",o,!1,errorUtil.toString(tt))}setLimit(o,tt,rt,nt){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:o,value:tt,inclusive:rt,message:errorUtil.toString(nt)}]})}_addCheck(o){return new ZodBigInt({...this._def,checks:[...this._def.checks,o]})}positive(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(o)})}negative(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(o)})}nonpositive(o){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(o)})}nonnegative(o){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(o)})}multipleOf(o,tt){return this._addCheck({kind:"multipleOf",value:o,message:errorUtil.toString(tt)})}get minValue(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o}get maxValue(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.value{var o;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(o=et==null?void 0:et.coerce)!==null&&o!==void 0?o:!1,...processCreateParams(et)})};class ZodBoolean extends ZodType{_parse(o){if(this._def.coerce&&(o.data=!!o.data),this._getType(o)!==ZodParsedType.boolean){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodBoolean.create=et=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(et==null?void 0:et.coerce)||!1,...processCreateParams(et)});class ZodDate extends ZodType{_parse(o){if(this._def.coerce&&(o.data=new Date(o.data)),this._getType(o)!==ZodParsedType.date){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:ot.parsedType}),INVALID}if(isNaN(o.data.getTime())){const ot=this._getOrReturnCtx(o);return addIssueToContext(ot,{code:ZodIssueCode.invalid_date}),INVALID}const rt=new ParseStatus;let nt;for(const ot of this._def.checks)ot.kind==="min"?o.data.getTime()ot.value&&(nt=this._getOrReturnCtx(o,nt),addIssueToContext(nt,{code:ZodIssueCode.too_big,message:ot.message,inclusive:!0,exact:!1,maximum:ot.value,type:"date"}),rt.dirty()):util.assertNever(ot);return{status:rt.value,value:new Date(o.data.getTime())}}_addCheck(o){return new ZodDate({...this._def,checks:[...this._def.checks,o]})}min(o,tt){return this._addCheck({kind:"min",value:o.getTime(),message:errorUtil.toString(tt)})}max(o,tt){return this._addCheck({kind:"max",value:o.getTime(),message:errorUtil.toString(tt)})}get minDate(){let o=null;for(const tt of this._def.checks)tt.kind==="min"&&(o===null||tt.value>o)&&(o=tt.value);return o!=null?new Date(o):null}get maxDate(){let o=null;for(const tt of this._def.checks)tt.kind==="max"&&(o===null||tt.valuenew ZodDate({checks:[],coerce:(et==null?void 0:et.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(et)});class ZodSymbol extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.symbol){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodSymbol.create=et=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(et)});class ZodUndefined extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.undefined){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodUndefined.create=et=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(et)});class ZodNull extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.null){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodNull.create=et=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(et)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(o){return OK(o.data)}}ZodAny.create=et=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(et)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(o){return OK(o.data)}}ZodUnknown.create=et=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(et)});class ZodNever extends ZodType{_parse(o){const tt=this._getOrReturnCtx(o);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:tt.parsedType}),INVALID}}ZodNever.create=et=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(et)});class ZodVoid extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.undefined){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:rt.parsedType}),INVALID}return OK(o.data)}}ZodVoid.create=et=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(et)});class ZodArray extends ZodType{_parse(o){const{ctx:tt,status:rt}=this._processInputParams(o),nt=this._def;if(tt.parsedType!==ZodParsedType.array)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:tt.parsedType}),INVALID;if(nt.exactLength!==null){const it=tt.data.length>nt.exactLength.value,st=tt.data.lengthnt.maxLength.value&&(addIssueToContext(tt,{code:ZodIssueCode.too_big,maximum:nt.maxLength.value,type:"array",inclusive:!0,exact:!1,message:nt.maxLength.message}),rt.dirty()),tt.common.async)return Promise.all([...tt.data].map((it,st)=>nt.type._parseAsync(new ParseInputLazyPath(tt,it,tt.path,st)))).then(it=>ParseStatus.mergeArray(rt,it));const ot=[...tt.data].map((it,st)=>nt.type._parseSync(new ParseInputLazyPath(tt,it,tt.path,st)));return ParseStatus.mergeArray(rt,ot)}get element(){return this._def.type}min(o,tt){return new ZodArray({...this._def,minLength:{value:o,message:errorUtil.toString(tt)}})}max(o,tt){return new ZodArray({...this._def,maxLength:{value:o,message:errorUtil.toString(tt)}})}length(o,tt){return new ZodArray({...this._def,exactLength:{value:o,message:errorUtil.toString(tt)}})}nonempty(o){return this.min(1,o)}}ZodArray.create=(et,o)=>new ZodArray({type:et,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(o)});function deepPartialify(et){if(et instanceof ZodObject){const o={};for(const tt in et.shape){const rt=et.shape[tt];o[tt]=ZodOptional.create(deepPartialify(rt))}return new ZodObject({...et._def,shape:()=>o})}else return et instanceof ZodArray?new ZodArray({...et._def,type:deepPartialify(et.element)}):et instanceof ZodOptional?ZodOptional.create(deepPartialify(et.unwrap())):et instanceof ZodNullable?ZodNullable.create(deepPartialify(et.unwrap())):et instanceof ZodTuple?ZodTuple.create(et.items.map(o=>deepPartialify(o))):et}class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const o=this._def.shape(),tt=util.objectKeys(o);return this._cached={shape:o,keys:tt}}_parse(o){if(this._getType(o)!==ZodParsedType.object){const ct=this._getOrReturnCtx(o);return addIssueToContext(ct,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:ct.parsedType}),INVALID}const{status:rt,ctx:nt}=this._processInputParams(o),{shape:ot,keys:it}=this._getCached(),st=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const ct in nt.data)it.includes(ct)||st.push(ct);const at=[];for(const ct of it){const lt=ot[ct],dt=nt.data[ct];at.push({key:{status:"valid",value:ct},value:lt._parse(new ParseInputLazyPath(nt,dt,nt.path,ct)),alwaysSet:ct in nt.data})}if(this._def.catchall instanceof ZodNever){const ct=this._def.unknownKeys;if(ct==="passthrough")for(const lt of st)at.push({key:{status:"valid",value:lt},value:{status:"valid",value:nt.data[lt]}});else if(ct==="strict")st.length>0&&(addIssueToContext(nt,{code:ZodIssueCode.unrecognized_keys,keys:st}),rt.dirty());else if(ct!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ct=this._def.catchall;for(const lt of st){const dt=nt.data[lt];at.push({key:{status:"valid",value:lt},value:ct._parse(new ParseInputLazyPath(nt,dt,nt.path,lt)),alwaysSet:lt in nt.data})}}return nt.common.async?Promise.resolve().then(async()=>{const ct=[];for(const lt of at){const dt=await lt.key,ht=await lt.value;ct.push({key:dt,value:ht,alwaysSet:lt.alwaysSet})}return ct}).then(ct=>ParseStatus.mergeObjectSync(rt,ct)):ParseStatus.mergeObjectSync(rt,at)}get shape(){return this._def.shape()}strict(o){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...o!==void 0?{errorMap:(tt,rt)=>{var nt,ot,it,st;const at=(it=(ot=(nt=this._def).errorMap)===null||ot===void 0?void 0:ot.call(nt,tt,rt).message)!==null&&it!==void 0?it:rt.defaultError;return tt.code==="unrecognized_keys"?{message:(st=errorUtil.errToObj(o).message)!==null&&st!==void 0?st:at}:{message:at}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(o){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...o})})}merge(o){return new ZodObject({unknownKeys:o._def.unknownKeys,catchall:o._def.catchall,shape:()=>({...this._def.shape(),...o._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(o,tt){return this.augment({[o]:tt})}catchall(o){return new ZodObject({...this._def,catchall:o})}pick(o){const tt={};return util.objectKeys(o).forEach(rt=>{o[rt]&&this.shape[rt]&&(tt[rt]=this.shape[rt])}),new ZodObject({...this._def,shape:()=>tt})}omit(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{o[rt]||(tt[rt]=this.shape[rt])}),new ZodObject({...this._def,shape:()=>tt})}deepPartial(){return deepPartialify(this)}partial(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{const nt=this.shape[rt];o&&!o[rt]?tt[rt]=nt:tt[rt]=nt.optional()}),new ZodObject({...this._def,shape:()=>tt})}required(o){const tt={};return util.objectKeys(this.shape).forEach(rt=>{if(o&&!o[rt])tt[rt]=this.shape[rt];else{let ot=this.shape[rt];for(;ot instanceof ZodOptional;)ot=ot._def.innerType;tt[rt]=ot}}),new ZodObject({...this._def,shape:()=>tt})}keyof(){return createZodEnum(util.objectKeys(this.shape))}}ZodObject.create=(et,o)=>new ZodObject({shape:()=>et,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});ZodObject.strictCreate=(et,o)=>new ZodObject({shape:()=>et,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});ZodObject.lazycreate=(et,o)=>new ZodObject({shape:et,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(o)});class ZodUnion extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt=this._def.options;function nt(ot){for(const st of ot)if(st.result.status==="valid")return st.result;for(const st of ot)if(st.result.status==="dirty")return tt.common.issues.push(...st.ctx.common.issues),st.result;const it=ot.map(st=>new ZodError(st.ctx.common.issues));return addIssueToContext(tt,{code:ZodIssueCode.invalid_union,unionErrors:it}),INVALID}if(tt.common.async)return Promise.all(rt.map(async ot=>{const it={...tt,common:{...tt.common,issues:[]},parent:null};return{result:await ot._parseAsync({data:tt.data,path:tt.path,parent:it}),ctx:it}})).then(nt);{let ot;const it=[];for(const at of rt){const ct={...tt,common:{...tt.common,issues:[]},parent:null},lt=at._parseSync({data:tt.data,path:tt.path,parent:ct});if(lt.status==="valid")return lt;lt.status==="dirty"&&!ot&&(ot={result:lt,ctx:ct}),ct.common.issues.length&&it.push(ct.common.issues)}if(ot)return tt.common.issues.push(...ot.ctx.common.issues),ot.result;const st=it.map(at=>new ZodError(at));return addIssueToContext(tt,{code:ZodIssueCode.invalid_union,unionErrors:st}),INVALID}}get options(){return this._def.options}}ZodUnion.create=(et,o)=>new ZodUnion({options:et,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(o)});const getDiscriminator=et=>et instanceof ZodLazy?getDiscriminator(et.schema):et instanceof ZodEffects?getDiscriminator(et.innerType()):et instanceof ZodLiteral?[et.value]:et instanceof ZodEnum?et.options:et instanceof ZodNativeEnum?util.objectValues(et.enum):et instanceof ZodDefault?getDiscriminator(et._def.innerType):et instanceof ZodUndefined?[void 0]:et instanceof ZodNull?[null]:et instanceof ZodOptional?[void 0,...getDiscriminator(et.unwrap())]:et instanceof ZodNullable?[null,...getDiscriminator(et.unwrap())]:et instanceof ZodBranded||et instanceof ZodReadonly?getDiscriminator(et.unwrap()):et instanceof ZodCatch?getDiscriminator(et._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.object)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:tt.parsedType}),INVALID;const rt=this.discriminator,nt=tt.data[rt],ot=this.optionsMap.get(nt);return ot?tt.common.async?ot._parseAsync({data:tt.data,path:tt.path,parent:tt}):ot._parseSync({data:tt.data,path:tt.path,parent:tt}):(addIssueToContext(tt,{code:ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[rt]}),INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(o,tt,rt){const nt=new Map;for(const ot of tt){const it=getDiscriminator(ot.shape[o]);if(!it.length)throw new Error(`A discriminator value for key \`${o}\` could not be extracted from all schema options`);for(const st of it){if(nt.has(st))throw new Error(`Discriminator property ${String(o)} has duplicate value ${String(st)}`);nt.set(st,ot)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:o,options:tt,optionsMap:nt,...processCreateParams(rt)})}}function mergeValues(et,o){const tt=getParsedType(et),rt=getParsedType(o);if(et===o)return{valid:!0,data:et};if(tt===ZodParsedType.object&&rt===ZodParsedType.object){const nt=util.objectKeys(o),ot=util.objectKeys(et).filter(st=>nt.indexOf(st)!==-1),it={...et,...o};for(const st of ot){const at=mergeValues(et[st],o[st]);if(!at.valid)return{valid:!1};it[st]=at.data}return{valid:!0,data:it}}else if(tt===ZodParsedType.array&&rt===ZodParsedType.array){if(et.length!==o.length)return{valid:!1};const nt=[];for(let ot=0;ot{if(isAborted(ot)||isAborted(it))return INVALID;const st=mergeValues(ot.value,it.value);return st.valid?((isDirty(ot)||isDirty(it))&&tt.dirty(),{status:tt.value,value:st.data}):(addIssueToContext(rt,{code:ZodIssueCode.invalid_intersection_types}),INVALID)};return rt.common.async?Promise.all([this._def.left._parseAsync({data:rt.data,path:rt.path,parent:rt}),this._def.right._parseAsync({data:rt.data,path:rt.path,parent:rt})]).then(([ot,it])=>nt(ot,it)):nt(this._def.left._parseSync({data:rt.data,path:rt.path,parent:rt}),this._def.right._parseSync({data:rt.data,path:rt.path,parent:rt}))}}ZodIntersection.create=(et,o,tt)=>new ZodIntersection({left:et,right:o,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams(tt)});class ZodTuple extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.array)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.array,received:rt.parsedType}),INVALID;if(rt.data.lengththis._def.items.length&&(addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),tt.dirty());const ot=[...rt.data].map((it,st)=>{const at=this._def.items[st]||this._def.rest;return at?at._parse(new ParseInputLazyPath(rt,it,rt.path,st)):null}).filter(it=>!!it);return rt.common.async?Promise.all(ot).then(it=>ParseStatus.mergeArray(tt,it)):ParseStatus.mergeArray(tt,ot)}get items(){return this._def.items}rest(o){return new ZodTuple({...this._def,rest:o})}}ZodTuple.create=(et,o)=>{if(!Array.isArray(et))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:et,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(o)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.object)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:rt.parsedType}),INVALID;const nt=[],ot=this._def.keyType,it=this._def.valueType;for(const st in rt.data)nt.push({key:ot._parse(new ParseInputLazyPath(rt,st,rt.path,st)),value:it._parse(new ParseInputLazyPath(rt,rt.data[st],rt.path,st)),alwaysSet:st in rt.data});return rt.common.async?ParseStatus.mergeObjectAsync(tt,nt):ParseStatus.mergeObjectSync(tt,nt)}get element(){return this._def.valueType}static create(o,tt,rt){return tt instanceof ZodType?new ZodRecord({keyType:o,valueType:tt,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(rt)}):new ZodRecord({keyType:ZodString.create(),valueType:o,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(tt)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.map)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.map,received:rt.parsedType}),INVALID;const nt=this._def.keyType,ot=this._def.valueType,it=[...rt.data.entries()].map(([st,at],ct)=>({key:nt._parse(new ParseInputLazyPath(rt,st,rt.path,[ct,"key"])),value:ot._parse(new ParseInputLazyPath(rt,at,rt.path,[ct,"value"]))}));if(rt.common.async){const st=new Map;return Promise.resolve().then(async()=>{for(const at of it){const ct=await at.key,lt=await at.value;if(ct.status==="aborted"||lt.status==="aborted")return INVALID;(ct.status==="dirty"||lt.status==="dirty")&&tt.dirty(),st.set(ct.value,lt.value)}return{status:tt.value,value:st}})}else{const st=new Map;for(const at of it){const ct=at.key,lt=at.value;if(ct.status==="aborted"||lt.status==="aborted")return INVALID;(ct.status==="dirty"||lt.status==="dirty")&&tt.dirty(),st.set(ct.value,lt.value)}return{status:tt.value,value:st}}}}ZodMap.create=(et,o,tt)=>new ZodMap({valueType:o,keyType:et,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams(tt)});class ZodSet extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.parsedType!==ZodParsedType.set)return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.set,received:rt.parsedType}),INVALID;const nt=this._def;nt.minSize!==null&&rt.data.sizent.maxSize.value&&(addIssueToContext(rt,{code:ZodIssueCode.too_big,maximum:nt.maxSize.value,type:"set",inclusive:!0,exact:!1,message:nt.maxSize.message}),tt.dirty());const ot=this._def.valueType;function it(at){const ct=new Set;for(const lt of at){if(lt.status==="aborted")return INVALID;lt.status==="dirty"&&tt.dirty(),ct.add(lt.value)}return{status:tt.value,value:ct}}const st=[...rt.data.values()].map((at,ct)=>ot._parse(new ParseInputLazyPath(rt,at,rt.path,ct)));return rt.common.async?Promise.all(st).then(at=>it(at)):it(st)}min(o,tt){return new ZodSet({...this._def,minSize:{value:o,message:errorUtil.toString(tt)}})}max(o,tt){return new ZodSet({...this._def,maxSize:{value:o,message:errorUtil.toString(tt)}})}size(o,tt){return this.min(o,tt).max(o,tt)}nonempty(o){return this.min(1,o)}}ZodSet.create=(et,o)=>new ZodSet({valueType:et,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(o)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.function)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.function,received:tt.parsedType}),INVALID;function rt(st,at){return makeIssue({data:st,path:tt.path,errorMaps:[tt.common.contextualErrorMap,tt.schemaErrorMap,getErrorMap(),errorMap].filter(ct=>!!ct),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:at}})}function nt(st,at){return makeIssue({data:st,path:tt.path,errorMaps:[tt.common.contextualErrorMap,tt.schemaErrorMap,getErrorMap(),errorMap].filter(ct=>!!ct),issueData:{code:ZodIssueCode.invalid_return_type,returnTypeError:at}})}const ot={errorMap:tt.common.contextualErrorMap},it=tt.data;if(this._def.returns instanceof ZodPromise){const st=this;return OK(async function(...at){const ct=new ZodError([]),lt=await st._def.args.parseAsync(at,ot).catch(mt=>{throw ct.addIssue(rt(at,mt)),ct}),dt=await Reflect.apply(it,this,lt);return await st._def.returns._def.type.parseAsync(dt,ot).catch(mt=>{throw ct.addIssue(nt(dt,mt)),ct})})}else{const st=this;return OK(function(...at){const ct=st._def.args.safeParse(at,ot);if(!ct.success)throw new ZodError([rt(at,ct.error)]);const lt=Reflect.apply(it,this,ct.data),dt=st._def.returns.safeParse(lt,ot);if(!dt.success)throw new ZodError([nt(lt,dt.error)]);return dt.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...o){return new ZodFunction({...this._def,args:ZodTuple.create(o).rest(ZodUnknown.create())})}returns(o){return new ZodFunction({...this._def,returns:o})}implement(o){return this.parse(o)}strictImplement(o){return this.parse(o)}static create(o,tt,rt){return new ZodFunction({args:o||ZodTuple.create([]).rest(ZodUnknown.create()),returns:tt||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(rt)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(o){const{ctx:tt}=this._processInputParams(o);return this._def.getter()._parse({data:tt.data,path:tt.path,parent:tt})}}ZodLazy.create=(et,o)=>new ZodLazy({getter:et,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(o)});class ZodLiteral extends ZodType{_parse(o){if(o.data!==this._def.value){const tt=this._getOrReturnCtx(o);return addIssueToContext(tt,{received:tt.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:o.data}}get value(){return this._def.value}}ZodLiteral.create=(et,o)=>new ZodLiteral({value:et,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(o)});function createZodEnum(et,o){return new ZodEnum({values:et,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(o)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(o){if(typeof o.data!="string"){const tt=this._getOrReturnCtx(o),rt=this._def.values;return addIssueToContext(tt,{expected:util.joinValues(rt),received:tt.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodEnum_cache)||__classPrivateFieldSet(this,_ZodEnum_cache,new Set(this._def.values)),!__classPrivateFieldGet(this,_ZodEnum_cache).has(o.data)){const tt=this._getOrReturnCtx(o),rt=this._def.values;return addIssueToContext(tt,{received:tt.data,code:ZodIssueCode.invalid_enum_value,options:rt}),INVALID}return OK(o.data)}get options(){return this._def.values}get enum(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}get Values(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}get Enum(){const o={};for(const tt of this._def.values)o[tt]=tt;return o}extract(o,tt=this._def){return ZodEnum.create(o,{...this._def,...tt})}exclude(o,tt=this._def){return ZodEnum.create(this.options.filter(rt=>!o.includes(rt)),{...this._def,...tt})}}_ZodEnum_cache=new WeakMap;ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),_ZodNativeEnum_cache.set(this,void 0)}_parse(o){const tt=util.getValidEnumValues(this._def.values),rt=this._getOrReturnCtx(o);if(rt.parsedType!==ZodParsedType.string&&rt.parsedType!==ZodParsedType.number){const nt=util.objectValues(tt);return addIssueToContext(rt,{expected:util.joinValues(nt),received:rt.parsedType,code:ZodIssueCode.invalid_type}),INVALID}if(__classPrivateFieldGet(this,_ZodNativeEnum_cache)||__classPrivateFieldSet(this,_ZodNativeEnum_cache,new Set(util.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,_ZodNativeEnum_cache).has(o.data)){const nt=util.objectValues(tt);return addIssueToContext(rt,{received:rt.data,code:ZodIssueCode.invalid_enum_value,options:nt}),INVALID}return OK(o.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(et,o)=>new ZodNativeEnum({values:et,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(o)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(o){const{ctx:tt}=this._processInputParams(o);if(tt.parsedType!==ZodParsedType.promise&&tt.common.async===!1)return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.promise,received:tt.parsedType}),INVALID;const rt=tt.parsedType===ZodParsedType.promise?tt.data:Promise.resolve(tt.data);return OK(rt.then(nt=>this._def.type.parseAsync(nt,{path:tt.path,errorMap:tt.common.contextualErrorMap})))}}ZodPromise.create=(et,o)=>new ZodPromise({type:et,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(o)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ZodFirstPartyTypeKind.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o),nt=this._def.effect||null,ot={addIssue:it=>{addIssueToContext(rt,it),it.fatal?tt.abort():tt.dirty()},get path(){return rt.path}};if(ot.addIssue=ot.addIssue.bind(ot),nt.type==="preprocess"){const it=nt.transform(rt.data,ot);if(rt.common.async)return Promise.resolve(it).then(async st=>{if(tt.value==="aborted")return INVALID;const at=await this._def.schema._parseAsync({data:st,path:rt.path,parent:rt});return at.status==="aborted"?INVALID:at.status==="dirty"||tt.value==="dirty"?DIRTY(at.value):at});{if(tt.value==="aborted")return INVALID;const st=this._def.schema._parseSync({data:it,path:rt.path,parent:rt});return st.status==="aborted"?INVALID:st.status==="dirty"||tt.value==="dirty"?DIRTY(st.value):st}}if(nt.type==="refinement"){const it=st=>{const at=nt.refinement(st,ot);if(rt.common.async)return Promise.resolve(at);if(at instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return st};if(rt.common.async===!1){const st=this._def.schema._parseSync({data:rt.data,path:rt.path,parent:rt});return st.status==="aborted"?INVALID:(st.status==="dirty"&&tt.dirty(),it(st.value),{status:tt.value,value:st.value})}else return this._def.schema._parseAsync({data:rt.data,path:rt.path,parent:rt}).then(st=>st.status==="aborted"?INVALID:(st.status==="dirty"&&tt.dirty(),it(st.value).then(()=>({status:tt.value,value:st.value}))))}if(nt.type==="transform")if(rt.common.async===!1){const it=this._def.schema._parseSync({data:rt.data,path:rt.path,parent:rt});if(!isValid(it))return it;const st=nt.transform(it.value,ot);if(st instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:tt.value,value:st}}else return this._def.schema._parseAsync({data:rt.data,path:rt.path,parent:rt}).then(it=>isValid(it)?Promise.resolve(nt.transform(it.value,ot)).then(st=>({status:tt.value,value:st})):it);util.assertNever(nt)}}ZodEffects.create=(et,o,tt)=>new ZodEffects({schema:et,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:o,...processCreateParams(tt)});ZodEffects.createWithPreprocess=(et,o,tt)=>new ZodEffects({schema:o,effect:{type:"preprocess",transform:et},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams(tt)});class ZodOptional extends ZodType{_parse(o){return this._getType(o)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}ZodOptional.create=(et,o)=>new ZodOptional({innerType:et,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(o)});class ZodNullable extends ZodType{_parse(o){return this._getType(o)===ZodParsedType.null?OK(null):this._def.innerType._parse(o)}unwrap(){return this._def.innerType}}ZodNullable.create=(et,o)=>new ZodNullable({innerType:et,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(o)});class ZodDefault extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o);let rt=tt.data;return tt.parsedType===ZodParsedType.undefined&&(rt=this._def.defaultValue()),this._def.innerType._parse({data:rt,path:tt.path,parent:tt})}removeDefault(){return this._def.innerType}}ZodDefault.create=(et,o)=>new ZodDefault({innerType:et,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof o.default=="function"?o.default:()=>o.default,...processCreateParams(o)});class ZodCatch extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt={...tt,common:{...tt.common,issues:[]}},nt=this._def.innerType._parse({data:rt.data,path:rt.path,parent:{...rt}});return isAsync(nt)?nt.then(ot=>({status:"valid",value:ot.status==="valid"?ot.value:this._def.catchValue({get error(){return new ZodError(rt.common.issues)},input:rt.data})})):{status:"valid",value:nt.status==="valid"?nt.value:this._def.catchValue({get error(){return new ZodError(rt.common.issues)},input:rt.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(et,o)=>new ZodCatch({innerType:et,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof o.catch=="function"?o.catch:()=>o.catch,...processCreateParams(o)});class ZodNaN extends ZodType{_parse(o){if(this._getType(o)!==ZodParsedType.nan){const rt=this._getOrReturnCtx(o);return addIssueToContext(rt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:rt.parsedType}),INVALID}return{status:"valid",value:o.data}}}ZodNaN.create=et=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(et)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(o){const{ctx:tt}=this._processInputParams(o),rt=tt.data;return this._def.type._parse({data:rt,path:tt.path,parent:tt})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(o){const{status:tt,ctx:rt}=this._processInputParams(o);if(rt.common.async)return(async()=>{const ot=await this._def.in._parseAsync({data:rt.data,path:rt.path,parent:rt});return ot.status==="aborted"?INVALID:ot.status==="dirty"?(tt.dirty(),DIRTY(ot.value)):this._def.out._parseAsync({data:ot.value,path:rt.path,parent:rt})})();{const nt=this._def.in._parseSync({data:rt.data,path:rt.path,parent:rt});return nt.status==="aborted"?INVALID:nt.status==="dirty"?(tt.dirty(),{status:"dirty",value:nt.value}):this._def.out._parseSync({data:nt.value,path:rt.path,parent:rt})}}static create(o,tt){return new ZodPipeline({in:o,out:tt,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(o){const tt=this._def.innerType._parse(o),rt=nt=>(isValid(nt)&&(nt.value=Object.freeze(nt.value)),nt);return isAsync(tt)?tt.then(nt=>rt(nt)):rt(tt)}unwrap(){return this._def.innerType}}ZodReadonly.create=(et,o)=>new ZodReadonly({innerType:et,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(o)});function custom(et,o={},tt){return et?ZodAny.create().superRefine((rt,nt)=>{var ot,it;if(!et(rt)){const st=typeof o=="function"?o(rt):typeof o=="string"?{message:o}:o,at=(it=(ot=st.fatal)!==null&&ot!==void 0?ot:tt)!==null&&it!==void 0?it:!0,ct=typeof st=="string"?{message:st}:st;nt.addIssue({code:"custom",...ct,fatal:at})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(et){et.ZodString="ZodString",et.ZodNumber="ZodNumber",et.ZodNaN="ZodNaN",et.ZodBigInt="ZodBigInt",et.ZodBoolean="ZodBoolean",et.ZodDate="ZodDate",et.ZodSymbol="ZodSymbol",et.ZodUndefined="ZodUndefined",et.ZodNull="ZodNull",et.ZodAny="ZodAny",et.ZodUnknown="ZodUnknown",et.ZodNever="ZodNever",et.ZodVoid="ZodVoid",et.ZodArray="ZodArray",et.ZodObject="ZodObject",et.ZodUnion="ZodUnion",et.ZodDiscriminatedUnion="ZodDiscriminatedUnion",et.ZodIntersection="ZodIntersection",et.ZodTuple="ZodTuple",et.ZodRecord="ZodRecord",et.ZodMap="ZodMap",et.ZodSet="ZodSet",et.ZodFunction="ZodFunction",et.ZodLazy="ZodLazy",et.ZodLiteral="ZodLiteral",et.ZodEnum="ZodEnum",et.ZodEffects="ZodEffects",et.ZodNativeEnum="ZodNativeEnum",et.ZodOptional="ZodOptional",et.ZodNullable="ZodNullable",et.ZodDefault="ZodDefault",et.ZodCatch="ZodCatch",et.ZodPromise="ZodPromise",et.ZodBranded="ZodBranded",et.ZodPipeline="ZodPipeline",et.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(et,o={message:`Input not instance of ${et.name}`})=>custom(tt=>tt instanceof et,o),stringType=ZodString.create,numberType=ZodNumber.create,nanType=ZodNaN.create,bigIntType=ZodBigInt.create,booleanType=ZodBoolean.create,dateType=ZodDate.create,symbolType=ZodSymbol.create,undefinedType=ZodUndefined.create,nullType=ZodNull.create,anyType=ZodAny.create,unknownType=ZodUnknown.create,neverType=ZodNever.create,voidType=ZodVoid.create,arrayType=ZodArray.create,objectType=ZodObject.create,strictObjectType=ZodObject.strictCreate,unionType=ZodUnion.create,discriminatedUnionType=ZodDiscriminatedUnion.create,intersectionType=ZodIntersection.create,tupleType=ZodTuple.create,recordType=ZodRecord.create,mapType=ZodMap.create,setType=ZodSet.create,functionType=ZodFunction.create,lazyType=ZodLazy.create,literalType=ZodLiteral.create,enumType=ZodEnum.create,nativeEnumType=ZodNativeEnum.create,promiseType=ZodPromise.create,effectsType=ZodEffects.create,optionalType=ZodOptional.create,nullableType=ZodNullable.create,preprocessType=ZodEffects.createWithPreprocess,pipelineType=ZodPipeline.create,ostring=()=>stringType().optional(),onumber=()=>numberType().optional(),oboolean=()=>booleanType().optional(),coerce={string:et=>ZodString.create({...et,coerce:!0}),number:et=>ZodNumber.create({...et,coerce:!0}),boolean:et=>ZodBoolean.create({...et,coerce:!0}),bigint:et=>ZodBigInt.create({...et,coerce:!0}),date:et=>ZodDate.create({...et,coerce:!0})},NEVER=INVALID;var z=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap,getErrorMap,makeIssue,EMPTY_PATH,addIssueToContext,ParseStatus,INVALID,DIRTY,OK,isAborted,isDirty,isValid,isAsync,get util(){return util},get objectUtil(){return objectUtil},ZodParsedType,getParsedType,ZodType,datetimeRegex,ZodString,ZodNumber,ZodBigInt,ZodBoolean,ZodDate,ZodSymbol,ZodUndefined,ZodNull,ZodAny,ZodUnknown,ZodNever,ZodVoid,ZodArray,ZodObject,ZodUnion,ZodDiscriminatedUnion,ZodIntersection,ZodTuple,ZodRecord,ZodMap,ZodSet,ZodFunction,ZodLazy,ZodLiteral,ZodEnum,ZodNativeEnum,ZodPromise,ZodEffects,ZodTransformer:ZodEffects,ZodOptional,ZodNullable,ZodDefault,ZodCatch,ZodNaN,BRAND,ZodBranded,ZodPipeline,ZodReadonly,custom,Schema:ZodType,ZodSchema:ZodType,late,get ZodFirstPartyTypeKind(){return ZodFirstPartyTypeKind},coerce,any:anyType,array:arrayType,bigint:bigIntType,boolean:booleanType,date:dateType,discriminatedUnion:discriminatedUnionType,effect:effectsType,enum:enumType,function:functionType,instanceof:instanceOfType,intersection:intersectionType,lazy:lazyType,literal:literalType,map:mapType,nan:nanType,nativeEnum:nativeEnumType,never:neverType,null:nullType,nullable:nullableType,number:numberType,object:objectType,oboolean,onumber,optional:optionalType,ostring,pipeline:pipelineType,preprocess:preprocessType,promise:promiseType,record:recordType,set:setType,strictObject:strictObjectType,string:stringType,symbol:symbolType,transformer:effectsType,tuple:tupleType,undefined:undefinedType,union:unionType,unknown:unknownType,void:voidType,NEVER,ZodIssueCode,quotelessJson,ZodError}),define_process_env_default={};function createEnv(et){const o=et.runtimeEnvStrict??et.runtimeEnv??define_process_env_default;if(et.emptyStringAsUndefined??!1)for(const[Ct,St]of Object.entries(o))St===""&&delete o[Ct];if(!!et.skipValidation)return o;const nt=typeof et.client=="object"?et.client:{},ot=typeof et.server=="object"?et.server:{},it=typeof et.shared=="object"?et.shared:{},st=z.object(nt),at=z.object(ot),ct=z.object(it),lt=et.isServer??typeof window>"u",dt=st.merge(ct),ht=at.merge(ct).merge(st),mt=lt?ht.safeParse(o):dt.safeParse(o),ft=et.onValidationError??(Ct=>{throw console.error("❌ Invalid environment variables:",Ct.flatten().fieldErrors),new Error("Invalid environment variables")}),pt=et.onInvalidAccess??(Ct=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(mt.success===!1)return ft(mt.error);const gt=Ct=>et.clientPrefix?!Ct.startsWith(et.clientPrefix)&&!(Ct in ct.shape):!0,yt=Ct=>lt||!gt(Ct),bt=Ct=>Ct==="__esModule"||Ct==="$$typeof",xt=(et.extends??[]).reduce((Ct,St)=>Object.assign(Ct,St),{}),vt=Object.assign(mt.data,xt);return new Proxy(vt,{get(Ct,St){if(typeof St=="string"&&!bt(St))return yt(St)?Reflect.get(Ct,St):pt(St)}})}const __vite_import_meta_env__={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1},env=createEnv({clientPrefix:"VITE_",client:{VITE_WALLETCONNECT_PROJECT_ID:z.string().min(1)},runtimeEnv:__vite_import_meta_env__}),config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:env.VITE_WALLETCONNECT_PROJECT_ID,chains:[mainnet],transports:{[mainnet.id]:http()}})),queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BytesSizeMismatchError as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,stringToHex as a,bytesToHex$3 as b,concat$6 as c,commonjsGlobal as d,encodeAbiParameters as e,encodeFunctionData as f,getAugmentedNamespace as g,getDefaultExportFromCjs as h,isAddress as i,browserExports as j,keccak256$1 as k,tslib_es6$1 as l,buffer as m,numberToHex as n,allocUnsafe$h as o,BASES$1 as p,fromString$2 as q,detect as r,size$2 as s,toHex as t,__viteBrowserExternal$1 as u,BaseError$3 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; diff --git a/buddybook/assets/index-CtjScd1r.js b/buddybook/assets/index-CtjScd1r.js new file mode 100644 index 0000000..17cc382 --- /dev/null +++ b/buddybook/assets/index-CtjScd1r.js @@ -0,0 +1,2 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D03YFe01.js","./index-CP6_TFKv.js","./index-Dt_CGZqf.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-CP6_TFKv.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-D03YFe01.js"),__vite__mapDeps([0,1,2]),import.meta.url);const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/buddybook/assets/index-wat9_83N.js b/buddybook/assets/index-D03YFe01.js similarity index 99% rename from buddybook/assets/index-wat9_83N.js rename to buddybook/assets/index-D03YFe01.js index 32aa5dd..2f1bc4e 100644 --- a/buddybook/assets/index-wat9_83N.js +++ b/buddybook/assets/index-D03YFe01.js @@ -1,4 +1,4 @@ -import{T as $t,M as oe,R as N,E as k,C as $,a as X,b as Br,O as Z,c as ht}from"./index-DY1ObU95.js";import{C as Wr}from"./index-B-6Lwopd.js";class Ur{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jr(e,t){e.indexOf(t)===-1&&e.push(t)}const Jo=(e,t,o)=>Math.min(Math.max(o,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),kr=(e,t,o)=>{const n=t-e;return((o-e)%n+n)%n+e};function Hr(e,t){return bt(e)?e[kr(0,e.length,t)]:e}const Qo=(e,t,o)=>-o*e+o*t+e,Xo=()=>{},et=e=>e,mo=(e,t,o)=>t-e===0?1:(o-e)/(t-e);function tr(e,t){const o=e[e.length-1];for(let n=1;n<=t;n++){const r=mo(0,t,n);e.push(Qo(o,1,r))}}function zr(e){const t=[0];return tr(t,e-1),t}function Fr(e,t=zr(e.length),o=et){const n=e.length,r=n-t.length;return r>0&&tr(t,r),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vr=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},or=(e,t,o)=>(((1-3*o+3*t)*e+(3*o-6*t))*e+3*t)*e,Zr=1e-7,Kr=12;function qr(e,t,o,n,r){let i,s,l=0;do s=t+(o-t)/2,i=or(s,n,r)-e,i>0?o=s:t=s;while(Math.abs(i)>Zr&&++lqr(i,0,1,e,o);return i=>i===0||i===1?i:or(r(i),t,n)}const Yr=(e,t="end")=>o=>{o=t==="end"?Math.min(o,.999):Math.max(o,.001);const n=o*e,r=t==="end"?Math.floor(n):Math.ceil(n);return Jo(0,1,r/e)},Gr={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jr=/\((.*?)\)/;function Ao(e){if(xt(e))return e;if(er(e))return Lt(...e);const t=Gr[e];if(t)return t;if(e.startsWith("steps")){const o=Jr.exec(e);if(o){const n=o[1].split(",");return Yr(parseFloat(n[0]),n[1].trim())}}return et}class rr{constructor(t,o=[0,1],{easing:n,duration:r=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(o);n=h.easing,o=h.keyframes||o,r=h.duration||r}this.repeat=l,this.easing=bt(n)?et:Ao(n),this.updateDuration(r);const y=Fr(o,a,bt(n)?n.map(Ao):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** +import{T as $t,M as oe,R as N,E as k,C as $,a as X,b as Br,O as Z,c as ht}from"./index-CtjScd1r.js";import{C as Wr}from"./index-CP6_TFKv.js";class Ur{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jr(e,t){e.indexOf(t)===-1&&e.push(t)}const Jo=(e,t,o)=>Math.min(Math.max(o,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),kr=(e,t,o)=>{const n=t-e;return((o-e)%n+n)%n+e};function Hr(e,t){return bt(e)?e[kr(0,e.length,t)]:e}const Qo=(e,t,o)=>-o*e+o*t+e,Xo=()=>{},et=e=>e,mo=(e,t,o)=>t-e===0?1:(o-e)/(t-e);function tr(e,t){const o=e[e.length-1];for(let n=1;n<=t;n++){const r=mo(0,t,n);e.push(Qo(o,1,r))}}function zr(e){const t=[0];return tr(t,e-1),t}function Fr(e,t=zr(e.length),o=et){const n=e.length,r=n-t.length;return r>0&&tr(t,r),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vr=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},or=(e,t,o)=>(((1-3*o+3*t)*e+(3*o-6*t))*e+3*t)*e,Zr=1e-7,Kr=12;function qr(e,t,o,n,r){let i,s,l=0;do s=t+(o-t)/2,i=or(s,n,r)-e,i>0?o=s:t=s;while(Math.abs(i)>Zr&&++lqr(i,0,1,e,o);return i=>i===0||i===1?i:or(r(i),t,n)}const Yr=(e,t="end")=>o=>{o=t==="end"?Math.min(o,.999):Math.max(o,.001);const n=o*e,r=t==="end"?Math.floor(n):Math.ceil(n);return Jo(0,1,r/e)},Gr={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jr=/\((.*?)\)/;function Ao(e){if(xt(e))return e;if(er(e))return Lt(...e);const t=Gr[e];if(t)return t;if(e.startsWith("steps")){const o=Jr.exec(e);if(o){const n=o[1].split(",");return Yr(parseFloat(n[0]),n[1].trim())}}return et}class rr{constructor(t,o=[0,1],{easing:n,duration:r=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(o);n=h.easing,o=h.keyframes||o,r=h.duration||r}this.repeat=l,this.easing=bt(n)?et:Ao(n),this.updateDuration(r);const y=Fr(o,a,bt(n)?n.map(Ao):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/buddybook/assets/index-Dz_NkDRB.js b/buddybook/assets/index-D0eaAjbe.js similarity index 98% rename from buddybook/assets/index-Dz_NkDRB.js rename to buddybook/assets/index-D0eaAjbe.js index 14fd86c..5fb3b2d 100644 --- a/buddybook/assets/index-Dz_NkDRB.js +++ b/buddybook/assets/index-D0eaAjbe.js @@ -1 +1 @@ -import{e as p}from"./events-BzDGR98G.js";function _(n,r){for(var i=0;ie[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var l={},g={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.getLowerCase=void 0;function m(n){return n&&n.toLowerCase()}f.getLowerCase=m;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const w=p,u=f;class k extends w.EventEmitter{constructor(r,i){super(),this.submittedTxs=new Map,this.safe=r,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(r){const{method:i,params:e=[]}=r;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[t,a]=e;if(this.safe.safeAddress.toLowerCase()!==a.toLowerCase())throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(t);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sign":{const[t,a]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!a.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(a);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,a]=e,h=typeof a=="string"?JSON.parse(a):a;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address is invalid");const c=await this.sdk.txs.signTypedMessage(h);return("signature"in c?c.signature:void 0)||"0x"}case"eth_sendTransaction":const s={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof s.gas=="string"&&s.gas.startsWith("0x")&&(s.gas=parseInt(s.gas,16));const o=await this.sdk.txs.send({txs:[s],params:{safeTxGas:s.gas}});return this.submittedTxs.set(o.safeTxHash,{from:this.safe.safeAddress,hash:o.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:s.data,value:s.value,to:s.to,blockHash:null,blockNumber:null,transactionIndex:null}),o.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,u.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let d=e[0];try{d=(await this.sdk.txs.getBySafeTxHash(d)).txHash||d}catch{}return this.submittedTxs.has(d)?this.submittedTxs.get(d):this.sdk.eth.getTransactionByHash([d]).then(t=>(t&&(t.hash=e[0]),t));case"eth_getTransactionReceipt":{let t=e[0];try{t=(await this.sdk.txs.getBySafeTxHash(t)).txHash||t}catch{}return this.sdk.eth.getTransactionReceipt([t]).then(a=>(a&&(a.transactionHash=e[0]),a))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);default:throw Error(`"${r.method}" not implemented`)}}send(r,i){r||i("Undefined request"),this.request(r).then(e=>i(null,{jsonrpc:"2.0",id:r.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=k;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var r=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return r.SafeAppProvider}})})(l);const T=_({__proto__:null},[l]);export{T as i}; +import{e as p}from"./events-0WpuQ3DP.js";function _(n,r){for(var i=0;ie[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var l={},g={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.getLowerCase=void 0;function m(n){return n&&n.toLowerCase()}f.getLowerCase=m;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const w=p,u=f;class k extends w.EventEmitter{constructor(r,i){super(),this.submittedTxs=new Map,this.safe=r,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(r){const{method:i,params:e=[]}=r;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[t,a]=e;if(this.safe.safeAddress.toLowerCase()!==a.toLowerCase())throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(t);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sign":{const[t,a]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!a.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(a);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,a]=e,h=typeof a=="string"?JSON.parse(a):a;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address is invalid");const c=await this.sdk.txs.signTypedMessage(h);return("signature"in c?c.signature:void 0)||"0x"}case"eth_sendTransaction":const s={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof s.gas=="string"&&s.gas.startsWith("0x")&&(s.gas=parseInt(s.gas,16));const o=await this.sdk.txs.send({txs:[s],params:{safeTxGas:s.gas}});return this.submittedTxs.set(o.safeTxHash,{from:this.safe.safeAddress,hash:o.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:s.data,value:s.value,to:s.to,blockHash:null,blockNumber:null,transactionIndex:null}),o.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,u.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let d=e[0];try{d=(await this.sdk.txs.getBySafeTxHash(d)).txHash||d}catch{}return this.submittedTxs.has(d)?this.submittedTxs.get(d):this.sdk.eth.getTransactionByHash([d]).then(t=>(t&&(t.hash=e[0]),t));case"eth_getTransactionReceipt":{let t=e[0];try{t=(await this.sdk.txs.getBySafeTxHash(t)).txHash||t}catch{}return this.sdk.eth.getTransactionReceipt([t]).then(a=>(a&&(a.transactionHash=e[0]),a))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);default:throw Error(`"${r.method}" not implemented`)}}send(r,i){r||i("Undefined request"),this.request(r).then(e=>i(null,{jsonrpc:"2.0",id:r.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=k;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var r=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return r.SafeAppProvider}})})(l);const T=_({__proto__:null},[l]);export{T as i}; diff --git a/buddybook/assets/index-DY1ObU95.js b/buddybook/assets/index-DY1ObU95.js deleted file mode 100644 index 9b83ece..0000000 --- a/buddybook/assets/index-DY1ObU95.js +++ /dev/null @@ -1,2 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-wat9_83N.js","assets/index-B-6Lwopd.js","assets/index-Dt_CGZqf.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-B-6Lwopd.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-wat9_83N.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/buddybook/assets/index-Rg7xls9w.js b/buddybook/assets/index-i9SwLR_n.js similarity index 99% rename from buddybook/assets/index-Rg7xls9w.js rename to buddybook/assets/index-i9SwLR_n.js index 706fd32..6b14570 100644 --- a/buddybook/assets/index-Rg7xls9w.js +++ b/buddybook/assets/index-i9SwLR_n.js @@ -1,2 +1,2 @@ -import{k as m,c as q,e as k,t as F,n as Ye,i as Je,I as Ze,s as B,B as xe,a as G,b as en,d as N,f as V}from"./index-B-6Lwopd.js";const nn=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tn=/^(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 an(e){const{domain:n={},message:t,primaryType:i}=e,r={EIP712Domain:un({domain:n}),...e.types};on({domain:n,message:t,primaryType:i,types:r});const a=["0x1901"];return n&&a.push(sn({domain:n,types:r})),i!=="EIP712Domain"&&a.push($({data:t,primaryType:i,types:r})),m(q(a))}function sn({domain:e,types:n}){return $({data:e,primaryType:"EIP712Domain",types:n})}function $({data:e,primaryType:n,types:t}){const i=K({data:e,primaryType:n,types:t});return m(i)}function K({data:e,primaryType:n,types:t}){const i=[{type:"bytes32"}],r=[cn({primaryType:n,types:t})];for(const a of t[n]){const[u,l]=Q({types:t,name:a.name,type:a.type,value:e[a.name]});i.push(u),r.push(l)}return k(i,r)}function cn({primaryType:e,types:n}){const t=F(rn({primaryType:e,types:n}));return m(t)}function rn({primaryType:e,types:n}){let t="";const i=X({primaryType:e,types:n});i.delete(e);const r=[e,...Array.from(i).sort()];for(const a of r)t+=`${a}(${n[a].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return t}function X({primaryType:e,types:n},t=new Set){const i=e.match(/^\w*/u),r=i==null?void 0:i[0];if(t.has(r)||n[r]===void 0)return t;t.add(r);for(const a of n[r])X({primaryType:a.type,types:n},t);return t}function Q({types:e,name:n,type:t,value:i}){if(e[t]!==void 0)return[{type:"bytes32"},m(K({data:i,primaryType:t,types:e}))];if(t==="bytes")return i=`0x${(i.length%2?"0":"")+i.slice(2)}`,[{type:"bytes32"},m(i)];if(t==="string")return[{type:"bytes32"},m(F(i))];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),a=i.map(u=>Q({name:n,type:r,types:e,value:u}));return[{type:"bytes32"},m(k(a.map(([u])=>u),a.map(([,u])=>u)))]}return[{type:t},i]}function on(e){const{domain:n,message:t,primaryType:i,types:r}=e,a=(u,l)=>{for(const f of u){const{name:v,type:g}=f,h=l[v],p=g.match(tn);if(p&&(typeof h=="number"||typeof h=="bigint")){const[M,S,L]=p;Ye(h,{signed:S==="int",size:Number.parseInt(L)/8})}if(g==="address"&&typeof h=="string"&&!Je(h))throw new Ze({address:h});const C=g.match(nn);if(C){const[M,S]=C;if(S&&B(h)!==Number.parseInt(S))throw new xe({expectedSize:Number.parseInt(S),givenSize:B(h)})}const D=r[g];D&&a(D,h)}};r.EIP712Domain&&n&&a(r.EIP712Domain,n),i!=="EIP712Domain"&&a(r[i],t)}function un({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const dn=`Ethereum Signed Message: +import{k as m,c as q,e as k,t as F,n as Ye,i as Je,I as Ze,s as B,B as xe,a as G,b as en,d as N,f as V}from"./index-CP6_TFKv.js";const nn=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,tn=/^(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 an(e){const{domain:n={},message:t,primaryType:i}=e,r={EIP712Domain:un({domain:n}),...e.types};on({domain:n,message:t,primaryType:i,types:r});const a=["0x1901"];return n&&a.push(sn({domain:n,types:r})),i!=="EIP712Domain"&&a.push($({data:t,primaryType:i,types:r})),m(q(a))}function sn({domain:e,types:n}){return $({data:e,primaryType:"EIP712Domain",types:n})}function $({data:e,primaryType:n,types:t}){const i=K({data:e,primaryType:n,types:t});return m(i)}function K({data:e,primaryType:n,types:t}){const i=[{type:"bytes32"}],r=[cn({primaryType:n,types:t})];for(const a of t[n]){const[u,l]=Q({types:t,name:a.name,type:a.type,value:e[a.name]});i.push(u),r.push(l)}return k(i,r)}function cn({primaryType:e,types:n}){const t=F(rn({primaryType:e,types:n}));return m(t)}function rn({primaryType:e,types:n}){let t="";const i=X({primaryType:e,types:n});i.delete(e);const r=[e,...Array.from(i).sort()];for(const a of r)t+=`${a}(${n[a].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return t}function X({primaryType:e,types:n},t=new Set){const i=e.match(/^\w*/u),r=i==null?void 0:i[0];if(t.has(r)||n[r]===void 0)return t;t.add(r);for(const a of n[r])X({primaryType:a.type,types:n},t);return t}function Q({types:e,name:n,type:t,value:i}){if(e[t]!==void 0)return[{type:"bytes32"},m(K({data:i,primaryType:t,types:e}))];if(t==="bytes")return i=`0x${(i.length%2?"0":"")+i.slice(2)}`,[{type:"bytes32"},m(i)];if(t==="string")return[{type:"bytes32"},m(F(i))];if(t.lastIndexOf("]")===t.length-1){const r=t.slice(0,t.lastIndexOf("[")),a=i.map(u=>Q({name:n,type:r,types:e,value:u}));return[{type:"bytes32"},m(k(a.map(([u])=>u),a.map(([,u])=>u)))]}return[{type:t},i]}function on(e){const{domain:n,message:t,primaryType:i,types:r}=e,a=(u,l)=>{for(const f of u){const{name:v,type:g}=f,h=l[v],p=g.match(tn);if(p&&(typeof h=="number"||typeof h=="bigint")){const[M,S,L]=p;Ye(h,{signed:S==="int",size:Number.parseInt(L)/8})}if(g==="address"&&typeof h=="string"&&!Je(h))throw new Ze({address:h});const C=g.match(nn);if(C){const[M,S]=C;if(S&&B(h)!==Number.parseInt(S))throw new xe({expectedSize:Number.parseInt(S),givenSize:B(h)})}const D=r[g];D&&a(D,h)}};r.EIP712Domain&&n&&a(r.EIP712Domain,n),i!=="EIP712Domain"&&a(r[i],t)}function un({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const dn=`Ethereum Signed Message: `;function ln(e){const n=typeof e=="string"?G(e):typeof e.raw=="string"?e.raw:en(e.raw),t=G(`${dn}${B(n)}`);return q([t,n])}function fn(e,n){return m(ln(e),n)}const gn=()=>"9.1.0",hn=e=>e.toString(16).padStart(2,"0"),En=e=>{const n=new Uint8Array(e/2);return window.crypto.getRandomValues(n),Array.from(n,hn).join("")},_n=()=>typeof window<"u"?En(10):new Date().getTime().toString(36);class w{}w.makeRequest=(e,n)=>({id:_n(),method:e,params:n,env:{sdkVersion:gn()}});w.makeResponse=(e,n,t)=>({id:e,success:!0,version:t,data:n});w.makeErrorResponse=(e,n,t)=>({id:e,success:!1,error:n,version:t});var E;(function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"})(E||(E={}));var H;(function(e){e.requestAddressBook="requestAddressBook"})(H||(H={}));class yn{constructor(n=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:i,data:r,source:a})=>{const u=!r,l=!this.isServer&&a===window.parent,f=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),v=typeof f=="number"&&f>=1;let g=!0;return Array.isArray(this.allowedOrigins)&&(g=this.allowedOrigins.find(h=>h.test(i))!==void 0),!u&&l&&v&&g},this.logIncomingMessage=i=>{console.info(`Safe Apps SDK v1: A message was received from origin ${i.origin}. `,i.data)},this.onParentMessage=i=>{this.isValidMessage(i)&&(this.debugMode&&this.logIncomingMessage(i),this.handleIncomingMessage(i.data))},this.handleIncomingMessage=i=>{const{id:r}=i,a=this.callbacks.get(r);a&&(a(i),this.callbacks.delete(r))},this.send=(i,r)=>{const a=w.makeRequest(i,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(a,"*"),new Promise((u,l)=>{this.callbacks.set(a.id,f=>{if(!f.success){l(new Error(f.error));return}u(f)})})},this.allowedOrigins=n,this.debugMode=t,this.isServer||window.addEventListener("message",this.onParentMessage)}}const z=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var Tn={},y={},T={},j=N&&N.__awaiter||function(e,n,t,i){function r(a){return a instanceof t?a:new t(function(u){u(a)})}return new(t||(t=Promise))(function(a,u){function l(g){try{v(i.next(g))}catch(h){u(h)}}function f(g){try{v(i.throw(g))}catch(h){u(h)}}function v(g){g.done?a(g.value):r(g.value).then(l,f)}v((i=i.apply(e,n||[])).next())})};Object.defineProperty(T,"__esModule",{value:!0});T.getData=T.fetchData=T.stringifyQuery=T.insertParams=void 0;const vn=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function In(e,n,t){return e.replace(new RegExp(`\\{${n}\\}`,"g"),t)}function An(e,n){return n?Object.keys(n).reduce((t,i)=>In(t,i,String(n[i])),e):e}T.insertParams=An;function mn(e){if(!e)return"";const n=new URLSearchParams;Object.keys(e).forEach(i=>{e[i]!=null&&n.append(i,String(e[i]))});const t=n.toString();return t?`?${t}`:""}T.stringifyQuery=mn;function Y(e){return j(this,void 0,void 0,function*(){let n;try{n=yield e.json()}catch{n={}}if(!e.ok){const t=vn(n)?`CGW error - ${n.code}: ${n.message}`:`CGW error - status ${e.statusText}`;throw new Error(t)}return n})}function Sn(e,n,t,i,r){return j(this,void 0,void 0,function*(){const a=Object.assign({"Content-Type":"application/json"},i),u={method:n??"POST",headers:a};r&&(u.credentials=r),t!=null&&(u.body=typeof t=="string"?t:JSON.stringify(t));const l=yield fetch(e,u);return Y(l)})}T.fetchData=Sn;function On(e,n,t){return j(this,void 0,void 0,function*(){const i={method:"GET"};n&&(i.headers=Object.assign(Object.assign({},n),{"Content-Type":"application/json"})),t&&(i.credentials=t);const r=yield fetch(e,i);return Y(r)})}T.getData=On;Object.defineProperty(y,"__esModule",{value:!0});y.getEndpoint=y.deleteEndpoint=y.putEndpoint=y.postEndpoint=void 0;const O=T;function P(e,n,t,i){const r=(0,O.insertParams)(n,t),a=(0,O.stringifyQuery)(i);return`${e}${r}${a}`}function Nn(e,n,t){const i=P(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,O.fetchData)(i,"POST",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}y.postEndpoint=Nn;function bn(e,n,t){const i=P(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,O.fetchData)(i,"PUT",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}y.putEndpoint=bn;function pn(e,n,t){const i=P(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,O.fetchData)(i,"DELETE",t==null?void 0:t.body,t==null?void 0:t.headers,t==null?void 0:t.credentials)}y.deleteEndpoint=pn;function Cn(e,n,t,i){if(i)return(0,O.getData)(i,void 0,t==null?void 0:t.credentials);const r=P(e,n,t==null?void 0:t.path,t==null?void 0:t.query);return(0,O.getData)(r,t==null?void 0:t.headers,t==null?void 0:t.credentials)}y.getEndpoint=Cn;var R={};Object.defineProperty(R,"__esModule",{value:!0});R.DEFAULT_BASE_URL=void 0;R.DEFAULT_BASE_URL="https://safe-client.safe.global";var J={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(n){n.UP_TO_DATE="UP_TO_DATE",n.OUTDATED="OUTDATED",n.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(J);var Z={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(n){n.NoRestrictions="NO_RESTRICTIONS",n.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(n){n.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(n){n.TWITTER="TWITTER",n.GITHUB="GITHUB",n.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(Z);var x={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.StartTimeValue=e.DurationType=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(n){n[n.CALL=0]="CALL",n[n.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(n){n.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",n.AWAITING_EXECUTION="AWAITING_EXECUTION",n.CANCELLED="CANCELLED",n.FAILED="FAILED",n.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(n){n.INCOMING="INCOMING",n.OUTGOING="OUTGOING",n.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(n){n.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",n.ADD_OWNER="ADD_OWNER",n.REMOVE_OWNER="REMOVE_OWNER",n.SWAP_OWNER="SWAP_OWNER",n.CHANGE_THRESHOLD="CHANGE_THRESHOLD",n.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",n.ENABLE_MODULE="ENABLE_MODULE",n.DISABLE_MODULE="DISABLE_MODULE",n.SET_GUARD="SET_GUARD",n.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(n){n.TRANSFER="Transfer",n.SETTINGS_CHANGE="SettingsChange",n.CUSTOM="Custom",n.CREATION="Creation",n.SWAP_ORDER="SwapOrder",n.TWAP_ORDER="TwapOrder",n.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(n){n.NONE="None",n.HAS_NEXT="HasNext",n.END="End"}(e.ConflictType||(e.ConflictType={})),function(n){n.TRANSACTION="TRANSACTION",n.LABEL="LABEL",n.CONFLICT_HEADER="CONFLICT_HEADER",n.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(n){n.MULTISIG="MULTISIG",n.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(n){n.AUTO="AUTO",n.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(n){n.AT_MINING_TIME="AT_MINING_TIME",n.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(n){n.Queued="Queued",n.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(x);var ee={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(n){n.API_KEY_PATH="API_KEY_PATH",n.NO_AUTHENTICATION="NO_AUTHENTICATION",n.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(n){n.ORACLE="ORACLE",n.FIXED="FIXED",n.FIXED_1559="FIXED1559",n.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(n){n.ERC721="ERC721",n.SAFE_APPS="SAFE_APPS",n.CONTRACT_INTERACTION="CONTRACT_INTERACTION",n.DOMAIN_LOOKUP="DOMAIN_LOOKUP",n.SPENDING_LIMIT="SPENDING_LIMIT",n.EIP1559="EIP1559",n.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",n.TX_SIMULATION="TX_SIMULATION",n.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(ee);var ne={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(n){n.ERC20="ERC20",n.ERC721="ERC721",n.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ne);var te={};Object.defineProperty(te,"__esModule",{value:!0});var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(n){n.COW_SWAP_ORDER="COW_SWAP_ORDER",n.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(ie);var ae={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(n){n.DATE_LABEL="DATE_LABEL",n.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(n){n.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",n.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(ae);var se={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(n){n.ANDROID="ANDROID",n.IOS="IOS",n.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(se);var ce={};Object.defineProperty(ce,"__esModule",{value:!0});(function(e){var n=N&&N.__createBinding||(Object.create?function(s,c,o,d){d===void 0&&(d=o);var A=Object.getOwnPropertyDescriptor(c,o);(!A||("get"in A?!c.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return c[o]}}),Object.defineProperty(s,d,A)}:function(s,c,o,d){d===void 0&&(d=o),s[d]=c[o]}),t=N&&N.__exportStar||function(s,c){for(var o in s)o!=="default"&&!Object.prototype.hasOwnProperty.call(c,o)&&n(c,s,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.deleteAccount=e.getAccount=e.createAccount=e.verifyAuth=e.getAuthNonce=e.getContract=e.getSafeOverviews=e.unsubscribeAll=e.unsubscribeSingle=e.registerRecoveryModule=e.deleteRegisteredEmail=e.getRegisteredEmail=e.verifyEmail=e.resendEmailVerificationCode=e.changeEmail=e.registerEmail=e.unregisterDevice=e.unregisterSafe=e.registerDevice=e.getDelegates=e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.getConfirmationView=e.proposeTransaction=e.getNonces=e.postSafeGasEstimation=e.deleteTransaction=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getAllOwnedSafes=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.getRelayCount=e.relayTransaction=e.setBaseUrl=void 0,e.putAccountDataSettings=e.getAccountDataSettings=e.getAccountDataTypes=void 0;const i=y,r=R;t(J,e),t(Z,e),t(x,e),t(ee,e),t(ne,e),t(te,e),t(ie,e),t(ae,e),t(se,e),t(ce,e);let a=r.DEFAULT_BASE_URL;const u=s=>{a=s};e.setBaseUrl=u;function l(s,c){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/relay",{path:{chainId:s},body:c})}e.relayTransaction=l;function f(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:s,address:c}})}e.getRelayCount=f;function v(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:s,address:c}})}e.getSafeInfo=v;function g(s,c,o,d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:s,address:c},query:o},d)}e.getIncomingTransfers=g;function h(s,c,o,d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:s,address:c},query:o},d)}e.getModuleTransactions=h;function p(s,c,o,d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:s,address:c},query:o},d)}e.getMultisigTransactions=p;function C(s,c,o="usd",d={}){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:s,address:c,currency:o},query:d})}e.getBalances=C;function D(){return(0,i.getEndpoint)(a,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=D;function M(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:s,address:c}})}e.getOwnedSafes=M;function S(s){return(0,i.getEndpoint)(a,"/v1/owners/{address}/safes",{path:{address:s}})}e.getAllOwnedSafes=S;function L(s,c,o={}){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:s,address:c},query:o})}e.getCollectibles=L;function ue(s,c,o={},d){return(0,i.getEndpoint)(a,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:s,address:c},query:o},d)}e.getCollectiblesPage=ue;function de(s,c,o={},d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:s,safe_address:c},query:o},d)}e.getTransactionHistory=de;function le(s,c,o={},d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:s,safe_address:c},query:o},d)}e.getTransactionQueue=le;function fe(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:s,transactionId:c}})}e.getTransactionDetails=fe;function ge(s,c,o){return(0,i.deleteEndpoint)(a,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:s,safeTxHash:c},body:{signature:o}})}e.deleteTransaction=ge;function he(s,c,o){return(0,i.postEndpoint)(a,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:s,safe_address:c},body:o})}e.postSafeGasEstimation=he;function Ee(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:s,safe_address:c}})}e.getNonces=Ee;function _e(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:s,safe_address:c},body:o})}e.proposeTransaction=_e;function ye(s,c,o,d){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:s,safe_address:c},body:{data:o,to:d}})}e.getConfirmationView=ye;function Te(s){return(0,i.getEndpoint)(a,"/v1/chains",{query:s})}e.getChainsConfig=Te;function ve(s){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}",{path:{chainId:s}})}e.getChainConfig=ve;function Ie(s,c={}){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safe-apps",{path:{chainId:s},query:c})}e.getSafeApps=Ie;function Ae(s){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:s}})}e.getMasterCopies=Ae;function me(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/data-decoder",{path:{chainId:s},body:{data:c,to:o}})}e.getDecodedData=me;function Se(s,c,o){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:s,safe_address:c},query:{}},o)}e.getSafeMessages=Se;function Oe(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:s,message_hash:c}})}e.getSafeMessage=Oe;function Ne(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:s,safe_address:c},body:o})}e.proposeSafeMessage=Ne;function be(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:s,message_hash:c},body:o})}e.confirmSafeMessage=be;function pe(s,c={}){return(0,i.getEndpoint)(a,"/v2/chains/{chainId}/delegates",{path:{chainId:s},query:c})}e.getDelegates=pe;function Ce(s){return(0,i.postEndpoint)(a,"/v1/register/notifications",{body:s})}e.registerDevice=Ce;function De(s,c,o){return(0,i.deleteEndpoint)(a,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:s,safe_address:c,uuid:o}})}e.unregisterSafe=De;function we(s,c){return(0,i.deleteEndpoint)(a,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:s,uuid:c}})}e.unregisterDevice=we;function Pe(s,c,o,d){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:s,safe_address:c},body:o,headers:d})}e.registerEmail=Pe;function Re(s,c,o,d,A){return(0,i.putEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:s,safe_address:c,signer:o},body:d,headers:A})}e.changeEmail=Re;function Me(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:s,safe_address:c,signer:o},body:""})}e.resendEmailVerificationCode=Me;function Le(s,c,o,d){return(0,i.putEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:s,safe_address:c,signer:o},body:d})}e.verifyEmail=Le;function Be(s,c,o,d){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:s,safe_address:c,signer:o},headers:d})}e.getRegisteredEmail=Be;function He(s,c,o,d){return(0,i.deleteEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:s,safe_address:c,signer:o},headers:d})}e.deleteRegisteredEmail=He;function Ue(s,c,o){return(0,i.postEndpoint)(a,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:s,safe_address:c},body:o})}e.registerRecoveryModule=Ue;function je(s){return(0,i.deleteEndpoint)(a,"/v1/subscriptions",{query:s})}e.unsubscribeSingle=je;function Ge(s){return(0,i.deleteEndpoint)(a,"/v1/subscriptions/all",{query:s})}e.unsubscribeAll=Ge;function Ve(s,c){return(0,i.getEndpoint)(a,"/v1/safes",{query:Object.assign(Object.assign({},c),{safes:s.join(",")})})}e.getSafeOverviews=Ve;function We(s,c){return(0,i.getEndpoint)(a,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:s,contractAddress:c}})}e.getContract=We;function qe(){return(0,i.getEndpoint)(a,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=qe;function ke(s){return(0,i.postEndpoint)(a,"/v1/auth/verify",{body:s,credentials:"include"})}e.verifyAuth=ke;function Fe(s){return(0,i.postEndpoint)(a,"/v1/accounts",{body:s,credentials:"include"})}e.createAccount=Fe;function $e(s){return(0,i.getEndpoint)(a,"/v1/accounts/{address}",{path:{address:s},credentials:"include"})}e.getAccount=$e;function Ke(s){return(0,i.deleteEndpoint)(a,"/v1/accounts/{address}",{path:{address:s},credentials:"include"})}e.deleteAccount=Ke;function Xe(){return(0,i.getEndpoint)(a,"/v1/accounts/data-types")}e.getAccountDataTypes=Xe;function Qe(s){return(0,i.getEndpoint)(a,"/v1/accounts/{address}/data-settings",{path:{address:s},credentials:"include"})}e.getAccountDataSettings=Qe;function ze(s,c){return(0,i.putEndpoint)(a,"/v1/accounts/{address}/data-settings",{path:{address:s},body:c,credentials:"include"})}e.putAccountDataSettings=ze})(Tn);class Dn{constructor(n){this.communicator=n}async getBySafeTxHash(n){if(!n)throw new Error("Invalid safeTxHash");return(await this.communicator.send(E.getTxBySafeTxHash,{safeTxHash:n})).data}async signMessage(n){const t={message:n};return(await this.communicator.send(E.signMessage,t)).data}async signTypedMessage(n){if(!z(n))throw new Error("Invalid typed data");return(await this.communicator.send(E.signTypedMessage,{typedData:n})).data}async send({txs:n,params:t}){if(!n||!n.length)throw new Error("No transactions were passed");const i={txs:n,params:t};return(await this.communicator.send(E.sendTransactions,i)).data}}const _={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},I={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class wn{constructor(n){this.communicator=n,this.call=this.buildRequest({call:_.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:_.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:_.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:_.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:_.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:_.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:_.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:_.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:_.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:_.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:_.eth_gasPrice}),this.getEstimateGas=t=>this.buildRequest({call:_.eth_estimateGas})([t]),this.setSafeSettings=this.buildRequest({call:_.safe_setSettings})}buildRequest(n){const{call:t,formatters:i}=n;return async r=>{i&&Array.isArray(r)&&i.forEach((l,f)=>{l&&(r[f]=l(r[f]))});const a={call:t,params:r||[]};return(await this.communicator.send(E.rpcCall,a)).data}}}const Pn="0x1626ba7e",Rn="0x20c13b0b",U=4001;class b extends Error{constructor(n,t,i){super(n),this.code=t,this.data=i,Object.setPrototypeOf(this,b.prototype)}}class re{constructor(n){this.communicator=n}async getPermissions(){return(await this.communicator.send(E.wallet_getPermissions,void 0)).data}async requestPermissions(n){if(!this.isPermissionRequestValid(n))throw new b("Permissions request is invalid",U);try{return(await this.communicator.send(E.wallet_requestPermissions,n)).data}catch{throw new b("Permissions rejected",U)}}isPermissionRequestValid(n){return n.every(t=>typeof t=="object"?Object.keys(t).every(i=>!!Object.values(H).includes(i)):!1)}}const W=(e,n)=>n.some(t=>t.parentCapability===e),Mn=()=>(e,n,t)=>{const i=t.value;return t.value=async function(){const r=new re(this.communicator);let a=await r.getPermissions();if(W(n,a)||(a=await r.requestPermissions([{[n]:{}}])),!W(n,a))throw new b("Permissions rejected",U);return i.apply(this)},t};var Ln=function(e,n,t,i){var r=arguments.length,a=r<3?n:i===null?i=Object.getOwnPropertyDescriptor(n,t):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(e,n,t,i);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(a=(r<3?u(a):r>3?u(n,t,a):u(n,t))||a);return r>3&&a&&Object.defineProperty(n,t,a),a};class oe{constructor(n){this.communicator=n}async getChainInfo(){return(await this.communicator.send(E.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(E.getSafeInfo,void 0)).data}async experimental_getBalances({currency:n="usd"}={}){return(await this.communicator.send(E.getSafeBalances,{currency:n})).data}async check1271Signature(n,t="0x"){const i=await this.getInfo(),r=V({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[n,t]}),a={call:_.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,a)).data.slice(0,10).toLowerCase()===Pn}catch{return!1}}async check1271SignatureBytes(n,t="0x"){const i=await this.getInfo(),r=V({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[n,t]}),a={call:_.eth_call,params:[{to:i.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,a)).data.slice(0,10).toLowerCase()===Rn}catch{return!1}}calculateMessageHash(n){return fn(n)}calculateTypedMessageHash(n){const t=typeof n.domain.chainId=="object"?n.domain.chainId.toNumber():Number(n.domain.chainId);let i=n.primaryType;if(!i){const r=Object.values(n.types),a=Object.keys(n.types).filter(u=>r.every(l=>l.every(({type:f})=>f.replace("[","").replace("]","")!==u)));if(a.length===0||a.length>1)throw new Error("Please specify primaryType");i=a[0]}return an({message:n.message,domain:{...n.domain,chainId:t,verifyingContract:n.domain.verifyingContract,salt:n.domain.salt},types:n.types,primaryType:i})}async getOffChainSignature(n){return(await this.communicator.send(E.getOffChainSignature,n)).data}async isMessageSigned(n,t="0x"){let i;if(typeof n=="string"&&(i=async()=>{const r=this.calculateMessageHash(n);return await this.isMessageHashSigned(r,t)}),z(n)&&(i=async()=>{const r=this.calculateTypedMessageHash(n);return await this.isMessageHashSigned(r,t)}),i)return await i();throw new Error("Invalid message type")}async isMessageHashSigned(n,t="0x"){const i=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of i)if(await r(n,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(E.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(E.requestAddressBook,void 0)).data}}Ln([Mn()],oe.prototype,"requestAddressBook",null);class Hn{constructor(n={}){const{allowedDomains:t=null,debug:i=!1}=n;this.communicator=new yn(t,i),this.eth=new wn(this.communicator),this.txs=new Dn(this.communicator),this.safe=new oe(this.communicator),this.wallet=new re(this.communicator)}}export{w as MessageFormatter,E as Methods,_ as RPC_CALLS,H as RestrictedMethods,Hn as default,gn as getSDKVersion,z as isObjectEIP712TypedData}; diff --git a/buddybook/assets/index.es-KLKTVizS.js b/buddybook/assets/index.es-DaAD1bdq.js similarity index 99% rename from buddybook/assets/index.es-KLKTVizS.js rename to buddybook/assets/index.es-DaAD1bdq.js index f6bc8c1..2c61350 100644 --- a/buddybook/assets/index.es-KLKTVizS.js +++ b/buddybook/assets/index.es-DaAD1bdq.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DY1ObU95.js","assets/index-B-6Lwopd.js","assets/index-Dt_CGZqf.css"])))=>i.map(i=>d[i]); -import{g as Tv,o as U4,p as $4,d as ji,q as Ar,r as z4,h as S0,_ as j4}from"./index-B-6Lwopd.js";import{e as Hi,J as I0}from"./events-BzDGR98G.js";import{r as M0,i as xh}from"./inherits_browser-BwZ6FBWK.js";var xe={};/*! ***************************************************************************** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CtjScd1r.js","./index-CP6_TFKv.js","./index-Dt_CGZqf.css"])))=>i.map(i=>d[i]); +import{g as Tv,o as U4,p as $4,d as ji,q as Ar,r as z4,h as S0,_ as j4}from"./index-CP6_TFKv.js";import{e as Hi,J as I0}from"./events-0WpuQ3DP.js";import{r as M0,i as xh}from"./inherits_browser-C53US4G5.js";var xe={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -67,4 +67,4 @@ __p += '`),Ct&&(ge+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ge+`return __p -}`;var wt=r1(function(){return Ft(L,We+"return "+ge).apply(t,J)});if(wt.source=ge,Wu(wt))throw wt;return wt}function V5(s){return Bt(s).toLowerCase()}function G5(s){return Bt(s).toUpperCase()}function W5(s,o,l){if(s=Bt(s),s&&(l||o===t))return ud(s);if(!s||!(o=vi(o)))return s;var E=en(s),C=en(o),L=ld(E,C),J=dd(E,C)+1;return Is(E,L,J).join("")}function J5(s,o,l){if(s=Bt(s),s&&(l||o===t))return s.slice(0,gd(s)+1);if(!s||!(o=vi(o)))return s;var E=en(s),C=dd(E,en(o))+1;return Is(E,0,C).join("")}function Y5(s,o,l){if(s=Bt(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var E=en(s),C=ld(E,en(o));return Is(E,C).join("")}function Q5(s,o){var l=le,E=F;if(Zt(o)){var C="separator"in o?o.separator:C;l="length"in o?yt(o.length):l,E="omission"in o?vi(o.omission):E}s=Bt(s);var L=s.length;if(Ca(s)){var J=en(s);L=J.length}if(l>=L)return s;var X=l-Ta(E);if(X<1)return E;var ie=J?Is(J,0,X).join(""):s.slice(0,X);if(C===t)return ie+E;if(J&&(X+=ie.length-X),Ju(C)){if(s.slice(X).search(C)){var ue,de=ie;for(C.global||(C=uu(C.source,Bt(bt.exec(C))+"g")),C.lastIndex=0;ue=C.exec(de);)var ge=ue.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(C),X)!=X){var Pe=ie.lastIndexOf(C);Pe>-1&&(ie=ie.slice(0,Pe))}return ie+E}function X5(s){return s=Bt(s),s&&Fe.test(s)?s.replace(Et,Mm):s}var Z5=$a(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Xu=ip("toUpperCase");function t1(s,o,l){return s=Bt(s),o=l?t:o,o===t?Am(s)?Rm(s):dm(s):s.match(o)||[]}var r1=At(function(s,o){try{return br(s,t,o)}catch(l){return Wu(l)?l:new dt(l)}}),e4=Zn(function(s,o){return Pi(o,function(l){l=_n(l),Qn(s,l,Vu(s[l],s))}),s});function t4(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(E){if(typeof E[1]!="function")throw new Oi(f);return[l(E[0]),E[1]]}):[],At(function(E){for(var C=-1;++CM)return[];var l=g,E=qr(s,g);o=nt(o),s-=g;for(var C=cu(E,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(g)},yn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),E=/^(?:head|last)$/.test(o),C=D[E?"take"+(o=="last"?"Right":""):o],L=E||/^find/.test(o);C&&(D.prototype[o]=function(){var J=this.__wrapped__,X=E?[1]:arguments,ie=J instanceof Mt,ue=X[0],de=ie||gt(J),ge=function(xt){var Ct=C.apply(D,ws([xt],X));return E&&Pe?Ct[0]:Ct};de&&l&&typeof ue=="function"&&ue.length!=1&&(ie=de=!1);var Pe=this.__chain__,We=!!this.__actions__.length,ot=L&&!Pe,wt=ie&&!We;if(!L&&de){J=wt?J:new Mt(this);var ct=s.apply(J,X);return ct.__actions__.push({func:Of,args:[ge],thisArg:t}),new Ri(ct,Pe)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?E?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=ef[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",E=/^(?:pop|shift)$/.test(s);D.prototype[s]=function(){var C=arguments;if(E&&!this.__chain__){var L=this.value();return o.apply(gt(L)?L:[],C)}return this[l](function(J){return o.apply(gt(J)?J:[],C)})}}),yn(Mt.prototype,function(s,o){var l=D[o];if(l){var E=l.name+"";Lt.call(qa,E)||(qa[E]=[]),qa[E].push({name:o,func:l})}}),qa[Af(t,Q).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Xm,Mt.prototype.reverse=Zm,Mt.prototype.value=e6,D.prototype.at=O3,D.prototype.chain=R3,D.prototype.commit=N3,D.prototype.next=C3,D.prototype.plant=D3,D.prototype.reverse=F3,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=B3,D.prototype.first=D.prototype.head,Oo&&(D.prototype[Oo]=T3),D},Da=Nm();sr?((sr.exports=Da)._=Da,kt._=Da):Nt._=Da}).call(rc)})(A0,A0.exports);var tC=Object.defineProperty,rC=Object.defineProperties,iC=Object.getOwnPropertyDescriptors,_v=Object.getOwnPropertySymbols,nC=Object.prototype.hasOwnProperty,sC=Object.prototype.propertyIsEnumerable,Av=(r,e,t)=>e in r?tC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gf=(r,e)=>{for(var t in e||(e={}))nC.call(e,t)&&Av(r,t,e[t]);if(_v)for(var t of _v(e))sC.call(e,t)&&Av(r,t,e[t]);return r},aC=(r,e)=>rC(r,iC(e));function pn(r,e,t){var i;const n=ac(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${sm}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ia(r){return r.includes(":")?r.split(":")[1]:r}function am(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function oC(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function zl(r={},e={}){const t=Ev(r),i=Ev(e);return A0.exports.merge(t,i)}function Ev(r){var e,t,i,n;const a={};if(!bc(r))return a;for(const[f,u]of Object.entries(r)){const b=J0(f)?[f]:u.chains,p=u.methods||[],y=u.events||[],A=u.rpcMap||{},R=sc(f);a[R]=aC(Gf(Gf({},a[R]),u),{chains:Qf(b,(e=a[R])==null?void 0:e.chains),methods:Qf(p,(t=a[R])==null?void 0:t.methods),events:Qf(y,(i=a[R])==null?void 0:i.events),rpcMap:Gf(Gf({},A),(n=a[R])==null?void 0:n.rpcMap)})}return a}function cC(r){return r.includes(":")?r.split(":")[2]:r}function xv(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],f=i.accounts||[],u=J0(t)?[t]:i.chains?i.chains:am(i.accounts);e[t]={chains:u,methods:n,events:a,accounts:f}}return e}function jl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const om={},qt=r=>om[r],kl=(r,e)=>{om[r]=e};class fC{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}var hC=Object.defineProperty,uC=Object.defineProperties,lC=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,dC=Object.prototype.hasOwnProperty,pC=Object.prototype.propertyIsEnumerable,Iv=(r,e,t)=>e in r?hC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mv=(r,e)=>{for(var t in e||(e={}))dC.call(e,t)&&Iv(r,t,e[t]);if(Sv)for(var t of Sv(e))pC.call(e,t)&&Iv(r,t,e[t]);return r},Pv=(r,e)=>uC(r,lC(e));class gC{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||pn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Ia(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),u=((n=f==null?void 0:f.sessionProperties)==null?void 0:n.capabilities)||{};if(u!=null&&u[a])return u==null?void 0:u[a];const b=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Pv(Mv({},f.sessionProperties||{}),{capabilities:Pv(Mv({},u||{}),{[a]:b})})})}catch(p){console.warn("Failed to update session with capabilities",p)}return b}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const u=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(u,e)}catch(b){console.warn("Failed to fetch call status from bundler",b,u)}}const f=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(qs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${eC}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class vC{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class bC{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class mC{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||pn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new gn(new Gn(i,qt("disableProviderPing")))}}class yC{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Ia(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class wC{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class _C{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class AC{constructor(e){this.name="near",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||pn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace);return typeof i>"u"?void 0:new gn(new Gn(i,qt("disableProviderPing")))}}class EC{constructor(e){this.name=Ya,this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=ac(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}var xC=Object.defineProperty,SC=Object.defineProperties,IC=Object.getOwnPropertyDescriptors,Ov=Object.getOwnPropertySymbols,MC=Object.prototype.hasOwnProperty,PC=Object.prototype.propertyIsEnumerable,Rv=(r,e,t)=>e in r?xC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wf=(r,e)=>{for(var t in e||(e={}))MC.call(e,t)&&Rv(r,t,e[t]);if(Ov)for(var t of Ov(e))PC.call(e,t)&&Rv(r,t,e[t]);return r},Hl=(r,e)=>SC(r,IC(e));class nd{constructor(e){this.events=new I0,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Nc(Hh({level:(e==null?void 0:e.logger)||yv})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new nd(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Wf({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(f=>t(null,Kh(a,f))).catch(f=>t(f,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Ut("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const f=xv(this.session.namespaces);this.namespaces=zl(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const f=xv(a.namespaces);this.namespaces=zl(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==nm)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===Ya?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(jn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await id.init({core:this.providerOpts.core,logger:this.providerOpts.logger||yv,relayUrl:this.providerOpts.relayUrl||QN,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>sc(t)))];kl("client",this.client),kl("events",this.events),kl("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=oC(t,this.session),n=am(i),a=zl(this.namespaces,this.optionalNamespaces),f=Hl(Wf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new gC({namespace:f});break;case"algorand":this.rpcProviders[t]=new mC({namespace:f});break;case"solana":this.rpcProviders[t]=new vC({namespace:f});break;case"cosmos":this.rpcProviders[t]=new bC({namespace:f});break;case"polkadot":this.rpcProviders[t]=new fC({namespace:f});break;case"cip34":this.rpcProviders[t]=new yC({namespace:f});break;case"elrond":this.rpcProviders[t]=new wC({namespace:f});break;case"multiversx":this.rpcProviders[t]=new _C({namespace:f});break;case"near":this.rpcProviders[t]=new AC({namespace:f});break;default:this.rpcProviders[Ya]?this.rpcProviders[Ya].updateNamespace(f):this.rpcProviders[Ya]=new EC({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&jn(n)&&this.events.emit("accountsChanged",n.map(cC))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,f=sc(n),u=jl(n)!==jl(a)?`${f}:${jl(a)}`:n;this.onChainChanged(u)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=Hl(Wf({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Hl(Wf({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(vn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Ya]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(f=>sc(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=sc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${wv}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${wv}/${e}`)}}const OC=nd,RC="wc",NC="ethereum_provider",CC=`${RC}@2:${NC}:`,TC="https://rpc.walletconnect.org/v1/",E0=["eth_sendTransaction","personal_sign"],DC=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],x0=["chainChanged","accountsChanged"],FC=["chainChanged","accountsChanged","message","disconnect","connect"];var BC=Object.defineProperty,qC=Object.defineProperties,LC=Object.getOwnPropertyDescriptors,Nv=Object.getOwnPropertySymbols,UC=Object.prototype.hasOwnProperty,$C=Object.prototype.propertyIsEnumerable,Cv=(r,e,t)=>e in r?BC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qa=(r,e)=>{for(var t in e||(e={}))UC.call(e,t)&&Cv(r,t,e[t]);if(Nv)for(var t of Nv(e))$C.call(e,t)&&Cv(r,t,e[t]);return r},Kl=(r,e)=>qC(r,LC(e));function Eh(r){return Number(r[0].split(":")[1])}function Jf(r){return`0x${r.toString(16)}`}function zC(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:f,rpcMap:u}=r;if(!jn(e))throw new Error("Invalid chains");const b={chains:e,methods:i||E0,events:a||x0,rpcMap:Qa({},e.length?{[Eh(e)]:u[Eh(e)]}:{})},p=a==null?void 0:a.filter(O=>!x0.includes(O)),y=i==null?void 0:i.filter(O=>!E0.includes(O));if(!t&&!f&&!n&&!(p!=null&&p.length)&&!(y!=null&&y.length))return{required:e.length?b:void 0};const A=(p==null?void 0:p.length)&&(y==null?void 0:y.length)||!t,R={chains:[...new Set(A?b.chains.concat(t||[]):t)],methods:[...new Set(b.methods.concat(n!=null&&n.length?n:DC))],events:[...new Set(b.events.concat(f!=null&&f.length?f:FC))],rpcMap:u};return{required:e.length?b:void 0,optional:t.length?R:void 0}}class sd{constructor(){this.events=new Hi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CC,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new sd;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=zC(this.rpc);try{const n=await new Promise(async(f,u)=>{var b;this.rpc.showQrModal&&((b=this.modal)==null||b.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Kl(Qa({namespaces:Qa({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(p=>{f(p)}).catch(p=>{u(new Error(p.message))})});if(!n)return;const a=T1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Jf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,f)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Kl(Qa({},e),{chains:this.rpc.chains}),t).then(b=>{a(b)}).catch(b=>{f(new Error(b.message))})}),n=i.session;if(n){const a=T1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Jf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Jf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Kl(Qa({},Ut("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Jf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],f=n.concat(a);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=n.length?(e==null?void 0:e.methods)||E0:[],b=n.length?(e==null?void 0:e.events)||x0:[],p=(e==null?void 0:e.optionalMethods)||[],y=(e==null?void 0:e.optionalEvents)||[],A=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),R=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(O=>this.formatChainId(O)),optionalChains:a.map(O=>this.formatChainId(O)),methods:u,events:b,optionalMethods:p,optionalEvents:y,rpcMap:A,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:R,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Eh(this.rpc.chains):Eh(this.rpc.optionalChains),this.signer=await OC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await j4(()=>import("./index-DY1ObU95.js").then(n=>n.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Qa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&jn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&jn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${TC}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const dT=sd;export{dT as EthereumProvider,FC as OPTIONAL_EVENTS,DC as OPTIONAL_METHODS,x0 as REQUIRED_EVENTS,E0 as REQUIRED_METHODS,sd as default}; +}`;var wt=r1(function(){return Ft(L,We+"return "+ge).apply(t,J)});if(wt.source=ge,Wu(wt))throw wt;return wt}function V5(s){return Bt(s).toLowerCase()}function G5(s){return Bt(s).toUpperCase()}function W5(s,o,l){if(s=Bt(s),s&&(l||o===t))return ud(s);if(!s||!(o=vi(o)))return s;var E=en(s),C=en(o),L=ld(E,C),J=dd(E,C)+1;return Is(E,L,J).join("")}function J5(s,o,l){if(s=Bt(s),s&&(l||o===t))return s.slice(0,gd(s)+1);if(!s||!(o=vi(o)))return s;var E=en(s),C=dd(E,en(o))+1;return Is(E,0,C).join("")}function Y5(s,o,l){if(s=Bt(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var E=en(s),C=ld(E,en(o));return Is(E,C).join("")}function Q5(s,o){var l=le,E=F;if(Zt(o)){var C="separator"in o?o.separator:C;l="length"in o?yt(o.length):l,E="omission"in o?vi(o.omission):E}s=Bt(s);var L=s.length;if(Ca(s)){var J=en(s);L=J.length}if(l>=L)return s;var X=l-Ta(E);if(X<1)return E;var ie=J?Is(J,0,X).join(""):s.slice(0,X);if(C===t)return ie+E;if(J&&(X+=ie.length-X),Ju(C)){if(s.slice(X).search(C)){var ue,de=ie;for(C.global||(C=uu(C.source,Bt(bt.exec(C))+"g")),C.lastIndex=0;ue=C.exec(de);)var ge=ue.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(C),X)!=X){var Pe=ie.lastIndexOf(C);Pe>-1&&(ie=ie.slice(0,Pe))}return ie+E}function X5(s){return s=Bt(s),s&&Fe.test(s)?s.replace(Et,Mm):s}var Z5=$a(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Xu=ip("toUpperCase");function t1(s,o,l){return s=Bt(s),o=l?t:o,o===t?Am(s)?Rm(s):dm(s):s.match(o)||[]}var r1=At(function(s,o){try{return br(s,t,o)}catch(l){return Wu(l)?l:new dt(l)}}),e4=Zn(function(s,o){return Pi(o,function(l){l=_n(l),Qn(s,l,Vu(s[l],s))}),s});function t4(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(E){if(typeof E[1]!="function")throw new Oi(f);return[l(E[0]),E[1]]}):[],At(function(E){for(var C=-1;++CM)return[];var l=g,E=qr(s,g);o=nt(o),s-=g;for(var C=cu(E,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(g)},yn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),E=/^(?:head|last)$/.test(o),C=D[E?"take"+(o=="last"?"Right":""):o],L=E||/^find/.test(o);C&&(D.prototype[o]=function(){var J=this.__wrapped__,X=E?[1]:arguments,ie=J instanceof Mt,ue=X[0],de=ie||gt(J),ge=function(xt){var Ct=C.apply(D,ws([xt],X));return E&&Pe?Ct[0]:Ct};de&&l&&typeof ue=="function"&&ue.length!=1&&(ie=de=!1);var Pe=this.__chain__,We=!!this.__actions__.length,ot=L&&!Pe,wt=ie&&!We;if(!L&&de){J=wt?J:new Mt(this);var ct=s.apply(J,X);return ct.__actions__.push({func:Of,args:[ge],thisArg:t}),new Ri(ct,Pe)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?E?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=ef[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",E=/^(?:pop|shift)$/.test(s);D.prototype[s]=function(){var C=arguments;if(E&&!this.__chain__){var L=this.value();return o.apply(gt(L)?L:[],C)}return this[l](function(J){return o.apply(gt(J)?J:[],C)})}}),yn(Mt.prototype,function(s,o){var l=D[o];if(l){var E=l.name+"";Lt.call(qa,E)||(qa[E]=[]),qa[E].push({name:o,func:l})}}),qa[Af(t,Q).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Xm,Mt.prototype.reverse=Zm,Mt.prototype.value=e6,D.prototype.at=O3,D.prototype.chain=R3,D.prototype.commit=N3,D.prototype.next=C3,D.prototype.plant=D3,D.prototype.reverse=F3,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=B3,D.prototype.first=D.prototype.head,Oo&&(D.prototype[Oo]=T3),D},Da=Nm();sr?((sr.exports=Da)._=Da,kt._=Da):Nt._=Da}).call(rc)})(A0,A0.exports);var tC=Object.defineProperty,rC=Object.defineProperties,iC=Object.getOwnPropertyDescriptors,_v=Object.getOwnPropertySymbols,nC=Object.prototype.hasOwnProperty,sC=Object.prototype.propertyIsEnumerable,Av=(r,e,t)=>e in r?tC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gf=(r,e)=>{for(var t in e||(e={}))nC.call(e,t)&&Av(r,t,e[t]);if(_v)for(var t of _v(e))sC.call(e,t)&&Av(r,t,e[t]);return r},aC=(r,e)=>rC(r,iC(e));function pn(r,e,t){var i;const n=ac(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${sm}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ia(r){return r.includes(":")?r.split(":")[1]:r}function am(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function oC(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function zl(r={},e={}){const t=Ev(r),i=Ev(e);return A0.exports.merge(t,i)}function Ev(r){var e,t,i,n;const a={};if(!bc(r))return a;for(const[f,u]of Object.entries(r)){const b=J0(f)?[f]:u.chains,p=u.methods||[],y=u.events||[],A=u.rpcMap||{},R=sc(f);a[R]=aC(Gf(Gf({},a[R]),u),{chains:Qf(b,(e=a[R])==null?void 0:e.chains),methods:Qf(p,(t=a[R])==null?void 0:t.methods),events:Qf(y,(i=a[R])==null?void 0:i.events),rpcMap:Gf(Gf({},A),(n=a[R])==null?void 0:n.rpcMap)})}return a}function cC(r){return r.includes(":")?r.split(":")[2]:r}function xv(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],f=i.accounts||[],u=J0(t)?[t]:i.chains?i.chains:am(i.accounts);e[t]={chains:u,methods:n,events:a,accounts:f}}return e}function jl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const om={},qt=r=>om[r],kl=(r,e)=>{om[r]=e};class fC{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}var hC=Object.defineProperty,uC=Object.defineProperties,lC=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,dC=Object.prototype.hasOwnProperty,pC=Object.prototype.propertyIsEnumerable,Iv=(r,e,t)=>e in r?hC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mv=(r,e)=>{for(var t in e||(e={}))dC.call(e,t)&&Iv(r,t,e[t]);if(Sv)for(var t of Sv(e))pC.call(e,t)&&Iv(r,t,e[t]);return r},Pv=(r,e)=>uC(r,lC(e));class gC{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||pn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Ia(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const f=this.client.session.get(e.topic),u=((n=f==null?void 0:f.sessionProperties)==null?void 0:n.capabilities)||{};if(u!=null&&u[a])return u==null?void 0:u[a];const b=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Pv(Mv({},f.sessionProperties||{}),{capabilities:Pv(Mv({},u||{}),{[a]:b})})})}catch(p){console.warn("Failed to update session with capabilities",p)}return b}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const u=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(u,e)}catch(b){console.warn("Failed to fetch call status from bundler",b,u)}}const f=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(f)try{return await this.getUserOperationReceipt(f,e)}catch(u){console.warn("Failed to fetch call status from custom bundler",u,f)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(qs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${eC}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class vC{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class bC{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class mC{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||pn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new gn(new Gn(i,qt("disableProviderPing")))}}class yC{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Ia(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class wC{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class _C{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ia(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}class AC{constructor(e){this.name="near",this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||pn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace);return typeof i>"u"?void 0:new gn(new Gn(i,qt("disableProviderPing")))}}class EC{constructor(e){this.name=Ya,this.namespace=e.namespace,this.events=qt("events"),this.client=qt("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=ac(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||pn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new gn(new Gn(i,qt("disableProviderPing")))}}var xC=Object.defineProperty,SC=Object.defineProperties,IC=Object.getOwnPropertyDescriptors,Ov=Object.getOwnPropertySymbols,MC=Object.prototype.hasOwnProperty,PC=Object.prototype.propertyIsEnumerable,Rv=(r,e,t)=>e in r?xC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wf=(r,e)=>{for(var t in e||(e={}))MC.call(e,t)&&Rv(r,t,e[t]);if(Ov)for(var t of Ov(e))PC.call(e,t)&&Rv(r,t,e[t]);return r},Hl=(r,e)=>SC(r,IC(e));class nd{constructor(e){this.events=new I0,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Nc(Hh({level:(e==null?void 0:e.logger)||yv})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new nd(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:Wf({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(f=>t(null,Kh(a,f))).catch(f=>t(f,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Ut("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const f=xv(this.session.namespaces);this.namespaces=zl(this.namespaces,f),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const f=xv(a.namespaces);this.namespaces=zl(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==nm)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===Ya?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(jn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await id.init({core:this.providerOpts.core,logger:this.providerOpts.logger||yv,relayUrl:this.providerOpts.relayUrl||QN,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>sc(t)))];kl("client",this.client),kl("events",this.events),kl("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=oC(t,this.session),n=am(i),a=zl(this.namespaces,this.optionalNamespaces),f=Hl(Wf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new gC({namespace:f});break;case"algorand":this.rpcProviders[t]=new mC({namespace:f});break;case"solana":this.rpcProviders[t]=new vC({namespace:f});break;case"cosmos":this.rpcProviders[t]=new bC({namespace:f});break;case"polkadot":this.rpcProviders[t]=new fC({namespace:f});break;case"cip34":this.rpcProviders[t]=new yC({namespace:f});break;case"elrond":this.rpcProviders[t]=new wC({namespace:f});break;case"multiversx":this.rpcProviders[t]=new _C({namespace:f});break;case"near":this.rpcProviders[t]=new AC({namespace:f});break;default:this.rpcProviders[Ya]?this.rpcProviders[Ya].updateNamespace(f):this.rpcProviders[Ya]=new EC({namespace:f})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&jn(n)&&this.events.emit("accountsChanged",n.map(cC))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,f=sc(n),u=jl(n)!==jl(a)?`${f}:${jl(a)}`:n;this.onChainChanged(u)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=Hl(Wf({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",Hl(Wf({},Ut("USER_DISCONNECTED")),{data:e.topic}))}),this.on(vn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Ya]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(f=>sc(f)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=sc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${wv}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${wv}/${e}`)}}const OC=nd,RC="wc",NC="ethereum_provider",CC=`${RC}@2:${NC}:`,TC="https://rpc.walletconnect.org/v1/",E0=["eth_sendTransaction","personal_sign"],DC=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],x0=["chainChanged","accountsChanged"],FC=["chainChanged","accountsChanged","message","disconnect","connect"];var BC=Object.defineProperty,qC=Object.defineProperties,LC=Object.getOwnPropertyDescriptors,Nv=Object.getOwnPropertySymbols,UC=Object.prototype.hasOwnProperty,$C=Object.prototype.propertyIsEnumerable,Cv=(r,e,t)=>e in r?BC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qa=(r,e)=>{for(var t in e||(e={}))UC.call(e,t)&&Cv(r,t,e[t]);if(Nv)for(var t of Nv(e))$C.call(e,t)&&Cv(r,t,e[t]);return r},Kl=(r,e)=>qC(r,LC(e));function Eh(r){return Number(r[0].split(":")[1])}function Jf(r){return`0x${r.toString(16)}`}function zC(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:f,rpcMap:u}=r;if(!jn(e))throw new Error("Invalid chains");const b={chains:e,methods:i||E0,events:a||x0,rpcMap:Qa({},e.length?{[Eh(e)]:u[Eh(e)]}:{})},p=a==null?void 0:a.filter(O=>!x0.includes(O)),y=i==null?void 0:i.filter(O=>!E0.includes(O));if(!t&&!f&&!n&&!(p!=null&&p.length)&&!(y!=null&&y.length))return{required:e.length?b:void 0};const A=(p==null?void 0:p.length)&&(y==null?void 0:y.length)||!t,R={chains:[...new Set(A?b.chains.concat(t||[]):t)],methods:[...new Set(b.methods.concat(n!=null&&n.length?n:DC))],events:[...new Set(b.events.concat(f!=null&&f.length?f:FC))],rpcMap:u};return{required:e.length?b:void 0,optional:t.length?R:void 0}}class sd{constructor(){this.events=new Hi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CC,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new sd;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=zC(this.rpc);try{const n=await new Promise(async(f,u)=>{var b;this.rpc.showQrModal&&((b=this.modal)==null||b.subscribeModal(p=>{!p.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),u(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(Kl(Qa({namespaces:Qa({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(p=>{f(p)}).catch(p=>{u(new Error(p.message))})});if(!n)return;const a=T1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Jf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,f)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(b=>{!b.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(Kl(Qa({},e),{chains:this.rpc.chains}),t).then(b=>{a(b)}).catch(b=>{f(new Error(b.message))})}),n=i.session;if(n){const a=T1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Jf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",Jf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",Kl(Qa({},Ut("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",Jf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],f=n.concat(a);if(!f.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const u=n.length?(e==null?void 0:e.methods)||E0:[],b=n.length?(e==null?void 0:e.events)||x0:[],p=(e==null?void 0:e.optionalMethods)||[],y=(e==null?void 0:e.optionalEvents)||[],A=(e==null?void 0:e.rpcMap)||this.buildRpcMap(f,e.projectId),R=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(O=>this.formatChainId(O)),optionalChains:a.map(O=>this.formatChainId(O)),methods:u,events:b,optionalMethods:p,optionalEvents:y,rpcMap:A,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:R,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Eh(this.rpc.chains):Eh(this.rpc.optionalChains),this.signer=await OC.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await j4(()=>import("./index-CtjScd1r.js").then(n=>n.i),__vite__mapDeps([0,1,2]),import.meta.url);t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(Qa({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&jn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&jn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${TC}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const dT=sd;export{dT as EthereumProvider,FC as OPTIONAL_EVENTS,DC as OPTIONAL_METHODS,x0 as REQUIRED_EVENTS,E0 as REQUIRED_METHODS,sd as default}; diff --git a/buddybook/assets/inherits_browser-BwZ6FBWK.js b/buddybook/assets/inherits_browser-C53US4G5.js similarity index 85% rename from buddybook/assets/inherits_browser-BwZ6FBWK.js rename to buddybook/assets/inherits_browser-C53US4G5.js index 6ff2c01..3a94509 100644 --- a/buddybook/assets/inherits_browser-BwZ6FBWK.js +++ b/buddybook/assets/inherits_browser-C53US4G5.js @@ -1 +1 @@ -import{g as n,u as s}from"./index-B-6Lwopd.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var u=r.exports;export{u as i,a as r}; +import{g as n,u as s}from"./index-CP6_TFKv.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var u=r.exports;export{u as i,a as r}; diff --git a/buddybook/index.html b/buddybook/index.html index efaba7b..f04e288 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -4,8 +4,9 @@ BuddyBook Dogfood - - + + +
diff --git a/flush-notes/404.html b/flush-notes/404.html index 6b5cba2..88db3e3 100644 --- a/flush-notes/404.html +++ b/flush-notes/404.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/_next/static/LjnGb4udbolWt3VRqlRMf/_buildManifest.js b/flush-notes/_next/static/BpzOJTpugZrem2iDkT7wR/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/LjnGb4udbolWt3VRqlRMf/_buildManifest.js rename to flush-notes/_next/static/BpzOJTpugZrem2iDkT7wR/_buildManifest.js diff --git a/flush-notes/_next/static/LjnGb4udbolWt3VRqlRMf/_ssgManifest.js b/flush-notes/_next/static/BpzOJTpugZrem2iDkT7wR/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/LjnGb4udbolWt3VRqlRMf/_ssgManifest.js rename to flush-notes/_next/static/BpzOJTpugZrem2iDkT7wR/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index 1a9fbd5..bd846ef 100644 --- a/flush-notes/index.html +++ b/flush-notes/index.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/index.txt b/flush-notes/index.txt index 6a6a4df..dcae1ad 100644 --- a/flush-notes/index.txt +++ b/flush-notes/index.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["LjnGb4udbolWt3VRqlRMf",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["BpzOJTpugZrem2iDkT7wR",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""] diff --git a/flush-notes/view.html b/flush-notes/view.html index f97c821..1bf7761 100644 --- a/flush-notes/view.html +++ b/flush-notes/view.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/view.txt b/flush-notes/view.txt index 8fbd30a..39951aa 100644 --- a/flush-notes/view.txt +++ b/flush-notes/view.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["LjnGb4udbolWt3VRqlRMf",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["BpzOJTpugZrem2iDkT7wR",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""]