From afb3349e22e4a0bb60864f6b8c884b40c1857c3d Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Tue, 5 Nov 2024 06:09:32 +0000 Subject: [PATCH] Updates --- buddybook/.vite/manifest.json | 100 +++++++++--------- .../{ccip-pRo4jQj5.js => ccip-hSU-as8c.js} | 2 +- ...{events-CXYVpbcl.js => events-DHqXLz5A.js} | 2 +- ...e-Dd0QlYUx.js => hooks.module-LlNaOzAU.js} | 2 +- .../{index-jQUXy-RB.js => index-B-is0UYJ.js} | 2 +- .../{index-CT_b5y6n.js => index-BBMEgiCJ.js} | 2 +- .../{index-DrKwSPd8.js => index-BN-E6inN.js} | 2 +- .../{index-D4GNEarw.js => index-BhXuIR47.js} | 8 +- .../{index-DY_rTz6S.js => index-Brvd2aRO.js} | 2 +- .../{index-DbFRd9te.js => index-CK0s9qz-.js} | 2 +- .../{index-BJjm4ut_.js => index-DYbq_cjT.js} | 4 +- ...ex.es-Bushv2uZ.js => index.es-BN4D2FYF.js} | 6 +- ...-Az14D.js => inherits_browser-BBXdvzXT.js} | 2 +- buddybook/index.html | 2 +- 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 +- 21 files changed, 74 insertions(+), 74 deletions(-) rename buddybook/assets/{ccip-pRo4jQj5.js => ccip-hSU-as8c.js} (97%) rename buddybook/assets/{events-CXYVpbcl.js => events-DHqXLz5A.js} (98%) rename buddybook/assets/{hooks.module-Dd0QlYUx.js => hooks.module-LlNaOzAU.js} (99%) rename buddybook/assets/{index-jQUXy-RB.js => index-B-is0UYJ.js} (99%) rename buddybook/assets/{index-CT_b5y6n.js => index-BBMEgiCJ.js} (99%) rename buddybook/assets/{index-DrKwSPd8.js => index-BN-E6inN.js} (99%) rename buddybook/assets/{index-D4GNEarw.js => index-BhXuIR47.js} (99%) rename buddybook/assets/{index-DY_rTz6S.js => index-Brvd2aRO.js} (98%) rename buddybook/assets/{index-DbFRd9te.js => index-CK0s9qz-.js} (99%) rename buddybook/assets/{index-BJjm4ut_.js => index-DYbq_cjT.js} (98%) rename buddybook/assets/{index.es-Bushv2uZ.js => index.es-BN4D2FYF.js} (99%) rename buddybook/assets/{inherits_browser-Cg-Az14D.js => inherits_browser-BBXdvzXT.js} (85%) rename flush-notes/_next/static/{zP2dhn61o1ar3lvoUwTEh => XI6MHJ3KvUZuAZMMrAC6F}/_buildManifest.js (100%) rename flush-notes/_next/static/{zP2dhn61o1ar3lvoUwTEh => XI6MHJ3KvUZuAZMMrAC6F}/_ssgManifest.js (100%) diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json index ad3fb29..13ad939 100644 --- a/buddybook/.vite/manifest.json +++ b/buddybook/.vite/manifest.json @@ -1,22 +1,50 @@ { - "_events-CXYVpbcl.js": { - "file": "assets/events-CXYVpbcl.js", + "_events-DHqXLz5A.js": { + "file": "assets/events-DHqXLz5A.js", "name": "events", "imports": [ "index.html" ] }, - "_hooks.module-Dd0QlYUx.js": { - "file": "assets/hooks.module-Dd0QlYUx.js", + "_hooks.module-LlNaOzAU.js": { + "file": "assets/hooks.module-LlNaOzAU.js", "name": "hooks.module", "imports": [ "index.html", - "_events-CXYVpbcl.js", - "_inherits_browser-Cg-Az14D.js" + "_events-DHqXLz5A.js", + "_inherits_browser-BBXdvzXT.js" ] }, - "_index-BJjm4ut_.js": { - "file": "assets/index-BJjm4ut_.js", + "_index-BBMEgiCJ.js": { + "file": "assets/index-BBMEgiCJ.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_inherits_browser-BBXdvzXT.js", + "_hooks.module-LlNaOzAU.js", + "_events-DHqXLz5A.js" + ] + }, + "_index-BN-E6inN.js": { + "file": "assets/index-BN-E6inN.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_hooks.module-LlNaOzAU.js" + ] + }, + "_index-Brvd2aRO.js": { + "file": "assets/index-Brvd2aRO.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "_events-DHqXLz5A.js" + ] + }, + "_index-DYbq_cjT.js": { + "file": "assets/index-DYbq_cjT.js", "name": "index", "isDynamicEntry": true, "imports": [ @@ -26,52 +54,24 @@ "node_modules/@walletconnect/modal-ui/dist/index.js" ] }, - "_index-CT_b5y6n.js": { - "file": "assets/index-CT_b5y6n.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "index.html", - "_inherits_browser-Cg-Az14D.js", - "_hooks.module-Dd0QlYUx.js", - "_events-CXYVpbcl.js" - ] - }, - "_index-DY_rTz6S.js": { - "file": "assets/index-DY_rTz6S.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "_events-CXYVpbcl.js" - ] - }, - "_index-DrKwSPd8.js": { - "file": "assets/index-DrKwSPd8.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "index.html", - "_hooks.module-Dd0QlYUx.js" - ] - }, - "_inherits_browser-Cg-Az14D.js": { - "file": "assets/inherits_browser-Cg-Az14D.js", + "_inherits_browser-BBXdvzXT.js": { + "file": "assets/inherits_browser-BBXdvzXT.js", "name": "inherits_browser", "imports": [ "index.html" ] }, "index.html": { - "file": "assets/index-D4GNEarw.js", + "file": "assets/index-BhXuIR47.js", "name": "index", "src": "index.html", "isEntry": true, "dynamicImports": [ "node_modules/viem/_esm/utils/ccip.js", - "_index-DrKwSPd8.js", - "_index-CT_b5y6n.js", + "_index-BN-E6inN.js", + "_index-BBMEgiCJ.js", "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", - "_index-DY_rTz6S.js", + "_index-Brvd2aRO.js", "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" ], "css": [ @@ -79,7 +79,7 @@ ] }, "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js": { - "file": "assets/index-DbFRd9te.js", + "file": "assets/index-CK0s9qz-.js", "name": "index", "src": "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", "isDynamicEntry": true, @@ -88,31 +88,31 @@ ] }, "node_modules/@walletconnect/ethereum-provider/dist/index.es.js": { - "file": "assets/index.es-Bushv2uZ.js", + "file": "assets/index.es-BN4D2FYF.js", "name": "index.es", "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", "isDynamicEntry": true, "imports": [ "index.html", - "_events-CXYVpbcl.js", - "_inherits_browser-Cg-Az14D.js" + "_events-DHqXLz5A.js", + "_inherits_browser-BBXdvzXT.js" ], "dynamicImports": [ - "_index-BJjm4ut_.js" + "_index-DYbq_cjT.js" ] }, "node_modules/@walletconnect/modal-ui/dist/index.js": { - "file": "assets/index-jQUXy-RB.js", + "file": "assets/index-B-is0UYJ.js", "name": "index", "src": "node_modules/@walletconnect/modal-ui/dist/index.js", "isDynamicEntry": true, "imports": [ - "_index-BJjm4ut_.js", + "_index-DYbq_cjT.js", "index.html" ] }, "node_modules/viem/_esm/utils/ccip.js": { - "file": "assets/ccip-pRo4jQj5.js", + "file": "assets/ccip-hSU-as8c.js", "name": "ccip", "src": "node_modules/viem/_esm/utils/ccip.js", "isDynamicEntry": true, diff --git a/buddybook/assets/ccip-pRo4jQj5.js b/buddybook/assets/ccip-hSU-as8c.js similarity index 97% rename from buddybook/assets/ccip-pRo4jQj5.js rename to buddybook/assets/ccip-hSU-as8c.js index 68f96dd..dac76ad 100644 --- a/buddybook/assets/ccip-pRo4jQj5.js +++ b/buddybook/assets/ccip-hSU-as8c.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-D4GNEarw.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(E){var s={data:E,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var E=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,E}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";for(var s=this.head,p=""+s.data;s=s.next;)p+=E+s.data;return p}},{key:"concat",value:function(E){if(this.length===0)return h.alloc(0);for(var s=h.allocUnsafe(E>>>0),p=this.head,C=0;p;)v(p.data,s,C),C+=p.data.length,p=p.next;return s}},{key:"consume",value:function(E,s){var p;return ER.length?R.length:E;if(S===R.length?C+=R:C+=R.slice(0,E),E-=S,E===0){S===R.length?(++p,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=R.slice(S));break}++p}return this.length-=p,C}},{key:"_getBuffer",value:function(E){var s=h.allocUnsafe(E),p=this.head,C=1;for(p.data.copy(s),E-=p.data.length;p=p.next;){var R=p.data,S=E>R.length?R.length:E;if(R.copy(s,s.length-E,0,S),E-=S,E===0){S===R.length?(++C,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=R.slice(S));break}++C}return this.length-=C,s}},{key:w,value:function(E,s){return _(this,t(t({},s),{},{depth:0,customInspect:!1}))}}]),m}(),Yt}var pe={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function zi(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pe.nextTick(or,this,e)):pe.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?pe.nextTick(ze,r):(r._writableState.errorEmitted=!0,pe.nextTick(mr,r,f)):pe.nextTick(mr,r,f):t?(pe.nextTick(ze,r),t(f)):pe.nextTick(ze,r)}),this)}function mr(e,t){or(e,t),ze(e)}function ze(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Vi(){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 Gi(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}var ii={destroy:zi,undestroy:Vi,errorOrDestroy:Gi},ve={};function Ki(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var ni={};function J(e,t,r){r||(r=Error);function i(f,l,u){return typeof t=="string"?t:t(f,l,u)}var n=function(f){Ki(l,f);function l(u,b,h){return f.call(this,i(u,b,h))||this}return l}(r);n.prototype.name=r.name,n.prototype.code=e,ni[e]=n}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),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 Yi(e,t,r){return e.substr(0,t.length)===t}function Ji(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Xi(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}J("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);J("ERR_INVALID_ARG_TYPE",function(e,t,r){var i;typeof t=="string"&&Yi(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(Ji(e," argument"))n="The ".concat(e," ").concat(i," ").concat(Sr(t,"type"));else{var f=Xi(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(Sr(t,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError);J("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");J("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});J("ERR_STREAM_PREMATURE_CLOSE","Premature close");J("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});J("ERR_MULTIPLE_CALLBACK","Callback called multiple times");J("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");J("ERR_STREAM_WRITE_AFTER_END","write after end");J("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);J("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);J("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");ve.codes=ni;var Qi=ve.codes.ERR_INVALID_OPT_VALUE;function Zi(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function en(e,t,r,i){var n=Zi(t,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var f=i?r:"highWaterMark";throw new Qi(f,n)}return Math.floor(n)}return e.objectMode?16:16*1024}var ai={getHighWaterMark:en},tn=rn;function rn(e,t){if(Jt("noDeprecation"))return e;var r=!1;function i(){if(!r){if(Jt("throwDeprecation"))throw new Error(t);Jt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function Jt(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Xt,Rr;function oi(){if(Rr)return Xt;Rr=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};Xt=D;function t(c){var d=this;this.next=null,this.entry=null,this.finish=function(){q(d,c)}}var r;D.WritableState=M;var i={deprecate:tn},n=ri,f=Oe.Buffer,l=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(c){return f.from(c)}function b(c){return f.isBuffer(c)||c instanceof l}var h=ii,g=ai,_=g.getHighWaterMark,w=ve.codes,v=w.ERR_INVALID_ARG_TYPE,m=w.ERR_METHOD_NOT_IMPLEMENTED,T=w.ERR_MULTIPLE_CALLBACK,E=w.ERR_STREAM_CANNOT_PIPE,s=w.ERR_STREAM_DESTROYED,p=w.ERR_STREAM_NULL_VALUES,C=w.ERR_STREAM_WRITE_AFTER_END,R=w.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;Z(D,n);function N(){}function M(c,d,x){r=r||Se(),c=c||{},typeof x!="boolean"&&(x=d instanceof r),this.objectMode=!!c.objectMode,x&&(this.objectMode=this.objectMode||!!c.writableObjectMode),this.highWaterMark=_(this,c,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var k=c.decodeStrings===!1;this.decodeStrings=!k,this.defaultEncoding=c.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(O){he(d,O)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=c.emitClose!==!1,this.autoDestroy=!!c.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}M.prototype.getBuffer=function(){for(var d=this.bufferedRequest,x=[];d;)x.push(d),d=d.next;return x},function(){try{Object.defineProperty(M.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var P;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(d){return P.call(this,d)?!0:this!==D?!1:d&&d._writableState instanceof M}})):P=function(d){return d instanceof this};function D(c){r=r||Se();var d=this instanceof r;if(!d&&!P.call(D,this))return new D(c);this._writableState=new M(c,this,d),this.writable=!0,c&&(typeof c.write=="function"&&(this._write=c.write),typeof c.writev=="function"&&(this._writev=c.writev),typeof c.destroy=="function"&&(this._destroy=c.destroy),typeof c.final=="function"&&(this._final=c.final)),n.call(this)}D.prototype.pipe=function(){S(this,new E)};function B(c,d){var x=new C;S(c,x),e.nextTick(d,x)}function j(c,d,x,k){var O;return x===null?O=new p:typeof x!="string"&&!d.objectMode&&(O=new v("chunk",["string","Buffer"],x)),O?(S(c,O),e.nextTick(k,O),!1):!0}D.prototype.write=function(c,d,x){var k=this._writableState,O=!1,a=!k.objectMode&&b(c);return a&&!f.isBuffer(c)&&(c=u(c)),typeof d=="function"&&(x=d,d=null),a?d="buffer":d||(d=k.defaultEncoding),typeof x!="function"&&(x=N),k.ending?B(this,x):(a||j(this,k,c,x))&&(k.pendingcb++,O=W(this,k,a,c,d,x)),O},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var c=this._writableState;c.corked&&(c.corked--,!c.writing&&!c.corked&&!c.bufferProcessing&&c.bufferedRequest&&Q(this,c))},D.prototype.setDefaultEncoding=function(d){if(typeof d=="string"&&(d=d.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((d+"").toLowerCase())>-1))throw new R(d);return this._writableState.defaultEncoding=d,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function X(c,d,x){return!c.objectMode&&c.decodeStrings!==!1&&typeof d=="string"&&(d=f.from(d,x)),d}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function W(c,d,x,k,O,a){if(!x){var o=X(d,k,O);k!==o&&(x=!0,O="buffer",k=o)}var y=d.objectMode?1:k.length;d.length+=y;var A=d.length */var Cr;function nn(){return Cr||(Cr=1,function(e,t){var r=Oe,i=r.Buffer;function n(l,u){for(var b in l)u[b]=l[b]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=f);function f(l,u,b){return i(l,u,b)}f.prototype=Object.create(i.prototype),n(i,f),f.from=function(l,u,b){if(typeof l=="number")throw new TypeError("Argument must not be a number");return i(l,u,b)},f.alloc=function(l,u,b){if(typeof l!="number")throw new TypeError("Argument must be a number");var h=i(l);return u!==void 0?typeof b=="string"?h.fill(u,b):h.fill(u):h.fill(0),h},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return i(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}}(je,je.exports)),je.exports}var Ar;function Br(){if(Ar)return Zt;Ar=1;var e=nn().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 i(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=n;function n(s){this.encoding=i(s);var p;switch(this.encoding){case"utf16le":this.text=_,this.end=w,p=4;break;case"utf8":this.fillLast=b,p=4;break;case"base64":this.text=v,this.end=m,p=3;break;default:this.write=T,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}n.prototype.write=function(s){if(s.length===0)return"";var p,C;if(this.lastNeed){if(p=this.fillLast(s),p===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C>5===6?2:s>>4===14?3:s>>3===30?4:s>>6===2?-1:-2}function l(s,p,C){var R=p.length-1;if(R=0?(S>0&&(s.lastNeed=S-1),S):--R=0?(S>0&&(s.lastNeed=S-2),S):--R=0?(S>0&&(S===2?S=0:s.lastNeed=S-3),S):0))}function u(s,p,C){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 b(s){var p=this.lastTotal-this.lastNeed,C=u(this,s);if(C!==void 0)return C;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 h(s,p){var C=l(this,s,p);if(!this.lastNeed)return s.toString("utf8",p);this.lastTotal=C;var R=s.length-(C-this.lastNeed);return s.copy(this.lastChar,0,R),s.toString("utf8",p,R)}function g(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+"�":p}function _(s,p){if((s.length-p)%2===0){var C=s.toString("utf16le",p);if(C){var R=C.charCodeAt(C.length-1);if(R>=55296&&R<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=s[s.length-1],s.toString("utf16le",p,s.length-1)}function w(s){var p=s&&s.length?this.write(s):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,C)}return p}function v(s,p){var C=(s.length-p)%3;return C===0?s.toString("base64",p):(this.lastNeed=3-C,this.lastTotal=3,C===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-C))}function m(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function T(s){return s.toString(this.encoding)}function E(s){return s&&s.length?this.write(s):""}return Zt}var kr=ve.codes.ERR_STREAM_PREMATURE_CLOSE;function an(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n0)if(typeof o!="string"&&!L.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=l(o)),A)L.endEmitted?N(a,new p):X(a,L,o,!0);else if(L.ended)N(a,new E);else{if(L.destroyed)return!1;L.reading=!1,L.decoder&&!y?(o=L.decoder.write(o),L.objectMode||o.length!==0?X(a,L,o,!1):Q(a,L)):X(a,L,o,!1)}else A||(L.reading=!1,Q(a,L))}return!L.ended&&(L.length=V?a=V:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function ne(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=G(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}B.prototype.read=function(a){h("read",a),a=parseInt(a,10);var o=this._readableState,y=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return h("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=ne(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var A=o.needReadable;h("need readable",A),(o.length===0||o.length-a0?U=d(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),y!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function he(a,o){if(h("onEofChunk"),!o.ended){if(o.decoder){var y=o.decoder.end();y&&y.length&&(o.buffer.push(y),o.length+=o.objectMode?1:y.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;h("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(h("emitReadable",o.flowing),o.emittedReadable=!0,e.nextTick(ee,a))}function ee(a){var o=a._readableState;h("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,c(a)}function Q(a,o){o.readingMore||(o.readingMore=!0,e.nextTick(ae,a,o))}function ae(a,o){for(;!o.reading&&!o.ended&&(o.length1&&O(A.pipes,a)!==-1)&&!Be&&(h("false write response, pause",A.awaitDrain),A.awaitDrain++),y.pause())}function Ee(re){h("onerror",re),ce(),a.removeListener("error",Ee),r(a,"error")===0&&N(a,re)}P(a,"error",Ee);function xe(){a.removeListener("finish",me),ce()}a.once("close",xe);function me(){h("onfinish"),a.removeListener("close",xe),ce()}a.once("finish",me);function ce(){h("unpipe"),y.unpipe(a)}return a.emit("pipe",y),A.flowing||(h("pipe resume"),y.resume()),a};function _e(a){return function(){var y=a._readableState;h("pipeOnDrain",y.awaitDrain),y.awaitDrain&&y.awaitDrain--,y.awaitDrain===0&&r(a,"data")&&(y.flowing=!0,c(a))}}B.prototype.unpipe=function(a){var o=this._readableState,y={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,y),this);if(!a){var A=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var L=0;L0,A.flowing!==!1&&this.resume()):a==="readable"&&!A.endEmitted&&!A.readableListening&&(A.readableListening=A.needReadable=!0,A.flowing=!1,A.emittedReadable=!1,h("on readable",A.length,A.reading),A.length?K(this):A.reading||e.nextTick(Y,this)),y},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(a,o){var y=i.prototype.removeListener.call(this,a,o);return a==="readable"&&e.nextTick(te,this),y},B.prototype.removeAllListeners=function(a){var o=i.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&e.nextTick(te,this),o};function te(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 Y(a){h("readable nexttick read 0"),a.read(0)}B.prototype.resume=function(){var a=this._readableState;return a.flowing||(h("resume"),a.flowing=!a.readableListening,oe(this,a)),a.paused=!1,this};function oe(a,o){o.resumeScheduled||(o.resumeScheduled=!0,e.nextTick(q,a,o))}function q(a,o){h("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),c(a),o.flowing&&!o.reading&&a.read(0)}B.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function c(a){var o=a._readableState;for(h("flow",o.flowing);o.flowing&&a.read()!==null;);}B.prototype.wrap=function(a){var o=this,y=this._readableState,A=!1;a.on("end",function(){if(h("wrapped end"),y.decoder&&!y.ended){var I=y.decoder.end();I&&I.length&&o.push(I)}o.push(null)}),a.on("data",function(I){if(h("wrapped data"),y.decoder&&(I=y.decoder.write(I)),!(y.objectMode&&I==null)&&!(!y.objectMode&&(!I||!I.length))){var fe=o.push(I);fe||(A=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(fe){return function(){return a[fe].apply(a,arguments)}}(U));for(var L=0;L=o.length?(o.decoder?y=o.buffer.join(""):o.buffer.length===1?y=o.buffer.first():y=o.buffer.concat(o.length),o.buffer.clear()):y=o.buffer.consume(a,o.decoder),y}function x(a){var o=a._readableState;h("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,e.nextTick(k,o,a))}function k(a,o){if(h("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var y=o._writableState;(!y||y.autoDestroy&&y.finished)&&o.destroy()}}typeof Symbol=="function"&&(B.from=function(a,o){return S===void 0&&(S=ln()),S(B,a,o)});function O(a,o){for(var y=0,A=a.length;y0;return En(l,b,h,function(g){n||(n=g),g&&f.forEach(Pr),!b&&(f.forEach(Pr),i(n))})});return t.reduce(xn)}var Rn=Sn;(function(e,t){t=e.exports=si(),t.Stream=t,t.Readable=t,t.Writable=oi(),t.Duplex=Se(),t.Transform=li,t.PassThrough=bn,t.finished=pr,t.pipeline=Rn})(ar,ar.exports);var _i=ar.exports;const{Transform:Tn}=_i;var Cn=e=>class ci extends Tn{constructor(r,i,n,f,l){super(l),this._rate=r,this._capacity=i,this._delimitedSuffix=n,this._hashBitLength=f,this._options=l,this._state=new e,this._state.initialize(r,i),this._finalized=!1}_transform(r,i,n){let f=null;try{this.update(r,i)}catch(l){f=l}n(f)}_flush(r){let i=null;try{this.push(this.digest())}catch(n){i=n}r(i)}update(r,i){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,i)),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 i=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(i=i.toString(r)),this._resetState(),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new ci(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:An}=_i;var Bn=e=>class di extends An{constructor(r,i,n,f){super(f),this._rate=r,this._capacity=i,this._delimitedSuffix=n,this._options=f,this._state=new e,this._state.initialize(r,i),this._finalized=!1}_transform(r,i,n){let f=null;try{this.update(r,i)}catch(l){f=l}n(f)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,i){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,i)),this._state.absorb(r),this}squeeze(r,i){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(r);return i!==void 0&&(n=n.toString(i)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new di(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const kn=Cn,Mn=Bn;var Nn=function(e){const t=kn(e),r=Mn(e);return function(i,n){switch(typeof i=="string"?i.toLowerCase():i){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+i)}}},pi={};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];pi.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],n=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],u=e[5]^e[15]^e[25]^e[35]^e[45],b=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],g=e[8]^e[18]^e[28]^e[38]^e[48],_=e[9]^e[19]^e[29]^e[39]^e[49];let w=g^(n<<1|f>>>31),v=_^(f<<1|n>>>31);const m=e[0]^w,T=e[1]^v,E=e[10]^w,s=e[11]^v,p=e[20]^w,C=e[21]^v,R=e[30]^w,S=e[31]^v,N=e[40]^w,M=e[41]^v;w=r^(l<<1|u>>>31),v=i^(u<<1|l>>>31);const P=e[2]^w,D=e[3]^v,B=e[12]^w,j=e[13]^v,X=e[22]^w,W=e[23]^v,V=e[32]^w,G=e[33]^v,ne=e[42]^w,he=e[43]^v;w=n^(b<<1|h>>>31),v=f^(h<<1|b>>>31);const K=e[4]^w,ee=e[5]^v,Q=e[14]^w,ae=e[15]^v,_e=e[24]^w,te=e[25]^v,Y=e[34]^w,oe=e[35]^v,q=e[44]^w,c=e[45]^v;w=l^(g<<1|_>>>31),v=u^(_<<1|g>>>31);const d=e[6]^w,x=e[7]^v,k=e[16]^w,O=e[17]^v,a=e[26]^w,o=e[27]^v,y=e[36]^w,A=e[37]^v,U=e[46]^w,L=e[47]^v;w=b^(r<<1|i>>>31),v=h^(i<<1|r>>>31);const I=e[8]^w,fe=e[9]^v,de=e[18]^w,Be=e[19]^v,qe=e[28]^w,ke=e[29]^v,Ee=e[38]^w,xe=e[39]^v,me=e[48]^w,ce=e[49]^v,re=m,ie=T,tt=s<<4|E>>>28,rt=E<<4|s>>>28,it=p<<3|C>>>29,nt=C<<3|p>>>29,at=S<<9|R>>>23,ot=R<<9|S>>>23,ft=N<<18|M>>>14,st=M<<18|N>>>14,lt=P<<1|D>>>31,ut=D<<1|P>>>31,ht=j<<12|B>>>20,_t=B<<12|j>>>20,ct=X<<10|W>>>22,dt=W<<10|X>>>22,pt=G<<13|V>>>19,bt=V<<13|G>>>19,vt=ne<<2|he>>>30,gt=he<<2|ne>>>30,yt=ee<<30|K>>>2,wt=K<<30|ee>>>2,Et=Q<<6|ae>>>26,xt=ae<<6|Q>>>26,mt=te<<11|_e>>>21,St=_e<<11|te>>>21,Rt=Y<<15|oe>>>17,Tt=oe<<15|Y>>>17,Ct=c<<29|q>>>3,At=q<<29|c>>>3,Bt=d<<28|x>>>4,kt=x<<28|d>>>4,Mt=O<<23|k>>>9,Nt=k<<23|O>>>9,Dt=a<<25|o>>>7,Lt=o<<25|a>>>7,Ot=y<<21|A>>>11,Pt=A<<21|y>>>11,It=L<<24|U>>>8,$t=U<<24|L>>>8,Ft=I<<27|fe>>>5,Ut=fe<<27|I>>>5,Ht=de<<20|Be>>>12,qt=Be<<20|de>>>12,jt=ke<<7|qe>>>25,Wt=qe<<7|ke>>>25,zt=Ee<<8|xe>>>24,Vt=xe<<8|Ee>>>24,Gt=me<<14|ce>>>18,Kt=ce<<14|me>>>18;e[0]=re^~ht&mt,e[1]=ie^~_t&St,e[10]=Bt^~Ht&it,e[11]=kt^~qt&nt,e[20]=lt^~Et&Dt,e[21]=ut^~xt&Lt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Nt&Wt,e[2]=ht^~mt&Ot,e[3]=_t^~St&Pt,e[12]=Ht^~it&pt,e[13]=qt^~nt&bt,e[22]=Et^~Dt&zt,e[23]=xt^~Lt&Vt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Nt^~Wt&ot,e[4]=mt^~Ot&Gt,e[5]=St^~Pt&Kt,e[14]=it^~pt&Ct,e[15]=nt^~bt&At,e[24]=Dt^~zt&ft,e[25]=Lt^~Vt&st,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Ot^~Gt&re,e[7]=Pt^~Kt&ie,e[16]=pt^~Ct&Bt,e[17]=bt^~At&kt,e[26]=zt^~ft<,e[27]=Vt^~st&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Gt^~re&ht,e[9]=Kt^~ie&_t,e[18]=Ct^~Bt&Ht,e[19]=At^~kt&qt,e[28]=ft^~lt&Et,e[29]=st^~ut&xt,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Nt,e[0]^=Ir[t*2],e[1]^=Ir[t*2+1]}};const Ge=pi;function Ce(){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}Ce.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};Ce.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};Ce.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 Dn=Ce,Ja=Nn(Dn),bi={exports:{}},fr={exports:{}};(function(e,t){var r=Oe,i=r.Buffer;function n(l,u){for(var b in l)u[b]=l[b]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=f);function f(l,u,b){return i(l,u,b)}n(i,f),f.from=function(l,u,b){if(typeof l=="number")throw new TypeError("Argument must not be a number");return i(l,u,b)},f.alloc=function(l,u,b){if(typeof l!="number")throw new TypeError("Argument must be a number");var h=i(l);return u!==void 0?typeof b=="string"?h.fill(u,b):h.fill(u):h.fill(0),h},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return i(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 ge=fr.exports,vi=ge.Buffer;function Xe(e,t){this._block=vi.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Xe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=vi.from(e,t));for(var r=this._block,i=this._blockSize,n=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 i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,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,Ln=Z,gi=Ae,On=ge.Buffer,Pn=[1518500249,1859775393,-1894007588,-899497514],In=new Array(80);function Pe(){this.init(),this._w=In,gi.call(this,64,56)}Ln(Pe,gi);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $n(e){return e<<5|e>>>27}function Fn(e){return e<<30|e>>>2}function Un(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var b=0;b<80;++b){var h=~~(b/20),g=$n(r)+Un(h,i,n,f)+l+t[b]+Pn[h]|0;l=f,f=n,n=Fn(i),i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Pe.prototype._hash=function(){var e=On.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 Hn=Pe,qn=Z,yi=Ae,jn=ge.Buffer,Wn=[1518500249,1859775393,-1894007588,-899497514],zn=new Array(80);function Ie(){this.init(),this._w=zn,yi.call(this,64,56)}qn(Ie,yi);Ie.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Vn(e){return e<<1|e>>>31}function Gn(e){return e<<5|e>>>27}function Kn(e){return e<<30|e>>>2}function Yn(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Ie.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=Vn(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var b=0;b<80;++b){var h=~~(b/20),g=Gn(r)+Yn(h,i,n,f)+l+t[b]+Wn[h]|0;l=f,f=n,n=Kn(i),i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Ie.prototype._hash=function(){var e=jn.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 Jn=Ie,Xn=Z,wi=Ae,Qn=ge.Buffer,Zn=[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 $e(){this.init(),this._w=ea,wi.call(this,64,56)}Xn($e,wi);$e.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 ia(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function na(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}$e.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=this._f|0,b=this._g|0,h=this._h|0,g=0;g<16;++g)t[g]=e.readInt32BE(g*4);for(;g<64;++g)t[g]=oa(t[g-2])+t[g-7]+aa(t[g-15])+t[g-16]|0;for(var _=0;_<64;++_){var w=h+na(l)+ta(l,u,b)+Zn[_]+t[_]|0,v=ia(r)+ra(r,i,n)|0;h=b,b=u,u=l,l=f+w|0,f=n,n=i,i=r,r=w+v|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0,this._f=u+this._f|0,this._g=b+this._g|0,this._h=h+this._h|0};$e.prototype._hash=function(){var e=Qn.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 Ei=$e,fa=Z,sa=Ei,la=Ae,ua=ge.Buffer,ha=new Array(64);function Qe(){this.init(),this._w=ha,la.call(this,64,56)}fa(Qe,sa);Qe.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};Qe.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=Qe,ca=Z,xi=Ae,da=ge.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 Fe(){this.init(),this._w=pa,xi.call(this,128,112)}ca(Fe,xi);Fe.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 z(e,t){return e>>>0>>0?1:0}Fe.prototype._update=function(e){for(var t=this._w,r=this._ah|0,i=this._bh|0,n=this._ch|0,f=this._dh|0,l=this._eh|0,u=this._fh|0,b=this._gh|0,h=this._hh|0,g=this._al|0,_=this._bl|0,w=this._cl|0,v=this._dl|0,m=this._el|0,T=this._fl|0,E=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 C=t[p-30],R=t[p-15*2+1],S=ba(C,R),N=va(R,C);C=t[p-2*2],R=t[p-2*2+1];var M=ga(C,R),P=ya(R,C),D=t[p-7*2],B=t[p-7*2+1],j=t[p-16*2],X=t[p-16*2+1],W=N+B|0,V=S+D+z(W,N)|0;W=W+P|0,V=V+M+z(W,P)|0,W=W+X|0,V=V+j+z(W,X)|0,t[p]=V,t[p+1]=W}for(var G=0;G<160;G+=2){V=t[G],W=t[G+1];var ne=Ur(r,i,n),he=Ur(g,_,w),K=Hr(r,g),ee=Hr(g,r),Q=qr(l,m),ae=qr(m,l),_e=$r[G],te=$r[G+1],Y=Fr(l,u,b),oe=Fr(m,T,E),q=s+ae|0,c=h+Q+z(q,s)|0;q=q+oe|0,c=c+Y+z(q,oe)|0,q=q+te|0,c=c+_e+z(q,te)|0,q=q+W|0,c=c+V+z(q,W)|0;var d=ee+he|0,x=K+ne+z(d,ee)|0;h=b,s=E,b=u,E=T,u=l,T=m,m=v+q|0,l=f+c+z(m,v)|0,f=n,v=w,n=i,w=_,i=r,_=g,g=q+d|0,r=c+x+z(g,q)|0}this._al=this._al+g|0,this._bl=this._bl+_|0,this._cl=this._cl+w|0,this._dl=this._dl+v|0,this._el=this._el+m|0,this._fl=this._fl+T|0,this._gl=this._gl+E|0,this._hl=this._hl+s|0,this._ah=this._ah+r+z(this._al,g)|0,this._bh=this._bh+i+z(this._bl,_)|0,this._ch=this._ch+n+z(this._cl,w)|0,this._dh=this._dh+f+z(this._dl,v)|0,this._eh=this._eh+l+z(this._el,m)|0,this._fh=this._fh+u+z(this._fl,T)|0,this._gh=this._gh+b+z(this._gl,E)|0,this._hh=this._hh+h+z(this._hl,s)|0};Fe.prototype._hash=function(){var e=da.allocUnsafe(64);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var mi=Fe,wa=Z,Ea=mi,xa=Ae,ma=ge.Buffer,Sa=new Array(160);function Ze(){this.init(),this._w=Sa,xa.call(this,128,112)}wa(Ze,Ea);Ze.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};Ze.prototype._hash=function(){var e=ma.allocUnsafe(48);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ra=Ze,ye=bi.exports=function(t){t=t.toLowerCase();var r=ye[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ye.sha=Hn;ye.sha1=Jn;ye.sha224=_a;ye.sha256=Ei;ye.sha384=Ra;ye.sha512=mi;var Xa=bi.exports,Ue,F,Si,Ri,be,jr,Ti,sr,br,lr,ur,Ci,Le={},Ai=[],Ta=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,et=Array.isArray;function se(e,t){for(var r in t)e[r]=t[r];return e}function Bi(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hr(e,t,r){var i,n,f,l={};for(f in t)f=="key"?i=t[f]:f=="ref"?n=t[f]:l[f]=t[f];if(arguments.length>2&&(l.children=arguments.length>3?Ue.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 Me(e,l,i,n,null)}function Me(e,t,r,i,n){var f={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++Si,__i:-1,__u:0};return n==null&&F.vnode!=null&&F.vnode(f),f}function Ca(){return{current:null}}function He(e){return e.children}function Ne(e,t){this.props=e,this.context=t}function Re(e,t){if(t==null)return e.__?Re(e.__,e.__i+1):null;for(var r;tt&&be.sort(sr));Ke.__r=0}function Mi(e,t,r,i,n,f,l,u,b,h,g){var _,w,v,m,T,E=i&&i.__k||Ai,s=t.length;for(r.__d=b,Aa(r,t,E),b=r.__d,_=0;_0?Me(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n).__=e,n.__b=e.__b+1,f=null,(u=n.__i=Ba(n,r,l,g))!==-1&&(g--,(f=r[u])&&(f.__u|=131072)),f==null||f.__v===null?(u==-1&&_--,typeof n.type!="function"&&(n.__u|=65536)):u!==l&&(u==l-1?_--:u==l+1?_++:(u>l?_--:_++,n.__u|=65536))):n=e.__k[i]=null;if(g)for(i=0;i(b!=null&&!(131072&b.__u)?1:0))for(;l>=0||u=0){if((b=t[l])&&!(131072&b.__u)&&n==b.key&&f===b.type)return l;l--}if(u2&&(u.children=arguments.length>3?Ue.call(arguments,2):r),Me(e.type,u,i||e.key,n||e.ref,null)}function Da(e,t){var r={__c:t="__cC"+Ci++,__:e,Consumer:function(i,n){return i.children(n)},Provider:function(i){var n,f;return this.getChildContext||(n=new Set,(f={})[t]=this,this.getChildContext=function(){return f},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(l){this.props.value!==l.value&&n.forEach(function(u){u.__e=!0,_r(u)})},this.sub=function(l){n.add(l);var u=l.componentWillUnmount;l.componentWillUnmount=function(){n&&n.delete(l),u&&u.call(l)}}),i.children}};return r.Provider.__=r.Consumer.contextType=r}Ue=Ai.slice,F={__e:function(e,t,r,i){for(var n,f,l;t=t.__;)if((n=t.__c)&&!n.__)try{if((f=n.constructor)&&f.getDerivedStateFromError!=null&&(n.setState(f.getDerivedStateFromError(e)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,i||{}),l=n.__d),l)return n.__E=n}catch(u){e=u}throw e}},Si=0,Ri=function(e){return e!=null&&e.constructor==null},Ne.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=se({},this.state),typeof e=="function"&&(e=e(se({},r),this.props)),e&&se(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Ne.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Ne.prototype.render=He,be=[],Ti=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sr=function(e,t){return e.__v.__b-t.__v.__b},Ke.__r=0,br=0,lr=zr(!1),ur=zr(!0),Ci=0;const La=Object.freeze(Object.defineProperty({__proto__:null,Component:Ne,Fragment:He,cloneElement:Na,createContext:Da,createElement:hr,createRef:Ca,h:hr,hydrate:Ii,get isValidElement(){return Ri},get options(){return F},render:Pi,toChildArray:Di},Symbol.toStringTag,{value:"Module"})),Qa=dr(La);var ue,$,nr,Vr,Te=0,$i=[],H=F,Gr=H.__b,Kr=H.__r,Yr=H.diffed,Jr=H.__c,Xr=H.unmount,Qr=H.__;function we(e,t){H.__h&&H.__h($,e,Te||t),Te=0;var r=$.__H||($.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Fi(e){return Te=1,Ui(qi,e)}function Ui(e,t,r){var i=we(ue++,2);if(i.t=e,!i.__c&&(i.__=[r?r(t):qi(void 0,t),function(u){var b=i.__N?i.__N[0]:i.__[0],h=i.t(b,u);b!==h&&(i.__N=[h,i.__[1]],i.__c.setState({}))}],i.__c=$,!$.u)){var n=function(u,b,h){if(!i.__c.__H)return!0;var g=i.__c.__H.__.filter(function(w){return!!w.__c});if(g.every(function(w){return!w.__N}))return!f||f.call(this,u,b,h);var _=!1;return g.forEach(function(w){if(w.__N){var v=w.__[0];w.__=w.__N,w.__N=void 0,v!==w.__[0]&&(_=!0)}}),!(!_&&i.__c.props===u)&&(!f||f.call(this,u,b,h))};$.u=!0;var f=$.shouldComponentUpdate,l=$.componentWillUpdate;$.componentWillUpdate=function(u,b,h){if(this.__e){var g=f;f=void 0,n(u,b,h),f=g}l&&l.call(this,u,b,h)},$.shouldComponentUpdate=n}return i.__N||i.__}function Oa(e,t){var r=we(ue++,3);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,$.__H.__h.push(r))}function Hi(e,t){var r=we(ue++,4);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,$.__h.push(r))}function Pa(e){return Te=5,yr(function(){return{current:e}},[])}function Ia(e,t,r){Te=6,Hi(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=we(ue++,7);return wr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Te=8,yr(function(){return e},t)}function Fa(e){var t=$.context[e.__c],r=we(ue++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub($)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=we(ue++,10),r=Fi();return t.__=e,$.componentDidCatch||($.componentDidCatch=function(i,n){t.__&&t.__(i,n),r[1](i)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=we(ue++,11);if(!e.__){for(var t=$.__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=$i.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ve),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){$=null,Gr&&Gr(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),ue=0;var t=($=e.__c).__H;t&&(nr===$?(t.__h=[],$.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(Ve),t.__h.forEach(cr),t.__h=[],ue=0)),nr=$},H.diffed=function(e){Yr&&Yr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($i.push(t)!==1&&Vr===H.requestAnimationFrame||((Vr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),nr=$=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Ve),r.__h=r.__h.filter(function(i){return!i.__||cr(i)})}catch(i){t.some(function(n){n.__h&&(n.__h=[])}),t=[],H.__e(i,r.__v)}}),Jr&&Jr(e,t)},H.unmount=function(e){Xr&&Xr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(i){try{Ve(i)}catch(n){t=n}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Zr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(i),Zr&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,100);Zr&&(t=requestAnimationFrame(r))}function Ve(e){var t=$,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),$=t}function cr(e){var t=$;e.__c=e.__(),$=t}function wr(e,t){return!e||e.length!==t.length||t.some(function(r,i){return r!==e[i]})}function qi(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:Oa,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:Hi,useMemo:yr,useReducer:Ui,useRef:Pa,useState:Fi},Symbol.toStringTag,{value:"Module"})),Za=dr(za);export{Za as a,Ya as b,Ja as j,Qa as r,Xa as s}; +import{E as Er,g as dr,m as Oe}from"./index-BhXuIR47.js";import{e as ei}from"./events-DHqXLz5A.js";import{r as ti,i as Z}from"./inherits_browser-BBXdvzXT.js";const ji=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:Er,default:Er},Symbol.toStringTag,{value:"Module"})),Ya=dr(ji);var ar={exports:{}},ri=ei.EventEmitter,Yt,xr;function Wi(){if(xr)return Yt;xr=1;function e(m,T){var E=Object.keys(m);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(m);T&&(s=s.filter(function(p){return Object.getOwnPropertyDescriptor(m,p).enumerable})),E.push.apply(E,s)}return E}function t(m){for(var T=1;T0?this.tail.next=s:this.head=s,this.tail=s,++this.length}},{key:"unshift",value:function(E){var s={data:E,next:this.head};this.length===0&&(this.tail=s),this.head=s,++this.length}},{key:"shift",value:function(){if(this.length!==0){var E=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,E}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(E){if(this.length===0)return"";for(var s=this.head,p=""+s.data;s=s.next;)p+=E+s.data;return p}},{key:"concat",value:function(E){if(this.length===0)return h.alloc(0);for(var s=h.allocUnsafe(E>>>0),p=this.head,C=0;p;)v(p.data,s,C),C+=p.data.length,p=p.next;return s}},{key:"consume",value:function(E,s){var p;return ER.length?R.length:E;if(S===R.length?C+=R:C+=R.slice(0,E),E-=S,E===0){S===R.length?(++p,s.next?this.head=s.next:this.head=this.tail=null):(this.head=s,s.data=R.slice(S));break}++p}return this.length-=p,C}},{key:"_getBuffer",value:function(E){var s=h.allocUnsafe(E),p=this.head,C=1;for(p.data.copy(s),E-=p.data.length;p=p.next;){var R=p.data,S=E>R.length?R.length:E;if(R.copy(s,s.length-E,0,S),E-=S,E===0){S===R.length?(++C,p.next?this.head=p.next:this.head=this.tail=null):(this.head=p,p.data=R.slice(S));break}++C}return this.length-=C,s}},{key:w,value:function(E,s){return _(this,t(t({},s),{},{depth:0,customInspect:!1}))}}]),m}(),Yt}var pe={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function zi(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,pe.nextTick(or,this,e)):pe.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?pe.nextTick(ze,r):(r._writableState.errorEmitted=!0,pe.nextTick(mr,r,f)):pe.nextTick(mr,r,f):t?(pe.nextTick(ze,r),t(f)):pe.nextTick(ze,r)}),this)}function mr(e,t){or(e,t),ze(e)}function ze(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Vi(){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 Gi(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}var ii={destroy:zi,undestroy:Vi,errorOrDestroy:Gi},ve={};function Ki(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var ni={};function J(e,t,r){r||(r=Error);function i(f,l,u){return typeof t=="string"?t:t(f,l,u)}var n=function(f){Ki(l,f);function l(u,b,h){return f.call(this,i(u,b,h))||this}return l}(r);n.prototype.name=r.name,n.prototype.code=e,ni[e]=n}function Sr(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),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 Yi(e,t,r){return e.substr(0,t.length)===t}function Ji(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function Xi(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}J("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);J("ERR_INVALID_ARG_TYPE",function(e,t,r){var i;typeof t=="string"&&Yi(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(Ji(e," argument"))n="The ".concat(e," ").concat(i," ").concat(Sr(t,"type"));else{var f=Xi(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(f," ").concat(i," ").concat(Sr(t,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError);J("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");J("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});J("ERR_STREAM_PREMATURE_CLOSE","Premature close");J("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});J("ERR_MULTIPLE_CALLBACK","Callback called multiple times");J("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");J("ERR_STREAM_WRITE_AFTER_END","write after end");J("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);J("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);J("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");ve.codes=ni;var Qi=ve.codes.ERR_INVALID_OPT_VALUE;function Zi(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function en(e,t,r,i){var n=Zi(t,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var f=i?r:"highWaterMark";throw new Qi(f,n)}return Math.floor(n)}return e.objectMode?16:16*1024}var ai={getHighWaterMark:en},tn=rn;function rn(e,t){if(Jt("noDeprecation"))return e;var r=!1;function i(){if(!r){if(Jt("throwDeprecation"))throw new Error(t);Jt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function Jt(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var Xt,Rr;function oi(){if(Rr)return Xt;Rr=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};Xt=D;function t(c){var d=this;this.next=null,this.entry=null,this.finish=function(){q(d,c)}}var r;D.WritableState=M;var i={deprecate:tn},n=ri,f=Oe.Buffer,l=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(c){return f.from(c)}function b(c){return f.isBuffer(c)||c instanceof l}var h=ii,g=ai,_=g.getHighWaterMark,w=ve.codes,v=w.ERR_INVALID_ARG_TYPE,m=w.ERR_METHOD_NOT_IMPLEMENTED,T=w.ERR_MULTIPLE_CALLBACK,E=w.ERR_STREAM_CANNOT_PIPE,s=w.ERR_STREAM_DESTROYED,p=w.ERR_STREAM_NULL_VALUES,C=w.ERR_STREAM_WRITE_AFTER_END,R=w.ERR_UNKNOWN_ENCODING,S=h.errorOrDestroy;Z(D,n);function N(){}function M(c,d,x){r=r||Se(),c=c||{},typeof x!="boolean"&&(x=d instanceof r),this.objectMode=!!c.objectMode,x&&(this.objectMode=this.objectMode||!!c.writableObjectMode),this.highWaterMark=_(this,c,"writableHighWaterMark",x),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var k=c.decodeStrings===!1;this.decodeStrings=!k,this.defaultEncoding=c.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(O){he(d,O)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=c.emitClose!==!1,this.autoDestroy=!!c.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}M.prototype.getBuffer=function(){for(var d=this.bufferedRequest,x=[];d;)x.push(d),d=d.next;return x},function(){try{Object.defineProperty(M.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var P;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(P=Function.prototype[Symbol.hasInstance],Object.defineProperty(D,Symbol.hasInstance,{value:function(d){return P.call(this,d)?!0:this!==D?!1:d&&d._writableState instanceof M}})):P=function(d){return d instanceof this};function D(c){r=r||Se();var d=this instanceof r;if(!d&&!P.call(D,this))return new D(c);this._writableState=new M(c,this,d),this.writable=!0,c&&(typeof c.write=="function"&&(this._write=c.write),typeof c.writev=="function"&&(this._writev=c.writev),typeof c.destroy=="function"&&(this._destroy=c.destroy),typeof c.final=="function"&&(this._final=c.final)),n.call(this)}D.prototype.pipe=function(){S(this,new E)};function B(c,d){var x=new C;S(c,x),e.nextTick(d,x)}function j(c,d,x,k){var O;return x===null?O=new p:typeof x!="string"&&!d.objectMode&&(O=new v("chunk",["string","Buffer"],x)),O?(S(c,O),e.nextTick(k,O),!1):!0}D.prototype.write=function(c,d,x){var k=this._writableState,O=!1,a=!k.objectMode&&b(c);return a&&!f.isBuffer(c)&&(c=u(c)),typeof d=="function"&&(x=d,d=null),a?d="buffer":d||(d=k.defaultEncoding),typeof x!="function"&&(x=N),k.ending?B(this,x):(a||j(this,k,c,x))&&(k.pendingcb++,O=W(this,k,a,c,d,x)),O},D.prototype.cork=function(){this._writableState.corked++},D.prototype.uncork=function(){var c=this._writableState;c.corked&&(c.corked--,!c.writing&&!c.corked&&!c.bufferProcessing&&c.bufferedRequest&&Q(this,c))},D.prototype.setDefaultEncoding=function(d){if(typeof d=="string"&&(d=d.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((d+"").toLowerCase())>-1))throw new R(d);return this._writableState.defaultEncoding=d,this},Object.defineProperty(D.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function X(c,d,x){return!c.objectMode&&c.decodeStrings!==!1&&typeof d=="string"&&(d=f.from(d,x)),d}Object.defineProperty(D.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function W(c,d,x,k,O,a){if(!x){var o=X(d,k,O);k!==o&&(x=!0,O="buffer",k=o)}var y=d.objectMode?1:k.length;d.length+=y;var A=d.length */var Cr;function nn(){return Cr||(Cr=1,function(e,t){var r=Oe,i=r.Buffer;function n(l,u){for(var b in l)u[b]=l[b]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=f);function f(l,u,b){return i(l,u,b)}f.prototype=Object.create(i.prototype),n(i,f),f.from=function(l,u,b){if(typeof l=="number")throw new TypeError("Argument must not be a number");return i(l,u,b)},f.alloc=function(l,u,b){if(typeof l!="number")throw new TypeError("Argument must be a number");var h=i(l);return u!==void 0?typeof b=="string"?h.fill(u,b):h.fill(u):h.fill(0),h},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return i(l)},f.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}}(je,je.exports)),je.exports}var Ar;function Br(){if(Ar)return Zt;Ar=1;var e=nn().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 i(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=n;function n(s){this.encoding=i(s);var p;switch(this.encoding){case"utf16le":this.text=_,this.end=w,p=4;break;case"utf8":this.fillLast=b,p=4;break;case"base64":this.text=v,this.end=m,p=3;break;default:this.write=T,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(p)}n.prototype.write=function(s){if(s.length===0)return"";var p,C;if(this.lastNeed){if(p=this.fillLast(s),p===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C>5===6?2:s>>4===14?3:s>>3===30?4:s>>6===2?-1:-2}function l(s,p,C){var R=p.length-1;if(R=0?(S>0&&(s.lastNeed=S-1),S):--R=0?(S>0&&(s.lastNeed=S-2),S):--R=0?(S>0&&(S===2?S=0:s.lastNeed=S-3),S):0))}function u(s,p,C){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 b(s){var p=this.lastTotal-this.lastNeed,C=u(this,s);if(C!==void 0)return C;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 h(s,p){var C=l(this,s,p);if(!this.lastNeed)return s.toString("utf8",p);this.lastTotal=C;var R=s.length-(C-this.lastNeed);return s.copy(this.lastChar,0,R),s.toString("utf8",p,R)}function g(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+"�":p}function _(s,p){if((s.length-p)%2===0){var C=s.toString("utf16le",p);if(C){var R=C.charCodeAt(C.length-1);if(R>=55296&&R<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=s[s.length-2],this.lastChar[1]=s[s.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=s[s.length-1],s.toString("utf16le",p,s.length-1)}function w(s){var p=s&&s.length?this.write(s):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return p+this.lastChar.toString("utf16le",0,C)}return p}function v(s,p){var C=(s.length-p)%3;return C===0?s.toString("base64",p):(this.lastNeed=3-C,this.lastTotal=3,C===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-C))}function m(s){var p=s&&s.length?this.write(s):"";return this.lastNeed?p+this.lastChar.toString("base64",0,3-this.lastNeed):p}function T(s){return s.toString(this.encoding)}function E(s){return s&&s.length?this.write(s):""}return Zt}var kr=ve.codes.ERR_STREAM_PREMATURE_CLOSE;function an(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n0)if(typeof o!="string"&&!L.objectMode&&Object.getPrototypeOf(o)!==n.prototype&&(o=l(o)),A)L.endEmitted?N(a,new p):X(a,L,o,!0);else if(L.ended)N(a,new E);else{if(L.destroyed)return!1;L.reading=!1,L.decoder&&!y?(o=L.decoder.write(o),L.objectMode||o.length!==0?X(a,L,o,!1):Q(a,L)):X(a,L,o,!1)}else A||(L.reading=!1,Q(a,L))}return!L.ended&&(L.length=V?a=V:(a--,a|=a>>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}function ne(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=G(a)),a<=o.length?a:o.ended?o.length:(o.needReadable=!0,0))}B.prototype.read=function(a){h("read",a),a=parseInt(a,10);var o=this._readableState,y=a;if(a!==0&&(o.emittedReadable=!1),a===0&&o.needReadable&&((o.highWaterMark!==0?o.length>=o.highWaterMark:o.length>0)||o.ended))return h("read: emitReadable",o.length,o.ended),o.length===0&&o.ended?x(this):K(this),null;if(a=ne(a,o),a===0&&o.ended)return o.length===0&&x(this),null;var A=o.needReadable;h("need readable",A),(o.length===0||o.length-a0?U=d(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),y!==a&&o.ended&&x(this)),U!==null&&this.emit("data",U),U};function he(a,o){if(h("onEofChunk"),!o.ended){if(o.decoder){var y=o.decoder.end();y&&y.length&&(o.buffer.push(y),o.length+=o.objectMode?1:y.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;h("emitReadable",o.needReadable,o.emittedReadable),o.needReadable=!1,o.emittedReadable||(h("emitReadable",o.flowing),o.emittedReadable=!0,e.nextTick(ee,a))}function ee(a){var o=a._readableState;h("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,c(a)}function Q(a,o){o.readingMore||(o.readingMore=!0,e.nextTick(ae,a,o))}function ae(a,o){for(;!o.reading&&!o.ended&&(o.length1&&O(A.pipes,a)!==-1)&&!Be&&(h("false write response, pause",A.awaitDrain),A.awaitDrain++),y.pause())}function Ee(re){h("onerror",re),ce(),a.removeListener("error",Ee),r(a,"error")===0&&N(a,re)}P(a,"error",Ee);function xe(){a.removeListener("finish",me),ce()}a.once("close",xe);function me(){h("onfinish"),a.removeListener("close",xe),ce()}a.once("finish",me);function ce(){h("unpipe"),y.unpipe(a)}return a.emit("pipe",y),A.flowing||(h("pipe resume"),y.resume()),a};function _e(a){return function(){var y=a._readableState;h("pipeOnDrain",y.awaitDrain),y.awaitDrain&&y.awaitDrain--,y.awaitDrain===0&&r(a,"data")&&(y.flowing=!0,c(a))}}B.prototype.unpipe=function(a){var o=this._readableState,y={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,y),this);if(!a){var A=o.pipes,U=o.pipesCount;o.pipes=null,o.pipesCount=0,o.flowing=!1;for(var L=0;L0,A.flowing!==!1&&this.resume()):a==="readable"&&!A.endEmitted&&!A.readableListening&&(A.readableListening=A.needReadable=!0,A.flowing=!1,A.emittedReadable=!1,h("on readable",A.length,A.reading),A.length?K(this):A.reading||e.nextTick(Y,this)),y},B.prototype.addListener=B.prototype.on,B.prototype.removeListener=function(a,o){var y=i.prototype.removeListener.call(this,a,o);return a==="readable"&&e.nextTick(te,this),y},B.prototype.removeAllListeners=function(a){var o=i.prototype.removeAllListeners.apply(this,arguments);return(a==="readable"||a===void 0)&&e.nextTick(te,this),o};function te(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 Y(a){h("readable nexttick read 0"),a.read(0)}B.prototype.resume=function(){var a=this._readableState;return a.flowing||(h("resume"),a.flowing=!a.readableListening,oe(this,a)),a.paused=!1,this};function oe(a,o){o.resumeScheduled||(o.resumeScheduled=!0,e.nextTick(q,a,o))}function q(a,o){h("resume",o.reading),o.reading||a.read(0),o.resumeScheduled=!1,a.emit("resume"),c(a),o.flowing&&!o.reading&&a.read(0)}B.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function c(a){var o=a._readableState;for(h("flow",o.flowing);o.flowing&&a.read()!==null;);}B.prototype.wrap=function(a){var o=this,y=this._readableState,A=!1;a.on("end",function(){if(h("wrapped end"),y.decoder&&!y.ended){var I=y.decoder.end();I&&I.length&&o.push(I)}o.push(null)}),a.on("data",function(I){if(h("wrapped data"),y.decoder&&(I=y.decoder.write(I)),!(y.objectMode&&I==null)&&!(!y.objectMode&&(!I||!I.length))){var fe=o.push(I);fe||(A=!0,a.pause())}});for(var U in a)this[U]===void 0&&typeof a[U]=="function"&&(this[U]=function(fe){return function(){return a[fe].apply(a,arguments)}}(U));for(var L=0;L=o.length?(o.decoder?y=o.buffer.join(""):o.buffer.length===1?y=o.buffer.first():y=o.buffer.concat(o.length),o.buffer.clear()):y=o.buffer.consume(a,o.decoder),y}function x(a){var o=a._readableState;h("endReadable",o.endEmitted),o.endEmitted||(o.ended=!0,e.nextTick(k,o,a))}function k(a,o){if(h("endReadableNT",a.endEmitted,a.length),!a.endEmitted&&a.length===0&&(a.endEmitted=!0,o.readable=!1,o.emit("end"),a.autoDestroy)){var y=o._writableState;(!y||y.autoDestroy&&y.finished)&&o.destroy()}}typeof Symbol=="function"&&(B.from=function(a,o){return S===void 0&&(S=ln()),S(B,a,o)});function O(a,o){for(var y=0,A=a.length;y0;return En(l,b,h,function(g){n||(n=g),g&&f.forEach(Pr),!b&&(f.forEach(Pr),i(n))})});return t.reduce(xn)}var Rn=Sn;(function(e,t){t=e.exports=si(),t.Stream=t,t.Readable=t,t.Writable=oi(),t.Duplex=Se(),t.Transform=li,t.PassThrough=bn,t.finished=pr,t.pipeline=Rn})(ar,ar.exports);var _i=ar.exports;const{Transform:Tn}=_i;var Cn=e=>class ci extends Tn{constructor(r,i,n,f,l){super(l),this._rate=r,this._capacity=i,this._delimitedSuffix=n,this._hashBitLength=f,this._options=l,this._state=new e,this._state.initialize(r,i),this._finalized=!1}_transform(r,i,n){let f=null;try{this.update(r,i)}catch(l){f=l}n(f)}_flush(r){let i=null;try{this.push(this.digest())}catch(n){i=n}r(i)}update(r,i){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,i)),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 i=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(i=i.toString(r)),this._resetState(),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new ci(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:An}=_i;var Bn=e=>class di extends An{constructor(r,i,n,f){super(f),this._rate=r,this._capacity=i,this._delimitedSuffix=n,this._options=f,this._state=new e,this._state.initialize(r,i),this._finalized=!1}_transform(r,i,n){let f=null;try{this.update(r,i)}catch(l){f=l}n(f)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,i){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,i)),this._state.absorb(r),this}squeeze(r,i){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let n=this._state.squeeze(r);return i!==void 0&&(n=n.toString(i)),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new di(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const kn=Cn,Mn=Bn;var Nn=function(e){const t=kn(e),r=Mn(e);return function(i,n){switch(typeof i=="string"?i.toLowerCase():i){case"keccak224":return new t(1152,448,null,224,n);case"keccak256":return new t(1088,512,null,256,n);case"keccak384":return new t(832,768,null,384,n);case"keccak512":return new t(576,1024,null,512,n);case"sha3-224":return new t(1152,448,6,224,n);case"sha3-256":return new t(1088,512,6,256,n);case"sha3-384":return new t(832,768,6,384,n);case"sha3-512":return new t(576,1024,6,512,n);case"shake128":return new r(1344,256,31,n);case"shake256":return new r(1088,512,31,n);default:throw new Error("Invald algorithm: "+i)}}},pi={};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];pi.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],n=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],u=e[5]^e[15]^e[25]^e[35]^e[45],b=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],g=e[8]^e[18]^e[28]^e[38]^e[48],_=e[9]^e[19]^e[29]^e[39]^e[49];let w=g^(n<<1|f>>>31),v=_^(f<<1|n>>>31);const m=e[0]^w,T=e[1]^v,E=e[10]^w,s=e[11]^v,p=e[20]^w,C=e[21]^v,R=e[30]^w,S=e[31]^v,N=e[40]^w,M=e[41]^v;w=r^(l<<1|u>>>31),v=i^(u<<1|l>>>31);const P=e[2]^w,D=e[3]^v,B=e[12]^w,j=e[13]^v,X=e[22]^w,W=e[23]^v,V=e[32]^w,G=e[33]^v,ne=e[42]^w,he=e[43]^v;w=n^(b<<1|h>>>31),v=f^(h<<1|b>>>31);const K=e[4]^w,ee=e[5]^v,Q=e[14]^w,ae=e[15]^v,_e=e[24]^w,te=e[25]^v,Y=e[34]^w,oe=e[35]^v,q=e[44]^w,c=e[45]^v;w=l^(g<<1|_>>>31),v=u^(_<<1|g>>>31);const d=e[6]^w,x=e[7]^v,k=e[16]^w,O=e[17]^v,a=e[26]^w,o=e[27]^v,y=e[36]^w,A=e[37]^v,U=e[46]^w,L=e[47]^v;w=b^(r<<1|i>>>31),v=h^(i<<1|r>>>31);const I=e[8]^w,fe=e[9]^v,de=e[18]^w,Be=e[19]^v,qe=e[28]^w,ke=e[29]^v,Ee=e[38]^w,xe=e[39]^v,me=e[48]^w,ce=e[49]^v,re=m,ie=T,tt=s<<4|E>>>28,rt=E<<4|s>>>28,it=p<<3|C>>>29,nt=C<<3|p>>>29,at=S<<9|R>>>23,ot=R<<9|S>>>23,ft=N<<18|M>>>14,st=M<<18|N>>>14,lt=P<<1|D>>>31,ut=D<<1|P>>>31,ht=j<<12|B>>>20,_t=B<<12|j>>>20,ct=X<<10|W>>>22,dt=W<<10|X>>>22,pt=G<<13|V>>>19,bt=V<<13|G>>>19,vt=ne<<2|he>>>30,gt=he<<2|ne>>>30,yt=ee<<30|K>>>2,wt=K<<30|ee>>>2,Et=Q<<6|ae>>>26,xt=ae<<6|Q>>>26,mt=te<<11|_e>>>21,St=_e<<11|te>>>21,Rt=Y<<15|oe>>>17,Tt=oe<<15|Y>>>17,Ct=c<<29|q>>>3,At=q<<29|c>>>3,Bt=d<<28|x>>>4,kt=x<<28|d>>>4,Mt=O<<23|k>>>9,Nt=k<<23|O>>>9,Dt=a<<25|o>>>7,Lt=o<<25|a>>>7,Ot=y<<21|A>>>11,Pt=A<<21|y>>>11,It=L<<24|U>>>8,$t=U<<24|L>>>8,Ft=I<<27|fe>>>5,Ut=fe<<27|I>>>5,Ht=de<<20|Be>>>12,qt=Be<<20|de>>>12,jt=ke<<7|qe>>>25,Wt=qe<<7|ke>>>25,zt=Ee<<8|xe>>>24,Vt=xe<<8|Ee>>>24,Gt=me<<14|ce>>>18,Kt=ce<<14|me>>>18;e[0]=re^~ht&mt,e[1]=ie^~_t&St,e[10]=Bt^~Ht&it,e[11]=kt^~qt&nt,e[20]=lt^~Et&Dt,e[21]=ut^~xt&Lt,e[30]=Ft^~tt&ct,e[31]=Ut^~rt&dt,e[40]=yt^~Mt&jt,e[41]=wt^~Nt&Wt,e[2]=ht^~mt&Ot,e[3]=_t^~St&Pt,e[12]=Ht^~it&pt,e[13]=qt^~nt&bt,e[22]=Et^~Dt&zt,e[23]=xt^~Lt&Vt,e[32]=tt^~ct&Rt,e[33]=rt^~dt&Tt,e[42]=Mt^~jt&at,e[43]=Nt^~Wt&ot,e[4]=mt^~Ot&Gt,e[5]=St^~Pt&Kt,e[14]=it^~pt&Ct,e[15]=nt^~bt&At,e[24]=Dt^~zt&ft,e[25]=Lt^~Vt&st,e[34]=ct^~Rt&It,e[35]=dt^~Tt&$t,e[44]=jt^~at&vt,e[45]=Wt^~ot>,e[6]=Ot^~Gt&re,e[7]=Pt^~Kt&ie,e[16]=pt^~Ct&Bt,e[17]=bt^~At&kt,e[26]=zt^~ft<,e[27]=Vt^~st&ut,e[36]=Rt^~It&Ft,e[37]=Tt^~$t&Ut,e[46]=at^~vt&yt,e[47]=ot^~gt&wt,e[8]=Gt^~re&ht,e[9]=Kt^~ie&_t,e[18]=Ct^~Bt&Ht,e[19]=At^~kt&qt,e[28]=ft^~lt&Et,e[29]=st^~ut&xt,e[38]=It^~Ft&tt,e[39]=$t^~Ut&rt,e[48]=vt^~yt&Mt,e[49]=gt^~wt&Nt,e[0]^=Ir[t*2],e[1]^=Ir[t*2+1]}};const Ge=pi;function Ce(){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}Ce.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};Ce.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};Ce.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 Dn=Ce,Ja=Nn(Dn),bi={exports:{}},fr={exports:{}};(function(e,t){var r=Oe,i=r.Buffer;function n(l,u){for(var b in l)u[b]=l[b]}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=f);function f(l,u,b){return i(l,u,b)}n(i,f),f.from=function(l,u,b){if(typeof l=="number")throw new TypeError("Argument must not be a number");return i(l,u,b)},f.alloc=function(l,u,b){if(typeof l!="number")throw new TypeError("Argument must be a number");var h=i(l);return u!==void 0?typeof b=="string"?h.fill(u,b):h.fill(u):h.fill(0),h},f.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return i(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 ge=fr.exports,vi=ge.Buffer;function Xe(e,t){this._block=vi.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Xe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=vi.from(e,t));for(var r=this._block,i=this._blockSize,n=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 i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,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,Ln=Z,gi=Ae,On=ge.Buffer,Pn=[1518500249,1859775393,-1894007588,-899497514],In=new Array(80);function Pe(){this.init(),this._w=In,gi.call(this,64,56)}Ln(Pe,gi);Pe.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function $n(e){return e<<5|e>>>27}function Fn(e){return e<<30|e>>>2}function Un(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Pe.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=t[u-3]^t[u-8]^t[u-14]^t[u-16];for(var b=0;b<80;++b){var h=~~(b/20),g=$n(r)+Un(h,i,n,f)+l+t[b]+Pn[h]|0;l=f,f=n,n=Fn(i),i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Pe.prototype._hash=function(){var e=On.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 Hn=Pe,qn=Z,yi=Ae,jn=ge.Buffer,Wn=[1518500249,1859775393,-1894007588,-899497514],zn=new Array(80);function Ie(){this.init(),this._w=zn,yi.call(this,64,56)}qn(Ie,yi);Ie.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Vn(e){return e<<1|e>>>31}function Gn(e){return e<<5|e>>>27}function Kn(e){return e<<30|e>>>2}function Yn(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Ie.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=0;u<16;++u)t[u]=e.readInt32BE(u*4);for(;u<80;++u)t[u]=Vn(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var b=0;b<80;++b){var h=~~(b/20),g=Gn(r)+Yn(h,i,n,f)+l+t[b]+Wn[h]|0;l=f,f=n,n=Kn(i),i=r,r=g}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0};Ie.prototype._hash=function(){var e=jn.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 Jn=Ie,Xn=Z,wi=Ae,Qn=ge.Buffer,Zn=[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 $e(){this.init(),this._w=ea,wi.call(this,64,56)}Xn($e,wi);$e.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 ia(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function na(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}$e.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,f=this._d|0,l=this._e|0,u=this._f|0,b=this._g|0,h=this._h|0,g=0;g<16;++g)t[g]=e.readInt32BE(g*4);for(;g<64;++g)t[g]=oa(t[g-2])+t[g-7]+aa(t[g-15])+t[g-16]|0;for(var _=0;_<64;++_){var w=h+na(l)+ta(l,u,b)+Zn[_]+t[_]|0,v=ia(r)+ra(r,i,n)|0;h=b,b=u,u=l,l=f+w|0,f=n,n=i,i=r,r=w+v|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=f+this._d|0,this._e=l+this._e|0,this._f=u+this._f|0,this._g=b+this._g|0,this._h=h+this._h|0};$e.prototype._hash=function(){var e=Qn.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 Ei=$e,fa=Z,sa=Ei,la=Ae,ua=ge.Buffer,ha=new Array(64);function Qe(){this.init(),this._w=ha,la.call(this,64,56)}fa(Qe,sa);Qe.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};Qe.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=Qe,ca=Z,xi=Ae,da=ge.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 Fe(){this.init(),this._w=pa,xi.call(this,128,112)}ca(Fe,xi);Fe.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 z(e,t){return e>>>0>>0?1:0}Fe.prototype._update=function(e){for(var t=this._w,r=this._ah|0,i=this._bh|0,n=this._ch|0,f=this._dh|0,l=this._eh|0,u=this._fh|0,b=this._gh|0,h=this._hh|0,g=this._al|0,_=this._bl|0,w=this._cl|0,v=this._dl|0,m=this._el|0,T=this._fl|0,E=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 C=t[p-30],R=t[p-15*2+1],S=ba(C,R),N=va(R,C);C=t[p-2*2],R=t[p-2*2+1];var M=ga(C,R),P=ya(R,C),D=t[p-7*2],B=t[p-7*2+1],j=t[p-16*2],X=t[p-16*2+1],W=N+B|0,V=S+D+z(W,N)|0;W=W+P|0,V=V+M+z(W,P)|0,W=W+X|0,V=V+j+z(W,X)|0,t[p]=V,t[p+1]=W}for(var G=0;G<160;G+=2){V=t[G],W=t[G+1];var ne=Ur(r,i,n),he=Ur(g,_,w),K=Hr(r,g),ee=Hr(g,r),Q=qr(l,m),ae=qr(m,l),_e=$r[G],te=$r[G+1],Y=Fr(l,u,b),oe=Fr(m,T,E),q=s+ae|0,c=h+Q+z(q,s)|0;q=q+oe|0,c=c+Y+z(q,oe)|0,q=q+te|0,c=c+_e+z(q,te)|0,q=q+W|0,c=c+V+z(q,W)|0;var d=ee+he|0,x=K+ne+z(d,ee)|0;h=b,s=E,b=u,E=T,u=l,T=m,m=v+q|0,l=f+c+z(m,v)|0,f=n,v=w,n=i,w=_,i=r,_=g,g=q+d|0,r=c+x+z(g,q)|0}this._al=this._al+g|0,this._bl=this._bl+_|0,this._cl=this._cl+w|0,this._dl=this._dl+v|0,this._el=this._el+m|0,this._fl=this._fl+T|0,this._gl=this._gl+E|0,this._hl=this._hl+s|0,this._ah=this._ah+r+z(this._al,g)|0,this._bh=this._bh+i+z(this._bl,_)|0,this._ch=this._ch+n+z(this._cl,w)|0,this._dh=this._dh+f+z(this._dl,v)|0,this._eh=this._eh+l+z(this._el,m)|0,this._fh=this._fh+u+z(this._fl,T)|0,this._gh=this._gh+b+z(this._gl,E)|0,this._hh=this._hh+h+z(this._hl,s)|0};Fe.prototype._hash=function(){var e=da.allocUnsafe(64);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var mi=Fe,wa=Z,Ea=mi,xa=Ae,ma=ge.Buffer,Sa=new Array(160);function Ze(){this.init(),this._w=Sa,xa.call(this,128,112)}wa(Ze,Ea);Ze.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};Ze.prototype._hash=function(){var e=ma.allocUnsafe(48);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Ra=Ze,ye=bi.exports=function(t){t=t.toLowerCase();var r=ye[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ye.sha=Hn;ye.sha1=Jn;ye.sha224=_a;ye.sha256=Ei;ye.sha384=Ra;ye.sha512=mi;var Xa=bi.exports,Ue,F,Si,Ri,be,jr,Ti,sr,br,lr,ur,Ci,Le={},Ai=[],Ta=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,et=Array.isArray;function se(e,t){for(var r in t)e[r]=t[r];return e}function Bi(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hr(e,t,r){var i,n,f,l={};for(f in t)f=="key"?i=t[f]:f=="ref"?n=t[f]:l[f]=t[f];if(arguments.length>2&&(l.children=arguments.length>3?Ue.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 Me(e,l,i,n,null)}function Me(e,t,r,i,n){var f={type:e,props:t,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++Si,__i:-1,__u:0};return n==null&&F.vnode!=null&&F.vnode(f),f}function Ca(){return{current:null}}function He(e){return e.children}function Ne(e,t){this.props=e,this.context=t}function Re(e,t){if(t==null)return e.__?Re(e.__,e.__i+1):null;for(var r;tt&&be.sort(sr));Ke.__r=0}function Mi(e,t,r,i,n,f,l,u,b,h,g){var _,w,v,m,T,E=i&&i.__k||Ai,s=t.length;for(r.__d=b,Aa(r,t,E),b=r.__d,_=0;_0?Me(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n).__=e,n.__b=e.__b+1,f=null,(u=n.__i=Ba(n,r,l,g))!==-1&&(g--,(f=r[u])&&(f.__u|=131072)),f==null||f.__v===null?(u==-1&&_--,typeof n.type!="function"&&(n.__u|=65536)):u!==l&&(u==l-1?_--:u==l+1?_++:(u>l?_--:_++,n.__u|=65536))):n=e.__k[i]=null;if(g)for(i=0;i(b!=null&&!(131072&b.__u)?1:0))for(;l>=0||u=0){if((b=t[l])&&!(131072&b.__u)&&n==b.key&&f===b.type)return l;l--}if(u2&&(u.children=arguments.length>3?Ue.call(arguments,2):r),Me(e.type,u,i||e.key,n||e.ref,null)}function Da(e,t){var r={__c:t="__cC"+Ci++,__:e,Consumer:function(i,n){return i.children(n)},Provider:function(i){var n,f;return this.getChildContext||(n=new Set,(f={})[t]=this,this.getChildContext=function(){return f},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(l){this.props.value!==l.value&&n.forEach(function(u){u.__e=!0,_r(u)})},this.sub=function(l){n.add(l);var u=l.componentWillUnmount;l.componentWillUnmount=function(){n&&n.delete(l),u&&u.call(l)}}),i.children}};return r.Provider.__=r.Consumer.contextType=r}Ue=Ai.slice,F={__e:function(e,t,r,i){for(var n,f,l;t=t.__;)if((n=t.__c)&&!n.__)try{if((f=n.constructor)&&f.getDerivedStateFromError!=null&&(n.setState(f.getDerivedStateFromError(e)),l=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,i||{}),l=n.__d),l)return n.__E=n}catch(u){e=u}throw e}},Si=0,Ri=function(e){return e!=null&&e.constructor==null},Ne.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=se({},this.state),typeof e=="function"&&(e=e(se({},r),this.props)),e&&se(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),_r(this))},Ne.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_r(this))},Ne.prototype.render=He,be=[],Ti=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sr=function(e,t){return e.__v.__b-t.__v.__b},Ke.__r=0,br=0,lr=zr(!1),ur=zr(!0),Ci=0;const La=Object.freeze(Object.defineProperty({__proto__:null,Component:Ne,Fragment:He,cloneElement:Na,createContext:Da,createElement:hr,createRef:Ca,h:hr,hydrate:Ii,get isValidElement(){return Ri},get options(){return F},render:Pi,toChildArray:Di},Symbol.toStringTag,{value:"Module"})),Qa=dr(La);var ue,$,nr,Vr,Te=0,$i=[],H=F,Gr=H.__b,Kr=H.__r,Yr=H.diffed,Jr=H.__c,Xr=H.unmount,Qr=H.__;function we(e,t){H.__h&&H.__h($,e,Te||t),Te=0;var r=$.__H||($.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Fi(e){return Te=1,Ui(qi,e)}function Ui(e,t,r){var i=we(ue++,2);if(i.t=e,!i.__c&&(i.__=[r?r(t):qi(void 0,t),function(u){var b=i.__N?i.__N[0]:i.__[0],h=i.t(b,u);b!==h&&(i.__N=[h,i.__[1]],i.__c.setState({}))}],i.__c=$,!$.u)){var n=function(u,b,h){if(!i.__c.__H)return!0;var g=i.__c.__H.__.filter(function(w){return!!w.__c});if(g.every(function(w){return!w.__N}))return!f||f.call(this,u,b,h);var _=!1;return g.forEach(function(w){if(w.__N){var v=w.__[0];w.__=w.__N,w.__N=void 0,v!==w.__[0]&&(_=!0)}}),!(!_&&i.__c.props===u)&&(!f||f.call(this,u,b,h))};$.u=!0;var f=$.shouldComponentUpdate,l=$.componentWillUpdate;$.componentWillUpdate=function(u,b,h){if(this.__e){var g=f;f=void 0,n(u,b,h),f=g}l&&l.call(this,u,b,h)},$.shouldComponentUpdate=n}return i.__N||i.__}function Oa(e,t){var r=we(ue++,3);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,$.__H.__h.push(r))}function Hi(e,t){var r=we(ue++,4);!H.__s&&wr(r.__H,t)&&(r.__=e,r.i=t,$.__h.push(r))}function Pa(e){return Te=5,yr(function(){return{current:e}},[])}function Ia(e,t,r){Te=6,Hi(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=we(ue++,7);return wr(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $a(e,t){return Te=8,yr(function(){return e},t)}function Fa(e){var t=$.context[e.__c],r=we(ue++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub($)),t.props.value):e.__}function Ua(e,t){H.useDebugValue&&H.useDebugValue(t?t(e):e)}function Ha(e){var t=we(ue++,10),r=Fi();return t.__=e,$.componentDidCatch||($.componentDidCatch=function(i,n){t.__&&t.__(i,n),r[1](i)}),[r[0],function(){r[1](void 0)}]}function qa(){var e=we(ue++,11);if(!e.__){for(var t=$.__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=$i.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Ve),e.__H.__h.forEach(cr),e.__H.__h=[]}catch(t){e.__H.__h=[],H.__e(t,e.__v)}}H.__b=function(e){$=null,Gr&&Gr(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),ue=0;var t=($=e.__c).__H;t&&(nr===$?(t.__h=[],$.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.i=r.__N=void 0})):(t.__h.forEach(Ve),t.__h.forEach(cr),t.__h=[],ue=0)),nr=$},H.diffed=function(e){Yr&&Yr(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($i.push(t)!==1&&Vr===H.requestAnimationFrame||((Vr=H.requestAnimationFrame)||Wa)(ja)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.i=void 0})),nr=$=null},H.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Ve),r.__h=r.__h.filter(function(i){return!i.__||cr(i)})}catch(i){t.some(function(n){n.__h&&(n.__h=[])}),t=[],H.__e(i,r.__v)}}),Jr&&Jr(e,t)},H.unmount=function(e){Xr&&Xr(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(i){try{Ve(i)}catch(n){t=n}}),r.__H=void 0,t&&H.__e(t,r.__v))};var Zr=typeof requestAnimationFrame=="function";function Wa(e){var t,r=function(){clearTimeout(i),Zr&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(r,100);Zr&&(t=requestAnimationFrame(r))}function Ve(e){var t=$,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),$=t}function cr(e){var t=$;e.__c=e.__(),$=t}function wr(e,t){return!e||e.length!==t.length||t.some(function(r,i){return r!==e[i]})}function qi(e,t){return typeof t=="function"?t(e):t}const za=Object.freeze(Object.defineProperty({__proto__:null,useCallback:$a,useContext:Fa,useDebugValue:Ua,useEffect:Oa,useErrorBoundary:Ha,useId:qa,useImperativeHandle:Ia,useLayoutEffect:Hi,useMemo:yr,useReducer:Ui,useRef:Pa,useState:Fi},Symbol.toStringTag,{value:"Module"})),Za=dr(za);export{Za as a,Ya as b,Ja as j,Qa as r,Xa as s}; diff --git a/buddybook/assets/index-jQUXy-RB.js b/buddybook/assets/index-B-is0UYJ.js similarity index 99% rename from buddybook/assets/index-jQUXy-RB.js rename to buddybook/assets/index-B-is0UYJ.js index 3b2171f..4b8cd52 100644 --- a/buddybook/assets/index-jQUXy-RB.js +++ b/buddybook/assets/index-B-is0UYJ.js @@ -1,4 +1,4 @@ -import{T as $t,M as re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-BJjm4ut_.js";import{C as Wo}from"./index-D4GNEarw.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,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]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={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)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=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(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):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 re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-DYbq_cjT.js";import{C as Wo}from"./index-BhXuIR47.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,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]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={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)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=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(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):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-CT_b5y6n.js b/buddybook/assets/index-BBMEgiCJ.js similarity index 99% rename from buddybook/assets/index-CT_b5y6n.js rename to buddybook/assets/index-BBMEgiCJ.js index e45757a..ddc484c 100644 --- a/buddybook/assets/index-CT_b5y6n.js +++ b/buddybook/assets/index-BBMEgiCJ.js @@ -1,4 +1,4 @@ -import{d as T,g as Hs,j as Tc,l as xc,h as Pc}from"./index-D4GNEarw.js";import{r as $c}from"./inherits_browser-Cg-Az14D.js";import{s as Oc,r as Ke,a as an,j as Bc,b as Dc}from"./hooks.module-Dd0QlYUx.js";import{e as ta}from"./events-CXYVpbcl.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 x=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=x(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,Ti=g[9]|0,pe=Ti&8191,me=Ti>>>13,xi=m[0]|0,ve=xi&8191,we=xi>>>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,Te=Fi>>>13,Hi=m[8]|0,xe=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,Te)|0,a=a+Math.imul($,Le)|0,v=v+Math.imul($,Te)|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,Te)|0,a=a+Math.imul(Z,Le)|0,v=v+Math.imul(Z,Te)|0,p=p+Math.imul(I,xe)|0,a=a+Math.imul(I,Pe)|0,a=a+Math.imul($,xe)|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,Te)|0,a=a+Math.imul(re,Le)|0,v=v+Math.imul(re,Te)|0,p=p+Math.imul(G,xe)|0,a=a+Math.imul(G,Pe)|0,a=a+Math.imul(Z,xe)|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,Te)|0,a=a+Math.imul(se,Le)|0,v=v+Math.imul(se,Te)|0,p=p+Math.imul(te,xe)|0,a=a+Math.imul(te,Pe)|0,a=a+Math.imul(re,xe)|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,Te)|0,a=a+Math.imul(oe,Le)|0,v=v+Math.imul(oe,Te)|0,p=p+Math.imul(ne,xe)|0,a=a+Math.imul(ne,Pe)|0,a=a+Math.imul(se,xe)|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,Te)|0,a=a+Math.imul(ce,Le)|0,v=v+Math.imul(ce,Te)|0,p=p+Math.imul(ie,xe)|0,a=a+Math.imul(ie,Pe)|0,a=a+Math.imul(oe,xe)|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,Te)|0,a=a+Math.imul(ue,Le)|0,v=v+Math.imul(ue,Te)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Pe)|0,a=a+Math.imul(ce,xe)|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,Te)|0,a=a+Math.imul(he,Le)|0,v=v+Math.imul(he,Te)|0,p=p+Math.imul(le,xe)|0,a=a+Math.imul(le,Pe)|0,a=a+Math.imul(ue,xe)|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,Te)|0,a=a+Math.imul(ge,Le)|0,v=v+Math.imul(ge,Te)|0,p=p+Math.imul(de,xe)|0,a=a+Math.imul(de,Pe)|0,a=a+Math.imul(he,xe)|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,Te),a=a+Math.imul(me,Le)|0,v=Math.imul(me,Te),p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Pe)|0,a=a+Math.imul(ge,xe)|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,xe),a=Math.imul(pe,Pe),a=a+Math.imul(me,xe)|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,T)})(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 x=E;k.code=x.code,x.message&&typeof x.message=="string"?(k.message=x.message,y(x,"data")&&(k.data=x.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=T&&T.__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=T&&T.__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 x=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 x=vs[M];if(!x)throw new Error("Content too long: expected "+E+" but got "+y);switch(h){case"L":E=x[0];break;case"M":E=x[1];break;case"Q":E=x[2];break;case"H":E=x[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 T,g as Hs,j as Tc,l as xc,h as Pc}from"./index-BhXuIR47.js";import{r as $c}from"./inherits_browser-BBXdvzXT.js";import{s as Oc,r as Ke,a as an,j as Bc,b as Dc}from"./hooks.module-LlNaOzAU.js";import{e as ta}from"./events-DHqXLz5A.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 x=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=x(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,Ti=g[9]|0,pe=Ti&8191,me=Ti>>>13,xi=m[0]|0,ve=xi&8191,we=xi>>>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,Te=Fi>>>13,Hi=m[8]|0,xe=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,Te)|0,a=a+Math.imul($,Le)|0,v=v+Math.imul($,Te)|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,Te)|0,a=a+Math.imul(Z,Le)|0,v=v+Math.imul(Z,Te)|0,p=p+Math.imul(I,xe)|0,a=a+Math.imul(I,Pe)|0,a=a+Math.imul($,xe)|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,Te)|0,a=a+Math.imul(re,Le)|0,v=v+Math.imul(re,Te)|0,p=p+Math.imul(G,xe)|0,a=a+Math.imul(G,Pe)|0,a=a+Math.imul(Z,xe)|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,Te)|0,a=a+Math.imul(se,Le)|0,v=v+Math.imul(se,Te)|0,p=p+Math.imul(te,xe)|0,a=a+Math.imul(te,Pe)|0,a=a+Math.imul(re,xe)|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,Te)|0,a=a+Math.imul(oe,Le)|0,v=v+Math.imul(oe,Te)|0,p=p+Math.imul(ne,xe)|0,a=a+Math.imul(ne,Pe)|0,a=a+Math.imul(se,xe)|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,Te)|0,a=a+Math.imul(ce,Le)|0,v=v+Math.imul(ce,Te)|0,p=p+Math.imul(ie,xe)|0,a=a+Math.imul(ie,Pe)|0,a=a+Math.imul(oe,xe)|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,Te)|0,a=a+Math.imul(ue,Le)|0,v=v+Math.imul(ue,Te)|0,p=p+Math.imul(ae,xe)|0,a=a+Math.imul(ae,Pe)|0,a=a+Math.imul(ce,xe)|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,Te)|0,a=a+Math.imul(he,Le)|0,v=v+Math.imul(he,Te)|0,p=p+Math.imul(le,xe)|0,a=a+Math.imul(le,Pe)|0,a=a+Math.imul(ue,xe)|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,Te)|0,a=a+Math.imul(ge,Le)|0,v=v+Math.imul(ge,Te)|0,p=p+Math.imul(de,xe)|0,a=a+Math.imul(de,Pe)|0,a=a+Math.imul(he,xe)|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,Te),a=a+Math.imul(me,Le)|0,v=Math.imul(me,Te),p=p+Math.imul(fe,xe)|0,a=a+Math.imul(fe,Pe)|0,a=a+Math.imul(ge,xe)|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,xe),a=Math.imul(pe,Pe),a=a+Math.imul(me,xe)|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,T)})(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 x=E;k.code=x.code,x.message&&typeof x.message=="string"?(k.message=x.message,y(x,"data")&&(k.data=x.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=T&&T.__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=T&&T.__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 x=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 x=vs[M];if(!x)throw new Error("Content too long: expected "+E+" but got "+y);switch(h){case"L":E=x[0];break;case"M":E=x[1];break;case"Q":E=x[2];break;case"H":E=x[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,x=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+=x+O+B,q+=H,q+="";break;case"svg-viewbox":M&&(q+=''+s),q+=''+s,q+=x+O+B,q+=H,q+="";break;case"g":q+=''+s,q+=x+O+B,q+=H,q+="";break;default:q+=(x+O+B+H).replace(/^\s+/,"");break}return q};var Al=wa,Nl=T&&T.__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,Tl=Nl(Al),xl=t=>{const[e,r]=(0,eo.useState)("");return(0,eo.useEffect)(()=>{var n,i;const s=new Tl.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=xl;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=T&&T.__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=T&&T.__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=T&&T.__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=T&&T.__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=T&&T.__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,x]=(0,i.useState)(!0),[O,B]=(0,i.useState)(S??!1);(0,i.useEffect)(()=>{const R=[window.setTimeout(()=>{x(!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,Tt=ur,no=it,kt=dr,fu=mn,xt=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(Tt.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(Tt.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(Tt.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(Tt.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,xt.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(Tt.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(Tt.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(Tt.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,xt.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,xt.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,xt.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}})},x=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:x,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,xt.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:""}}})},x=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:x,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,xt.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,xt.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 Tr={},Nn={},Sa={};(function(t){var e=T&&T.__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=T&&T.__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=T&&T.__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(Tr,"__esModule",{value:!0});Tr.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}}Tr.MobileRelayUI=Eu;Object.defineProperty(Ir,"__esModule",{value:!0});Ir.MobileRelay=void 0;const Su=A,Mu=Cr,ku=Tr;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 xu(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);xu(c)?(r.push(pt("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function Ta(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(Ta(t,e))}var Bu={rawEncode:$u,solidityPack:Ta,soliditySHA3:Ou};const lt=Aa,yr=Bu,xa={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 xa.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:xa,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 Tn={},$a={},xn={},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},xr={},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}}xr.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 xd(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:Td,never:ri,nonempty:xd,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 x(C,P){(0,r.assertStruct)(C,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",P)}t.assertIsJsonRpcSuccess=x;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=T&&T.__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(Tc),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},Rh={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},ks={};const Ih=typeof Rh=="object"&&ks&&ks.NODE_DEBUG&&/\bsemver\b/i.test(ks.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var Dn=Ih;(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=x=>{for(const[O,B]of E)x=x.split(`${O}*`).join(`${O}{0,${B}}`).split(`${O}+`).join(`${O}{1,${B}}`);return x},k=(x,O,B)=>{const L=M(O),R=y++;s(x,R,O),h[x]=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 Ch=Object.freeze({loose:!0}),Ah=Object.freeze({}),Nh=t=>t?typeof t!="object"?Ch:t:Ah;var ci=Nh;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:Lh};const Qr=Dn,{MAX_LENGTH:yo,MAX_SAFE_INTEGER:Kr}=Bn,{safeRe:bo,t:_o}=jr,Th=ci,{compareIdentifiers:Gt}=hc;let xh=class gt{constructor(e,r){if(r=Th(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,Ph=(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=Ph;const $h=gr,Oh=(t,e)=>{const r=$h(t,e);return r?r.version:null};var Bh=Oh;const Dh=gr,jh=(t,e)=>{const r=Dh(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var Fh=jh;const So=Ze,Hh=(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 Uh=Hh;const Mo=gr,Vh=(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 Wh=Vh;const zh=Ze,qh=(t,e)=>new zh(t,e).major;var Jh=qh;const Gh=Ze,Zh=(t,e)=>new Gh(t,e).minor;var Qh=Zh;const Kh=Ze,Xh=(t,e)=>new Kh(t,e).patch;var Yh=Xh;const ef=gr,tf=(t,e)=>{const r=ef(t,e);return r&&r.prerelease.length?r.prerelease:null};var rf=tf;const ko=Ze,nf=(t,e,r)=>new ko(t,r).compare(new ko(e,r));var ut=nf;const sf=ut,of=(t,e,r)=>sf(e,t,r);var af=of;const cf=ut,lf=(t,e)=>cf(t,e,!0);var uf=lf;const Ro=Ze,df=(t,e,r)=>{const n=new Ro(t,r),i=new Ro(e,r);return n.compare(i)||n.compareBuild(i)};var li=df;const hf=li,ff=(t,e)=>t.sort((r,n)=>hf(r,n,e));var gf=ff;const pf=li,mf=(t,e)=>t.sort((r,n)=>pf(n,r,e));var vf=mf;const wf=ut,yf=(t,e,r)=>wf(t,e,r)>0;var jn=yf;const bf=ut,_f=(t,e,r)=>bf(t,e,r)<0;var ui=_f;const Ef=ut,Sf=(t,e,r)=>Ef(t,e,r)===0;var fc=Sf;const Mf=ut,kf=(t,e,r)=>Mf(t,e,r)!==0;var gc=kf;const Rf=ut,If=(t,e,r)=>Rf(t,e,r)>=0;var di=If;const Cf=ut,Af=(t,e,r)=>Cf(t,e,r)<=0;var hi=Af;const Nf=fc,Lf=gc,Tf=jn,xf=di,Pf=ui,$f=hi,Of=(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 Nf(t,r,n);case"!=":return Lf(t,r,n);case">":return Tf(t,r,n);case">=":return xf(t,r,n);case"<":return Pf(t,r,n);case"<=":return $f(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var pc=Of;const Bf=Ze,Df=gr,{safeRe:Xr,t:Yr}=jr,jf=(t,e)=>{if(t instanceof Bf)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 Df(`${n}.${i}.${s}${c}${u}`,e)};var Ff=jf;class Hf{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 Uf=Hf,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=>!x(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(x(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 Vf=dt(),Wf=(t,e,r)=>{try{e=new Vf(e,r)}catch{return!1}return e.test(t)};var Hn=Wf;const zf=dt(),qf=(t,e)=>new zf(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Jf=qf;const Gf=Ze,Zf=dt(),Qf=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Zf(e,r)}catch{return null}return t.forEach(c=>{s.test(c)&&(!n||i.compare(c)===-1)&&(n=c,i=new Gf(n,r))}),n};var Kf=Qf;const Xf=Ze,Yf=dt(),e0=(t,e,r)=>{let n=null,i=null,s=null;try{s=new Yf(e,r)}catch{return null}return t.forEach(c=>{s.test(c)&&(!n||i.compare(c)===1)&&(n=c,i=new Xf(n,r))}),n};var t0=e0;const Cs=Ze,r0=dt(),Ao=jn,n0=(t,e)=>{t=new r0(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 s0=n0;const i0=dt(),o0=(t,e)=>{try{return new i0(t,e).range||"*"}catch{return null}};var a0=o0;const c0=Ze,mc=Fn(),{ANY:l0}=mc,u0=dt(),d0=Hn,No=jn,Lo=ui,h0=hi,f0=di,g0=(t,e,r,n)=>{t=new c0(t,n),e=new u0(e,n);let i,s,c,u,d;switch(r){case">":i=No,s=h0,c=Lo,u=">",d=">=";break;case"<":i=Lo,s=f0,c=No,u="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(d0(t,e,n))return!1;for(let h=0;h{M.semver===l0&&(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=g0;const p0=fi,m0=(t,e,r)=>p0(t,e,">",r);var v0=m0;const w0=fi,y0=(t,e,r)=>w0(t,e,"<",r);var b0=y0;const To=dt(),_0=(t,e,r)=>(t=new To(t,r),e=new To(e,r),t.intersects(e,r));var E0=_0;const S0=Hn,M0=ut;var k0=(t,e,r)=>{const n=[];let i=null,s=null;const c=t.sort((y,S)=>M0(y,S,r));for(const y of c)S0(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 xo(t,r),e=new xo(e,r);let n=!1;e:for(const i of t.set){for(const s of e.set){const c=C0(i,s,r);if(n=n||c!==null,c)continue e}if(n)return!1}return!0},I0=[new gi(">=0.0.0-0")],Po=[new gi(">=0.0.0")],C0=(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=I0: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 A0=R0;const Ns=jr,Bo=Bn,N0=Ze,Do=hc,L0=gr,T0=Bh,x0=Fh,P0=Uh,$0=Wh,O0=Jh,B0=Qh,D0=Yh,j0=rf,F0=ut,H0=af,U0=uf,V0=li,W0=gf,z0=vf,q0=jn,J0=ui,G0=fc,Z0=gc,Q0=di,K0=hi,X0=pc,Y0=Ff,e1=Fn(),t1=dt(),r1=Hn,n1=Jf,s1=Kf,i1=t0,o1=s0,a1=a0,c1=fi,l1=v0,u1=b0,d1=E0,h1=k0,f1=A0;var g1={parse:L0,valid:T0,clean:x0,inc:P0,diff:$0,major:O0,minor:B0,patch:D0,prerelease:j0,compare:F0,rcompare:H0,compareLoose:U0,compareBuild:V0,sort:W0,rsort:z0,gt:q0,lt:J0,eq:G0,neq:Z0,gte:Q0,lte:K0,cmp:X0,coerce:Y0,Comparator:e1,Range:t1,satisfies:r1,toComparators:n1,maxSatisfying:s1,minSatisfying:i1,minVersion:o1,validRange:a1,outside:c1,gtr:l1,ltr:u1,intersects:d1,simplifyRange:h1,subset:f1,SemVer:N0,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=g1,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=T&&T.__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=T&&T.__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=T&&T.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(xn,"__esModule",{value:!0});xn.PollingBlockTracker=void 0;const p1=vc(Ys),m1=vc(Vu),v1=xr,jo=Oa,Fo=(0,jo.createModuleLogger)(jo.projectLogger,"polling-block-tracker"),w1=(0,p1.default)(),y1=1e3;class b1 extends v1.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*y1,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:w1(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),Fo("Making request",e);const r=await(0,m1.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}}xn.PollingBlockTracker=b1;function Ho(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}var Un={},_1=T&&T.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.SubscribeBlockTracker=void 0;const E1=_1(Ys),S1=xr,M1=(0,E1.default)();class k1 extends S1.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:M1(),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=k1;(function(t){var e=T&&T.__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=T&&T.__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(xn,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 R1(){return Ls=(Ls+1)%wc,Ls}Fr.getUniqueId=R1;Object.defineProperty(Vn,"__esModule",{value:!0});Vn.createIdRemapMiddleware=void 0;const I1=Fr;function C1(){return(t,e,r,n)=>{const i=t.id,s=I1.getUniqueId();t.id=s,e.id=s,r(c=>{t.id=i,e.id=i,c()})}}Vn.createIdRemapMiddleware=C1;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});Wn.createAsyncMiddleware=void 0;function A1(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=A1;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});zn.createScaffoldMiddleware=void 0;function N1(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=N1;var Hr={},vi={};Object.defineProperty(vi,"__esModule",{value:!0});const L1=ta;function Uo(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function T1(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=T1(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 j1(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 x,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=(x=E)===null||x===void 0?void 0:x.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 F1=T&&T.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.JsonRpcEngine=void 0;const H1=F1(vi),st=yc;class _t extends H1.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-DrKwSPd8.js b/buddybook/assets/index-BN-E6inN.js similarity index 99% rename from buddybook/assets/index-DrKwSPd8.js rename to buddybook/assets/index-BN-E6inN.js index cc59387..92ca86f 100644 --- a/buddybook/assets/index-DrKwSPd8.js +++ b/buddybook/assets/index-BN-E6inN.js @@ -1 +1 @@ -import{d as M,g as sr,h as ir}from"./index-D4GNEarw.js";import{j as ar,s as or,r as _t,a as cr,b as dr}from"./hooks.module-Dd0QlYUx.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const lr=(r,e)=>{let t;switch(r){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=lr;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(r){Object.defineProperty(r,"__esModule",{value:!0}),r.serialize=r.getErrorCode=r.isValidCode=r.getMessageFromCode=r.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";r.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(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 r.JSON_RPC_SERVER_ERROR_MESSAGE}return p}r.getMessageFromCode=n;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}r.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}r.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=n(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}r.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:r=>C(v.standardErrorCodes.rpc.parse,r),invalidRequest:r=>C(v.standardErrorCodes.rpc.invalidRequest,r),invalidParams:r=>C(v.standardErrorCodes.rpc.invalidParams,r),methodNotFound:r=>C(v.standardErrorCodes.rpc.methodNotFound,r),internal:r=>C(v.standardErrorCodes.rpc.internal,r),server:r=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=r;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,r)},invalidInput:r=>C(v.standardErrorCodes.rpc.invalidInput,r),resourceNotFound:r=>C(v.standardErrorCodes.rpc.resourceNotFound,r),resourceUnavailable:r=>C(v.standardErrorCodes.rpc.resourceUnavailable,r),transactionRejected:r=>C(v.standardErrorCodes.rpc.transactionRejected,r),methodNotSupported:r=>C(v.standardErrorCodes.rpc.methodNotSupported,r),limitExceeded:r=>C(v.standardErrorCodes.rpc.limitExceeded,r)},provider:{userRejectedRequest:r=>$(v.standardErrorCodes.provider.userRejectedRequest,r),unauthorized:r=>$(v.standardErrorCodes.provider.unauthorized,r),unsupportedMethod:r=>$(v.standardErrorCodes.provider.unsupportedMethod,r),disconnected:r=>$(v.standardErrorCodes.provider.disconnected,r),chainDisconnected:r=>$(v.standardErrorCodes.provider.chainDisconnected,r),unsupportedChain:r=>$(v.standardErrorCodes.provider.unsupportedChain,r),custom:r=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:n}=r;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,n)}}};function C(r,e){const[t,n]=Ct(e);return new kt(r,t||(0,St.getMessageFromCode)(r),n)}function $(r,e){const[t,n]=Ct(e);return new It(r,t||(0,St.getMessageFromCode)(r),n)}function Ct(r){if(r){if(typeof r=="string")return[r];if(typeof r=="object"&&!Array.isArray(r)){const{message:e,data:t}=r;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,n){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,n!==void 0&&(this.data=n)}}class It extends kt{constructor(e,t,n){if(!ur(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function ur(r){return Number.isInteger(r)&&r>=1e3&&r<=4999}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.standardErrors=r.standardErrorCodes=void 0;var e=U;Object.defineProperty(r,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(r,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function hr(r){return r.errorMessage!==void 0}Q.isErrorResponse=hr;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 gr=Q,pr=K,fr=U,mr=$e;function br(r,e){const t=(0,mr.serialize)(yr(r),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",pr.LIB_VERSION),n.searchParams.set("code",t.code.toString());const s=wr(t.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}we.serializeError=br;function yr(r){return typeof r=="string"?{message:r,code:fr.standardErrorCodes.rpc.internal}:(0,gr.isErrorResponse)(r)?Object.assign(Object.assign({},r),{message:r.errorMessage,code:r.errorCode,data:{method:r.method}}):r}function wr(r,e){const t=r==null?void 0:r.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 re(){return r=>r}_.OpaqueType=re;_.HexString=re();_.AddressString=re();_.BigIntString=re();function vr(r){return Math.floor(r)}_.IntNumber=vr;_.RegExpString=re();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 _r(r){return At(crypto.getRandomValues(new Uint8Array(r)))}u.randomBytesHex=_r;function At(r){return[...r].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function Er(r){return new Uint8Array(r.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=Er;function Sr(r,e=!1){const t=r.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=Sr;function Cr(r){return(0,I.BigIntString)(r.toString(10))}u.bigIntStringFromBigInt=Cr;function kr(r){return(0,I.IntNumber)(Number(BigInt(se(r,!0))))}u.intNumberFromHexString=kr;function Ir(r){return(0,I.HexString)(`0x${BigInt(r).toString(16)}`)}u.hexStringFromIntNumber=Ir;function Fe(r){return r.startsWith("0x")||r.startsWith("0X")}u.has0xPrefix=Fe;function ve(r){return Fe(r)?r.slice(2):r}u.strip0x=ve;function Rt(r){return Fe(r)?`0x${r.slice(2)}`:`0x${r}`}u.prepend0x=Rt;function ne(r){if(typeof r!="string")return!1;const e=ve(r).toLowerCase();return Lt.test(e)}u.isHexString=ne;function xt(r,e=!1){if(typeof r=="string"){const t=ve(r).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(r)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(r,e=!1){let t=xt(r,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function Mr(r){if(typeof r=="string"){const e=ve(r).toLowerCase();if(ne(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(r)}`)}u.ensureAddressString=Mr;function Lr(r){if(Buffer.isBuffer(r))return r;if(typeof r=="string"){if(ne(r)){const e=se(r,!1);return Buffer.from(e,"hex")}return Buffer.from(r,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(r)}`)}u.ensureBuffer=Lr;function Pt(r){if(typeof r=="number"&&Number.isInteger(r))return(0,I.IntNumber)(r);if(typeof r=="string"){if(Mt.test(r))return(0,I.IntNumber)(Number(r));if(ne(r))return(0,I.IntNumber)(Number(BigInt(se(r,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(r)}`)}u.ensureIntNumber=Pt;function Ar(r){if(r instanceof RegExp)return(0,I.RegExpString)(r.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(r)}`)}u.ensureRegExpString=Ar;function Rr(r){if(r!==null&&(typeof r=="bigint"||Nt(r)))return BigInt(r.toString(10));if(typeof r=="number")return BigInt(Pt(r));if(typeof r=="string"){if(Mt.test(r))return BigInt(r);if(ne(r))return BigInt(se(r,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(r)}`)}u.ensureBigInt=Rr;function xr(r){if(typeof r=="string")return JSON.parse(r);if(typeof r=="object")return r;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(r)}`)}u.ensureParsedJSONObject=xr;function Nt(r){if(r==null||typeof r.constructor!="function")return!1;const{constructor:e}=r;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Pr(r,e){return Array.from({length:e-r},(t,n)=>r+n)}u.range=Pr;function Nr(){const r=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,n=r?r.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}//${t}${n}`}u.getFavicon=Nr;function Tr(r,e){return r.length===e.length&&r.every((t,n)=>t===e[n])}u.areAddressArraysEqual=Tr;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 jr(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=jr;async function Or(r,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Or;async function jt(r,e){const t=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},r,new TextEncoder().encode(e));return{iv:t,cipherText:n}}y.encrypt=jt;async function Ot(r,{iv:e,cipherText:t}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},r,t);return new TextDecoder().decode(n)}y.decrypt=Ot;function Dt(r){switch(r){case"public":return"spki";case"private":return"pkcs8"}}async function Dr(r,e){const t=Dt(r),n=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(n))}y.exportKeyToHexString=Dr;async function Wr(r,e){const t=Dt(r),n=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,n,{name:"ECDH",namedCurve:"P-256"},!0,r==="private"?["deriveKey"]:[])}y.importKeyFromHexString=Wr;async function Ur(r,e){const t=JSON.stringify(r,(n,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=Ur;async function Br(r,e){return JSON.parse(await Ot(e,r))}y.decryptContent=Br;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 n=0;nlocalStorage.removeItem(n))}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,Hr=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class Kr{constructor(){this.storage=new Hr.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 n=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}}Ee.SCWKeyManager=Kr;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const qr=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class $r{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new qr.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:(n=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return n?(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(Xe,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([n,s])=>({id:Number(n),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=$r;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const Fr=Ee,zr=Se,ce=j,rt=u,de=y;class Vr{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new Fr.SCWKeyManager,this.stateManager=new zr.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);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 n=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(n);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 n=e.params;if(!n||!(!((t=n[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,rt.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const n=this.stateManager.walletCapabilities;if(!n)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return n}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 n=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:n});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 n=await this.keyManager.getSharedSecret();if(!n)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,s;const i=(n=t.data)===null||n===void 0?void 0:n.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,rt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Vr;var Ce={};const Zr=ar;function Wt(r){return Buffer.allocUnsafe(r).fill(0)}function Gr(r){return r.toString(2).length}function Ut(r,e){let t=r.toString(16);t.length%2!==0&&(t="0"+t);const n=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;n.length"u")throw new Error("Not an array?");if(t=Ft(r),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],r=r.slice(0,r.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(r,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(r==="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(r.startsWith("bytes")){if(t=G(r),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(r.startsWith("uint")){if(t=G(r),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);n=H(e);const o=E.bitLengthFromBigInt(n);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(n,32)}else if(r.startsWith("int")){if(t=G(r),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);n=H(e);const o=E.bitLengthFromBigInt(n);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(n,256);return E.bufferBEFromBigInt(c,32)}else if(r.startsWith("ufixed")){if(t=nt(r),n=H(e),n<0)throw new Error("Supplied ufixed is negative");return R("uint256",n*BigInt(2)**BigInt(t[1]))}else if(r.startsWith("fixed"))return t=nt(r),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+r)}function tn(r){return r==="string"||r==="bytes"||Ft(r)==="dynamic"}function rn(r){return r.lastIndexOf("]")===r.length-1}function nn(r,e){var t=[],n=[],s=32*r.length;for(var i in r){var a=$t(r[i]),o=e[i],c=R(a,o);tn(a)?(t.push(R("uint256",s)),n.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(n))}function zt(r,e){if(r.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,n,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);n=H(o);const c=E.bitLengthFromBigInt(n);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(n,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);n=H(o);const c=E.bitLengthFromBigInt(n);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(n,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function sn(r,e){return E.keccak(zt(r,e))}var an={rawEncode:nn,solidityPack:zt,soliditySHA3:sn};const A=qt,ee=an,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(r,e,t,n=!0){const s=["bytes32"],i=[this.hashType(r,t)];if(n){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,n))];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[r]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[r]){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,n)),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(r,e){let t="",n=this.findTypeDependencies(r,e).filter(s=>s!==r);n=[r].concat(n.sort());for(const s of n){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(r,e,t=[]){if(r=r.match(/^\w*/)[0],t.includes(r)||e[r]===void 0)return t;t.push(r);for(const n of e[r])for(const s of this.findTypeDependencies(n.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(r,e,t,n=!0){return A.keccak(this.encodeData(r,e,t,n))},hashType(r,e){return A.keccak(this.encodeType(r,e))},sanitizeData(r){const e={};for(const t in Vt.properties)r[t]&&(e[t]=r[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(r,e=!0){const t=this.sanitizeData(r),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(n))}};var on={TYPED_MESSAGE_SCHEMA:Vt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(r){return cn(r.data)},hashForSignTypedData_v3:function(r){return Be.hash(r.data,!1)},hashForSignTypedData_v4:function(r){return Be.hash(r.data)}};function cn(r){const e=new Error("Expect argument to be non-empty array");if(typeof r!="object"||!r.length)throw e;const t=r.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),n=r.map(function(i){return i.type}),s=r.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(r.length).fill("string"),s),ee.soliditySHA3(n,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 dn=u;class ln{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,dn.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=ln;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class un{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const n=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:n},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([...n,...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((n,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;n(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=un;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class hn{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${n}`;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:n,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=hn;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(r){r[r.DISCONNECTED=0]="DISCONNECTED",r[r.CONNECTING=1]="CONNECTING",r[r.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class gn{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,t)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(n=this.connectionStateListener)===null||n===void 0||n.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=gn;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,pn=Le,fn=Ae,ue=Y,F=_,it=1e4,mn=6e4;class bn{constructor({session:e,linkAPIUrl:t,listener:n,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 pn.WalletLinkCipher(e.secret),this.listener=n;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 fn.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,n;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if(!(e.type!=="Event"||e.event!=="Web3Response")){const n=await this.cipher.decrypt(e.data),s=JSON.parse(n);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 n={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,n=!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:n};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=mn){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(n,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(n)})})])}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=bn;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const yn=or,at=u,ot="session:id",ct="session:secret",dt="session:linked";class ze{constructor(e,t,n,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=n||(0,at.randomBytesHex)(32),this._key=new yn.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),n=e.getItem(dt),s=e.getItem(ct);return t&&s?new ze(e,t,s,n==="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 wn(r,e,t,n,s,i){const a=n?"parent-id":"id",o=new URLSearchParams({[a]:r,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=wn;function vn(){try{return window.frameElement!==null}catch{return!1}}function _n(){try{return vn()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=_n;function En(){var r;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((r=window==null?void 0:window.navigator)===null||r===void 0?void 0:r.userAgent)}S.isMobileWeb=En;function Sn(){var r,e;return(e=(r=window==null?void 0:window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=Sn;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 Cn=M&&M.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const kn=Cn(Ve);function In(){const r=document.createElement("style");r.type="text/css",r.appendChild(document.createTextNode(kn.default)),document.documentElement.appendChild(r)}ae.injectCssReset=In;var Ze={};function Zt(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r))for(e=0;e{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)(r.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,n.h)(r.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}r.Snackbar=l;const h=d=>(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,a.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},d.children));r.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,tr]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{tr(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const rr=()=>{Je(!Oe)};return(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:rr},(0,n.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,n.h)("div",{class:"-gear-container"},!Oe&&(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:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,nr)=>(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:nr},(0,n.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};r.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Ln=ae,An=Ze;class Rn{constructor(){this.attached=!1,this.snackbar=new An.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,Ln.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=Rn;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(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const xn=Yt(Gt),x=_t,Pn=ae,Nn=Ze,Tn=S,jn=Yt(Ye);class On{constructor(){this.root=null,this.darkMode=(0,Tn.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Pn.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)(Dn,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=On;const Dn=({title:r,buttonText:e,darkMode:t,onButtonClick:n,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Nn.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,jn.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,xn.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,r),(0,x.h)("button",{onClick:n},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 Wn=Ne,Un=S,Bn=T;class Hn{constructor(){this.attached=!1,this.redirectDialog=new Wn.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(Bn.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Un.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Hn;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Kn=Me,qn=N,$n=ie,He=Re,z=Q,Fn=S,zn=xe,ut=Pe,Vn=j,b=u,Zn=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Fn.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(qn.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:n,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new $n.RelayEventManager,this.ui=n}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Kn.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new ut.WLMobileRelayUI:new zn.WalletLinkRelayUI;return n.connect(),{session:e,ui:s,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();const e=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Zn.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:n}})}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 n=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,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(n,o=>{if(t==null||t(),(0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(n,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.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,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(n=>this.invokeCallback(Object.assign(Object.assign({},e),{id:n}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,n){var s;const i=(s=n==null?void 0:n.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((n,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,z.isErrorResponse)(i))return s(new Error(i.errorMessage));n(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,n,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,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,n,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:n,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 n={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(Vn.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,n)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Gn=M&&M.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Gn(on),ht=N,Yn=ie,D=Q,Jn=Ie,gt=T,w=j,g=u,Qn=O,qe="DefaultChainId",pt="DefaultJsonRpcUrl";class Xn{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Qn.ScopedLocalStorage("walletlink",gt.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Yn.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)&&((n=this.updateListener)===null||n===void 0||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(pt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(pt,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((n=this.updateListener)===null||n===void 0||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,n,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,n,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,n,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 n=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const s=n.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:n}=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(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=n===void 0?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var n;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,(n=this.updateListener)===null||n===void 0||n.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ht.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,n)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return n(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>n(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,n=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n);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 n=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:n,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,n,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,n,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,n){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,n);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]),n=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!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(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}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(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),n=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),n=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),n=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,n,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,(n=a.rpcUrls)!==null&&n!==void 0?n:[],(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 n=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,n)}}initializeRelay(){if(!this._relay){const e=new Jn.WalletLinkRelay({linkAPIUrl:gt.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,n)=>this._setAddresses(t,n)),e.setChainCallback((t,n)=>{this.updateProviderInfo(n,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Xn;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(r,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},r),{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 rs(){return globalThis.coinbaseWalletExtension}function ns(){var r,e;try{const t=globalThis;return(r=t.ethereum)!==null&&r!==void 0?r:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function ss({metadata:r,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Jt())return;const i=rs();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=r;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const n=ns();if(n!=null&&n.isCoinbaseBrowser)return n}k.getCoinbaseInjectedProvider=ss;function is(r){if(!r||typeof r!="object"||Array.isArray(r))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:r});const{method:e,params:t}=r;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:r});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:r})}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",er=new ds.ScopedLocalStorage("CBWSDK","SignerConfigurator");function ls(){return er.getItem(Xt)}P.loadSignerType=ls;function us(r){er.setItem(Xt,r)}P.storeSignerType=us;async function hs(r){const{communicator:e,metadata:t}=r;ps(e,t).catch(()=>{});const n={id:crypto.randomUUID(),event:"selectSignerType",data:r.preference},{data:s}=await e.postRequestAndWaitForResponse(n);return s}P.fetchSignerType=hs;function gs(r){const{signerType:e,metadata:t,communicator:n,updateListener:s}=r;switch(e){case"scw":return new as.SCWSigner({metadata:t,updateListener:s,communicator:n});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(r,e){await r.onMessage(({event:n})=>n==="WalletLinkSessionRequest");const t=new Qt.WalletLinkSigner({metadata:e});r.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),r.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(r){const e=(window.innerWidth-ft)/2+window.screenX,t=(window.innerHeight-mt)/2+window.screenY,n=window.open(r,"Smart Wallet",`width=${ft}, height=${mt}, left=${e}, top=${t}`);if(n==null||n.focus(),!n)throw fs.standardErrors.rpc.internal("Pop up window failed to open");return n}J.openPopup=ms;function bs(r){r&&!r.closed&&r.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 n=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await n},this.onMessage=async t=>new Promise((n,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(n(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},n)=>{t(yt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",n)}),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(r){for(const e in wt){const t=e;if(wt[t].includes(r))return t}}je.determineMethodCategory=_s;var Es=M&&M.__rest||function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);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:(n=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n: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 n=(0,vt.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const s=(t=(0,Ms.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(n){return Promise.reject((0,ks.serializeError)(n,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 n={metadata:this.metadata,preference:e};return(t=(0,js.getCoinbaseInjectedProvider)(n))!==null&&t!==void 0?t:new xs.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,Rs.walletLogo)(e,t)}storeLatestVersion(){new Ps.ScopedLocalStorage("CBWSDK").setItem("VERSION",Ns.LIB_VERSION)}}te.CoinbaseWalletSDK=Os;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.CoinbaseWalletSDK=void 0;const e=te;r.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(r,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ds=ir(Et),Bs=Object.freeze(Object.defineProperty({__proto__:null,default:Ds},Symbol.toStringTag,{value:"Module"}));export{Bs as i}; +import{d as M,g as sr,h as ir}from"./index-BhXuIR47.js";import{j as ar,s as or,r as _t,a as cr,b as dr}from"./hooks.module-LlNaOzAU.js";var Et={},te={},me={};Object.defineProperty(me,"__esModule",{value:!0});me.walletLogo=void 0;const lr=(r,e)=>{let t;switch(r){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=lr;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(r){Object.defineProperty(r,"__esModule",{value:!0}),r.serialize=r.getErrorCode=r.isValidCode=r.getMessageFromCode=r.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=U,t="Unspecified error message.";r.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(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 r.JSON_RPC_SERVER_ERROR_MESSAGE}return p}r.getMessageFromCode=n;function s(d){if(!Number.isInteger(d))return!1;const p=d.toString();return!!(e.errorValues[p]||c(d))}r.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}r.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=n(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}r.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:r=>C(v.standardErrorCodes.rpc.parse,r),invalidRequest:r=>C(v.standardErrorCodes.rpc.invalidRequest,r),invalidParams:r=>C(v.standardErrorCodes.rpc.invalidParams,r),methodNotFound:r=>C(v.standardErrorCodes.rpc.methodNotFound,r),internal:r=>C(v.standardErrorCodes.rpc.internal,r),server:r=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=r;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return C(e,r)},invalidInput:r=>C(v.standardErrorCodes.rpc.invalidInput,r),resourceNotFound:r=>C(v.standardErrorCodes.rpc.resourceNotFound,r),resourceUnavailable:r=>C(v.standardErrorCodes.rpc.resourceUnavailable,r),transactionRejected:r=>C(v.standardErrorCodes.rpc.transactionRejected,r),methodNotSupported:r=>C(v.standardErrorCodes.rpc.methodNotSupported,r),limitExceeded:r=>C(v.standardErrorCodes.rpc.limitExceeded,r)},provider:{userRejectedRequest:r=>$(v.standardErrorCodes.provider.userRejectedRequest,r),unauthorized:r=>$(v.standardErrorCodes.provider.unauthorized,r),unsupportedMethod:r=>$(v.standardErrorCodes.provider.unsupportedMethod,r),disconnected:r=>$(v.standardErrorCodes.provider.disconnected,r),chainDisconnected:r=>$(v.standardErrorCodes.provider.chainDisconnected,r),unsupportedChain:r=>$(v.standardErrorCodes.provider.unsupportedChain,r),custom:r=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:n}=r;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new It(e,t,n)}}};function C(r,e){const[t,n]=Ct(e);return new kt(r,t||(0,St.getMessageFromCode)(r),n)}function $(r,e){const[t,n]=Ct(e);return new It(r,t||(0,St.getMessageFromCode)(r),n)}function Ct(r){if(r){if(typeof r=="string")return[r];if(typeof r=="object"&&!Array.isArray(r)){const{message:e,data:t}=r;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,n){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,n!==void 0&&(this.data=n)}}class It extends kt{constructor(e,t,n){if(!ur(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,n)}}function ur(r){return Number.isInteger(r)&&r>=1e3&&r<=4999}(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.standardErrors=r.standardErrorCodes=void 0;var e=U;Object.defineProperty(r,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=ye;Object.defineProperty(r,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(j);var we={},Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.isErrorResponse=void 0;function hr(r){return r.errorMessage!==void 0}Q.isErrorResponse=hr;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 gr=Q,pr=K,fr=U,mr=$e;function br(r,e){const t=(0,mr.serialize)(yr(r),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",pr.LIB_VERSION),n.searchParams.set("code",t.code.toString());const s=wr(t.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:n.href})}we.serializeError=br;function yr(r){return typeof r=="string"?{message:r,code:fr.standardErrorCodes.rpc.internal}:(0,gr.isErrorResponse)(r)?Object.assign(Object.assign({},r),{message:r.errorMessage,code:r.errorCode,data:{method:r.method}}):r}function wr(r,e){const t=r==null?void 0:r.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 re(){return r=>r}_.OpaqueType=re;_.HexString=re();_.AddressString=re();_.BigIntString=re();function vr(r){return Math.floor(r)}_.IntNumber=vr;_.RegExpString=re();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 _r(r){return At(crypto.getRandomValues(new Uint8Array(r)))}u.randomBytesHex=_r;function At(r){return[...r].map(e=>e.toString(16).padStart(2,"0")).join("")}u.uint8ArrayToHex=At;function Er(r){return new Uint8Array(r.match(/.{1,2}/g).map(e=>parseInt(e,16)))}u.hexStringToUint8Array=Er;function Sr(r,e=!1){const t=r.toString("hex");return(0,I.HexString)(e?`0x${t}`:t)}u.hexStringFromBuffer=Sr;function Cr(r){return(0,I.BigIntString)(r.toString(10))}u.bigIntStringFromBigInt=Cr;function kr(r){return(0,I.IntNumber)(Number(BigInt(se(r,!0))))}u.intNumberFromHexString=kr;function Ir(r){return(0,I.HexString)(`0x${BigInt(r).toString(16)}`)}u.hexStringFromIntNumber=Ir;function Fe(r){return r.startsWith("0x")||r.startsWith("0X")}u.has0xPrefix=Fe;function ve(r){return Fe(r)?r.slice(2):r}u.strip0x=ve;function Rt(r){return Fe(r)?`0x${r.slice(2)}`:`0x${r}`}u.prepend0x=Rt;function ne(r){if(typeof r!="string")return!1;const e=ve(r).toLowerCase();return Lt.test(e)}u.isHexString=ne;function xt(r,e=!1){if(typeof r=="string"){const t=ve(r).toLowerCase();if(Lt.test(t))return(0,I.HexString)(e?`0x${t}`:t)}throw q.standardErrors.rpc.invalidParams(`"${String(r)}" is not a hexadecimal string`)}u.ensureHexString=xt;function se(r,e=!1){let t=xt(r,!1);return t.length%2===1&&(t=(0,I.HexString)(`0${t}`)),e?(0,I.HexString)(`0x${t}`):t}u.ensureEvenLengthHexString=se;function Mr(r){if(typeof r=="string"){const e=ve(r).toLowerCase();if(ne(e)&&e.length===40)return(0,I.AddressString)(Rt(e))}throw q.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(r)}`)}u.ensureAddressString=Mr;function Lr(r){if(Buffer.isBuffer(r))return r;if(typeof r=="string"){if(ne(r)){const e=se(r,!1);return Buffer.from(e,"hex")}return Buffer.from(r,"utf8")}throw q.standardErrors.rpc.invalidParams(`Not binary data: ${String(r)}`)}u.ensureBuffer=Lr;function Pt(r){if(typeof r=="number"&&Number.isInteger(r))return(0,I.IntNumber)(r);if(typeof r=="string"){if(Mt.test(r))return(0,I.IntNumber)(Number(r));if(ne(r))return(0,I.IntNumber)(Number(BigInt(se(r,!0))))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(r)}`)}u.ensureIntNumber=Pt;function Ar(r){if(r instanceof RegExp)return(0,I.RegExpString)(r.toString());throw q.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(r)}`)}u.ensureRegExpString=Ar;function Rr(r){if(r!==null&&(typeof r=="bigint"||Nt(r)))return BigInt(r.toString(10));if(typeof r=="number")return BigInt(Pt(r));if(typeof r=="string"){if(Mt.test(r))return BigInt(r);if(ne(r))return BigInt(se(r,!0))}throw q.standardErrors.rpc.invalidParams(`Not an integer: ${String(r)}`)}u.ensureBigInt=Rr;function xr(r){if(typeof r=="string")return JSON.parse(r);if(typeof r=="object")return r;throw q.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(r)}`)}u.ensureParsedJSONObject=xr;function Nt(r){if(r==null||typeof r.constructor!="function")return!1;const{constructor:e}=r;return typeof e.config=="function"&&typeof e.EUCLID=="number"}u.isBigNumber=Nt;function Pr(r,e){return Array.from({length:e-r},(t,n)=>r+n)}u.range=Pr;function Nr(){const r=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,n=r?r.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}//${t}${n}`}u.getFavicon=Nr;function Tr(r,e){return r.length===e.length&&r.every((t,n)=>t===e[n])}u.areAddressArraysEqual=Tr;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 jr(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}y.generateKeyPair=jr;async function Or(r,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},r,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}y.deriveSharedSecret=Or;async function jt(r,e){const t=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},r,new TextEncoder().encode(e));return{iv:t,cipherText:n}}y.encrypt=jt;async function Ot(r,{iv:e,cipherText:t}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},r,t);return new TextDecoder().decode(n)}y.decrypt=Ot;function Dt(r){switch(r){case"public":return"spki";case"private":return"pkcs8"}}async function Dr(r,e){const t=Dt(r),n=await crypto.subtle.exportKey(t,e);return(0,Tt.uint8ArrayToHex)(new Uint8Array(n))}y.exportKeyToHexString=Dr;async function Wr(r,e){const t=Dt(r),n=(0,Tt.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,n,{name:"ECDH",namedCurve:"P-256"},!0,r==="private"?["deriveKey"]:[])}y.importKeyFromHexString=Wr;async function Ur(r,e){const t=JSON.stringify(r,(n,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=Ur;async function Br(r,e){return JSON.parse(await Ot(e,r))}y.decryptContent=Br;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 n=0;nlocalStorage.removeItem(n))}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,Hr=O,De={storageKey:"ownPrivateKey",keyType:"private"},We={storageKey:"ownPublicKey",keyType:"public"},Ue={storageKey:"peerPublicKey",keyType:"public"};class Kr{constructor(){this.storage=new Hr.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 n=await(0,oe.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,n)}}Ee.SCWKeyManager=Kr;var Se={};Object.defineProperty(Se,"__esModule",{value:!0});Se.SCWStateManager=void 0;const qr=O,Qe="accounts",Xe="activeChain",et="availableChains",tt="walletCapabilities";class $r{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,n;this.storage=new qr.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:(n=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(Qe,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const n=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return n?(n===this._activeChain||(this._activeChain=n,this.storeItemToStorage(Xe,n),this.updateListener.onChainUpdate({chain:n,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([n,s])=>({id:Number(n),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=$r;Object.defineProperty(_e,"__esModule",{value:!0});_e.SCWSigner=void 0;const Fr=Ee,zr=Se,ce=j,rt=u,de=y;class Vr{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new Fr.SCWKeyManager,this.stateManager=new zr.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const n=await(0,de.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(n);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 n=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(n);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 n=e.params;if(!n||!(!((t=n[0])===null||t===void 0)&&t.chainId))throw ce.standardErrors.rpc.invalidParams();const s=(0,rt.ensureIntNumber)(n[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const n=this.stateManager.walletCapabilities;if(!n)throw ce.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return n}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 n=await(0,de.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:n});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 n=await this.keyManager.getSharedSecret();if(!n)throw ce.standardErrors.provider.unauthorized("Invalid session");return(0,de.decryptContent)(t.encrypted,n)}updateInternalState(e,t){var n,s;const i=(n=t.data)===null||n===void 0?void 0:n.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,rt.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(l);break}}}}_e.SCWSigner=Vr;var Ce={};const Zr=ar;function Wt(r){return Buffer.allocUnsafe(r).fill(0)}function Gr(r){return r.toString(2).length}function Ut(r,e){let t=r.toString(16);t.length%2!==0&&(t="0"+t);const n=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;n.length"u")throw new Error("Not an array?");if(t=Ft(r),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],r=r.slice(0,r.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(R(r,e[i]));if(t==="dynamic"){var a=R("uint256",e.length);s.unshift(a)}return Buffer.concat(s)}else{if(r==="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(r.startsWith("bytes")){if(t=G(r),t<1||t>32)throw new Error("Invalid bytes width: "+t);return E.setLengthRight(e,32)}else if(r.startsWith("uint")){if(t=G(r),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);n=H(e);const o=E.bitLengthFromBigInt(n);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return E.bufferBEFromBigInt(n,32)}else if(r.startsWith("int")){if(t=G(r),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);n=H(e);const o=E.bitLengthFromBigInt(n);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=E.twosFromBigInt(n,256);return E.bufferBEFromBigInt(c,32)}else if(r.startsWith("ufixed")){if(t=nt(r),n=H(e),n<0)throw new Error("Supplied ufixed is negative");return R("uint256",n*BigInt(2)**BigInt(t[1]))}else if(r.startsWith("fixed"))return t=nt(r),R("int256",H(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+r)}function tn(r){return r==="string"||r==="bytes"||Ft(r)==="dynamic"}function rn(r){return r.lastIndexOf("]")===r.length-1}function nn(r,e){var t=[],n=[],s=32*r.length;for(var i in r){var a=$t(r[i]),o=e[i],c=R(a,o);tn(a)?(t.push(R("uint256",s)),n.push(c),s+=c.length):t.push(c)}return Buffer.concat(t.concat(n))}function zt(r,e){if(r.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,n,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);n=H(o);const c=E.bitLengthFromBigInt(n);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(E.bufferBEFromBigInt(n,t/8))}else if(a.startsWith("int")){if(t=G(a),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);n=H(o);const c=E.bitLengthFromBigInt(n);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const l=E.twosFromBigInt(n,t);s.push(E.bufferBEFromBigInt(l,t/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(s)}function sn(r,e){return E.keccak(zt(r,e))}var an={rawEncode:nn,solidityPack:zt,soliditySHA3:sn};const A=qt,ee=an,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(r,e,t,n=!0){const s=["bytes32"],i=[this.hashType(r,t)];if(n){const a=(o,c,l)=>{if(t[c]!==void 0)return["bytes32",l==null?"0x0000000000000000000000000000000000000000000000000000000000000000":A.keccak(this.encodeData(c,l,t,n))];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[r]){const[c,l]=a(o.name,o.type,e[o.name]);s.push(c),i.push(l)}}else for(const a of t[r]){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,n)),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(r,e){let t="",n=this.findTypeDependencies(r,e).filter(s=>s!==r);n=[r].concat(n.sort());for(const s of n){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(r,e,t=[]){if(r=r.match(/^\w*/)[0],t.includes(r)||e[r]===void 0)return t;t.push(r);for(const n of e[r])for(const s of this.findTypeDependencies(n.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(r,e,t,n=!0){return A.keccak(this.encodeData(r,e,t,n))},hashType(r,e){return A.keccak(this.encodeType(r,e))},sanitizeData(r){const e={};for(const t in Vt.properties)r[t]&&(e[t]=r[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(r,e=!0){const t=this.sanitizeData(r),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(t.primaryType,t.message,t.types,e)),A.keccak(Buffer.concat(n))}};var on={TYPED_MESSAGE_SCHEMA:Vt,TypedDataUtils:Be,hashForSignTypedDataLegacy:function(r){return cn(r.data)},hashForSignTypedData_v3:function(r){return Be.hash(r.data,!1)},hashForSignTypedData_v4:function(r){return Be.hash(r.data)}};function cn(r){const e=new Error("Expect argument to be non-empty array");if(typeof r!="object"||!r.length)throw e;const t=r.map(function(i){return i.type==="bytes"?A.toBuffer(i.value):i.value}),n=r.map(function(i){return i.type}),s=r.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return ee.soliditySHA3(["bytes32","bytes32"],[ee.soliditySHA3(new Array(r.length).fill("string"),s),ee.soliditySHA3(n,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 dn=u;class ln{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,dn.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ie.RelayEventManager=ln;var Ie={},Me={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.WalletLinkCipher=void 0;const le=u;class un{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const n=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:n},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([...n,...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((n,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;n(p.decode(d))}catch(d){s(d)}})()})}}Le.WalletLinkCipher=un;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.WalletLinkHTTP=void 0;class hn{constructor(e,t,n){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${n}`;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:n,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${t.status}`)}}Ae.WalletLinkHTTP=hn;var Y={};Object.defineProperty(Y,"__esModule",{value:!0});Y.WalletLinkWebSocket=Y.ConnectionState=void 0;var Z;(function(r){r[r.DISCONNECTED=0]="DISCONNECTED",r[r.CONNECTING=1]="CONNECTING",r[r.CONNECTED=2]="CONNECTED"})(Z||(Y.ConnectionState=Z={}));class gn{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,t)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){t(i);return}(n=this.connectionStateListener)===null||n===void 0||n.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=gn;Object.defineProperty(Me,"__esModule",{value:!0});Me.WalletLinkConnection=void 0;const st=N,pn=Le,fn=Ae,ue=Y,F=_,it=1e4,mn=6e4;class bn{constructor({session:e,linkAPIUrl:t,listener:n,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 pn.WalletLinkCipher(e.secret),this.listener=n;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 fn.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,n;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if(!(e.type!=="Event"||e.event!=="Web3Response")){const n=await this.cipher.decrypt(e.data),s=JSON.parse(n);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 n={type:"SetSessionConfig",id:(0,F.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,n=!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:n};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=mn){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,a)=>{s=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},t)}),new Promise(i=>{this.requestResolutions.set(n,a=>{clearTimeout(s),i(a),this.requestResolutions.delete(n)})})])}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=bn;var Re={};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSession=void 0;const yn=or,at=u,ot="session:id",ct="session:secret",dt="session:linked";class ze{constructor(e,t,n,s){this._storage=e,this._id=t||(0,at.randomBytesHex)(16),this._secret=n||(0,at.randomBytesHex)(32),this._key=new yn.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ot),n=e.getItem(dt),s=e.getItem(ct);return t&&s?new ze(e,t,s,n==="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 wn(r,e,t,n,s,i){const a=n?"parent-id":"id",o=new URLSearchParams({[a]:r,secret:e,server:t,v:s,chainId:i.toString()}).toString();return`${t}/#/link?${o}`}S.createQrUrl=wn;function vn(){try{return window.frameElement!==null}catch{return!1}}function _n(){try{return vn()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=_n;function En(){var r;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((r=window==null?void 0:window.navigator)===null||r===void 0?void 0:r.userAgent)}S.isMobileWeb=En;function Sn(){var r,e;return(e=(r=window==null?void 0:window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}S.isDarkMode=Sn;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 Cn=M&&M.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ae,"__esModule",{value:!0});ae.injectCssReset=void 0;const kn=Cn(Ve);function In(){const r=document.createElement("style");r.type="text/css",r.appendChild(document.createTextNode(kn.default)),document.documentElement.appendChild(r)}ae.injectCssReset=In;var Ze={};function Zt(r){var e,t,n="";if(typeof r=="string"||typeof r=="number")n+=r;else if(typeof r=="object")if(Array.isArray(r))for(e=0;e{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)(r.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,m])=>(0,n.h)(r.SnackbarInstance,Object.assign({},m,{key:p}))))),this.root)}}r.Snackbar=l;const h=d=>(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,a.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},d.children));r.SnackbarContainer=h;const f=({autoExpand:d,message:p,menuItems:m})=>{const[B,tr]=(0,s.useState)(!0),[Oe,Je]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const L=[window.setTimeout(()=>{tr(!1)},1),window.setTimeout(()=>{Je(!0)},1e4)];return()=>{L.forEach(window.clearTimeout)}});const rr=()=>{Je(!Oe)};return(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",B&&"-cbwsdk-snackbar-instance-hidden",Oe&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:rr},(0,n.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,n.h)("div",{class:"-gear-container"},!Oe&&(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:c,class:"-gear-icon",title:"Expand"}))),m&&m.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},m.map((L,nr)=>(0,n.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:L.onClick,key:nr},(0,n.h)("svg",{width:L.svgWidth,height:L.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":L.defaultFillRule,"clip-rule":L.defaultClipRule,d:L.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",L.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},L.info)))))};r.SnackbarInstance=f})(Ze);Object.defineProperty(xe,"__esModule",{value:!0});xe.WalletLinkRelayUI=void 0;const Ln=ae,An=Ze;class Rn{constructor(){this.attached=!1,this.snackbar=new An.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,Ln.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=Rn;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(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.RedirectDialog=void 0;const xn=Yt(Gt),x=_t,Pn=ae,Nn=Ze,Tn=S,jn=Yt(Ye);class On{constructor(){this.root=null,this.darkMode=(0,Tn.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Pn.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)(Dn,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ne.RedirectDialog=On;const Dn=({title:r,buttonText:e,darkMode:t,onButtonClick:n,onDismiss:s})=>{const i=t?"dark":"light";return(0,x.h)(Nn.SnackbarContainer,{darkMode:t},(0,x.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,x.h)("style",null,jn.default),(0,x.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,x.h)("div",{class:(0,xn.default)("-cbwsdk-redirect-dialog-box",i)},(0,x.h)("p",null,r),(0,x.h)("button",{onClick:n},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 Wn=Ne,Un=S,Bn=T;class Hn{constructor(){this.attached=!1,this.redirectDialog=new Wn.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(Bn.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Un.getLocation)().href),e&&t.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=t.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}Pe.WLMobileRelayUI=Hn;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.WalletLinkRelay=void 0;const Kn=Me,qn=N,$n=ie,He=Re,z=Q,Fn=S,zn=xe,ut=Pe,Vn=j,b=u,Zn=O;class W{constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,Fn.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=i=>{this.isLinked=i;const a=this.storage.getItem(qn.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:n,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new $n.RelayEventManager,this.ui=n}subscribe(){const e=He.WalletLinkSession.load(this.storage)||new He.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,n=new Kn.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new ut.WLMobileRelayUI:new zn.WalletLinkRelayUI;return n.connect(),{session:e,ui:s,connection:n}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();const e=He.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&Zn.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,n,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),address:t,addPrefix:n,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,b.hexStringFromBuffer)(e,!0),signature:(0,b.hexStringFromBuffer)(t,!0),addPrefix:n}})}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 n=(0,b.randomBytesHex)(8),s=i=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,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(n,o=>{if(t==null||t(),(0,z.isErrorResponse)(o))return a(new Error(o.errorMessage));i(o)}),this.publishWeb3RequestEvent(n,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const n={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",n,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n.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,n){return this.connection.publishEvent(e,t,n)}handleWeb3ResponseMessage(e){const{response:t}=e;if(t.method==="requestEthereumAccounts"){W.accountRequestCallbackIds.forEach(n=>this.invokeCallback(Object.assign(Object.assign({},e),{id:n}))),W.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,n){var s;const i=(s=n==null?void 0:n.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((n,s)=>{this.relayEventManager.callbacks.set(t,i=>{if((0,z.isErrorResponse)(i))return s(new Error(i.errorMessage));n(i)}),W.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,n,s,i,a){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:n,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,n,s,i,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:i,iconUrls:n,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 n={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(Vn.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,n)})}}Ie.WalletLinkRelay=W;W.accountRequestCallbackIds=new Set;var Gn=M&&M.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.WalletLinkSigner=void 0;const Ke=Gn(on),ht=N,Yn=ie,D=Q,Jn=Ie,gt=T,w=j,g=u,Qn=O,qe="DefaultChainId",pt="DefaultJsonRpcUrl";class Xn{constructor(e){var t,n;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:i}=e.metadata;this._appName=s,this._appLogoUrl=i,this._storage=new Qn.ScopedLocalStorage("walletlink",gt.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Yn.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)&&((n=this.updateListener)===null||n===void 0||n.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:n}=e.getWalletLinkSession();return{id:t,secret:n}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(pt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(pt,e)}updateProviderInfo(e,t){var n;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(qe,t.toString(10)),((0,g.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((n=this.updateListener)===null||n===void 0||n.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,n,s,i,a){const c=await this.initializeRelay().watchAsset(e,t,n,s,i,a==null?void 0:a.toString());return(0,D.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,n,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,n,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 n=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,D.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===w.standardErrorCodes.provider.unsupportedChain?w.standardErrors.provider.unsupportedChain():w.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const s=n.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:n}=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(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw w.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=n===void 0?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:i})).result}_setAddresses(e,t){var n;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,(n=this.updateListener)===null||n===void 0||n.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(ht.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,n)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return n(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>n(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,n=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n);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 n=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:n,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,n,s){this._ensureKnownAddress(t);try{const a=await this.initializeRelay().signEthereumMessage(e,t,n,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,n){const i=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,n);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]),n=(0,g.ensureBuffer)(e[1]);return this._signEthereumMessage(n,t,!1)}_eth_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureAddressString)(e[1]);return this._signEthereumMessage(t,n,!0)}_personal_ecRecover(e){const t=(0,g.ensureBuffer)(e[0]),n=(0,g.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,n,!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(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}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(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?w.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,g.ensureParsedJSONObject)(e[0]),n=(0,g.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const s=Ke.default.hashForSignTypedDataLegacy({data:t}),i=JSON.stringify(t,null,2);return this._signEthereumMessage(s,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),n=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,t,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,g.ensureAddressString)(e[0]),n=(0,g.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=Ke.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,t,!1,i)}async _wallet_addEthereumChain(e){var t,n,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,(n=a.rpcUrls)!==null&&n!==void 0?n:[],(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 n=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,n)}}initializeRelay(){if(!this._relay){const e=new Jn.WalletLinkRelay({linkAPIUrl:gt.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,n)=>this._setAddresses(t,n)),e.setChainCallback((t,n)=>{this.updateProviderInfo(n,parseInt(t,10))}),this._relay=e}return this._relay}}Ce.WalletLinkSigner=Xn;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(r,e){if(!e.rpcUrl)throw pe.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},r),{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 rs(){return globalThis.coinbaseWalletExtension}function ns(){var r,e;try{const t=globalThis;return(r=t.ethereum)!==null&&r!==void 0?r:(e=t.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function ss({metadata:r,preference:e}){var t;if(e.options!=="smartWalletOnly"){if(Jt())return;const i=rs();if(i){const{appName:a,appLogoUrl:o,appChainIds:c}=r;return(t=i.setAppInfo)===null||t===void 0||t.call(i,a,o,c),i}}const n=ns();if(n!=null&&n.isCoinbaseBrowser)return n}k.getCoinbaseInjectedProvider=ss;function is(r){if(!r||typeof r!="object"||Array.isArray(r))return pe.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:r});const{method:e,params:t}=r;if(typeof e!="string"||e.length===0)return pe.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:r});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:r})}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",er=new ds.ScopedLocalStorage("CBWSDK","SignerConfigurator");function ls(){return er.getItem(Xt)}P.loadSignerType=ls;function us(r){er.setItem(Xt,r)}P.storeSignerType=us;async function hs(r){const{communicator:e,metadata:t}=r;ps(e,t).catch(()=>{});const n={id:crypto.randomUUID(),event:"selectSignerType",data:r.preference},{data:s}=await e.postRequestAndWaitForResponse(n);return s}P.fetchSignerType=hs;function gs(r){const{signerType:e,metadata:t,communicator:n,updateListener:s}=r;switch(e){case"scw":return new as.SCWSigner({metadata:t,updateListener:s,communicator:n});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(r,e){await r.onMessage(({event:n})=>n==="WalletLinkSessionRequest");const t=new Qt.WalletLinkSigner({metadata:e});r.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),r.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(r){const e=(window.innerWidth-ft)/2+window.screenX,t=(window.innerHeight-mt)/2+window.screenY,n=window.open(r,"Smart Wallet",`width=${ft}, height=${mt}, left=${e}, top=${t}`);if(n==null||n.focus(),!n)throw fs.standardErrors.rpc.internal("Pop up window failed to open");return n}J.openPopup=ms;function bs(r){r&&!r.closed&&r.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 n=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await n},this.onMessage=async t=>new Promise((n,s)=>{const i=a=>{if(a.origin!==this.url.origin)return;const o=a.data;t(o)&&(n(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},n)=>{t(yt.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",n)}),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(r){for(const e in wt){const t=e;if(wt[t].includes(r))return t}}je.determineMethodCategory=_s;var Es=M&&M.__rest||function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(r);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:(n=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&n!==void 0?n: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 n=(0,vt.checkErrorForInvalidRequestArgs)(e);if(n)throw n;const s=(t=(0,Ms.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(n){return Promise.reject((0,ks.serializeError)(n,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 n={metadata:this.metadata,preference:e};return(t=(0,js.getCoinbaseInjectedProvider)(n))!==null&&t!==void 0?t:new xs.CoinbaseWalletProvider(n)}getCoinbaseWalletLogo(e,t=240){return(0,Rs.walletLogo)(e,t)}storeLatestVersion(){new Ps.ScopedLocalStorage("CBWSDK").setItem("VERSION",Ns.LIB_VERSION)}}te.CoinbaseWalletSDK=Os;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.CoinbaseWalletSDK=void 0;const e=te;r.default=e.CoinbaseWalletSDK;var t=te;Object.defineProperty(r,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Et);const Ds=ir(Et),Bs=Object.freeze(Object.defineProperty({__proto__:null,default:Ds},Symbol.toStringTag,{value:"Module"}));export{Bs as i}; diff --git a/buddybook/assets/index-D4GNEarw.js b/buddybook/assets/index-BhXuIR47.js similarity index 99% rename from buddybook/assets/index-D4GNEarw.js rename to buddybook/assets/index-BhXuIR47.js index 20d8968..3dd4b42 100644 --- a/buddybook/assets/index-D4GNEarw.js +++ b/buddybook/assets/index-BhXuIR47.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DrKwSPd8.js","assets/hooks.module-Dd0QlYUx.js","assets/events-CXYVpbcl.js","assets/inherits_browser-Cg-Az14D.js","assets/index-CT_b5y6n.js","assets/index-DY_rTz6S.js","assets/index.es-Bushv2uZ.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BN-E6inN.js","assets/hooks.module-LlNaOzAU.js","assets/events-DHqXLz5A.js","assets/inherits_browser-BBXdvzXT.js","assets/index-BBMEgiCJ.js","assets/index-Brvd2aRO.js","assets/index.es-BN4D2FYF.js"])))=>i.map(i=>d[i]); var cu=Object.defineProperty;var Us=et=>{throw TypeError(et)};var lu=(et,o,tt)=>o in et?cu(et,o,{enumerable:!0,configurable:!0,writable:!0,value:tt}):et[o]=tt;var wt=(et,o,tt)=>lu(et,typeof o!="symbol"?o+"":o,tt),cs=(et,o,tt)=>o.has(et)||Us("Cannot "+tt);var Ot=(et,o,tt)=>(cs(et,o,"read from private field"),tt?tt.call(et):o.get(et)),fr=(et,o,tt)=>o.has(et)?Us("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(et):o.set(et,tt),lr=(et,o,tt,rt)=>(cs(et,o,"write to private field"),rt?rt.call(et,tt):o.set(et,tt),tt),mr=(et,o,tt)=>(cs(et,o,"access private method"),tt);var Cn=(et,o,tt,rt)=>({set _(nt){lr(et,o,nt,tt)},get _(){return Ot(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 globalThis<"u"?globalThis: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 @@ -75,7 +75,7 @@ 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 Rs extends Error{constructor(o,tt={}){var it;const rt=tt.cause instanceof Rs?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,nt=tt.cause instanceof Rs&&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 yt=0;yt[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 yt;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)} ${((yt=nt==null?void 0:nt.nativeCurrency)==null?void 0:yt.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,yt)=>{dt.resolve=pt,dt.reject=yt});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 Nt,Lt,Mt,zt;const{account:tt=et.account,batch:rt=!!((Nt=et.batch)!=null&&Nt.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:yt,nonce:gt,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 Xt=(nt?numberToHex(nt):void 0)||ot,Wt=serializeStateOverride(vt),Ft=(zt=(Mt=(Lt=et.chain)==null?void 0:Lt.formatters)==null?void 0:Mt.transactionRequest)==null?void 0:zt.format,Pt=(Ft||formatTransactionRequest)({...extract$1(Et,{format:Ft}),from:Ct==null?void 0:Ct.address,accessList:it,blobs:st,data:It,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:kt?void 0:bt,value:xt});if(rt&&shouldPerformMulticall({request:Pt})&&!Wt)try{return await scheduleMulticall(et,{...Pt,blockNumber:nt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Yt=await et.request({method:"eth_call",params:Wt?[Pt,Xt,Wt]:[Pt,Xt]});return Yt==="0x"?{data:void 0}:{data:Yt}}catch(Ut){const Xt=getRevertErrorData(Ut),{offchainLookup:Wt,offchainLookupSignature:Ft}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Pt}=await import("./ccip-pRo4jQj5.js");return{offchainLookup:qt,offchainLookupSignature:Pt}},[]);if(et.ccipRead!==!1&&(Xt==null?void 0:Xt.slice(0,10))===Ft&&bt)return{data:await Wt(et,{data:Xt,to:bt})};throw kt&&(Xt==null?void 0:Xt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ut,{...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(yt){return yt.reduce((bt,{data:xt})=>bt+(xt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(vt=>({allowFailure:!0,callData:vt.data,target:vt.to})),bt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),xt=await et.request({method:"eth_call",params:[{data:bt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],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=/^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.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 yt;const{allowFailure:tt=!0,batchSize:rt,blockNumber:nt,blockTag:ot,multicallAddress:it,stateOverride:st}=o,at=o.contracts,ct=rt??(typeof((yt=et.batch)==null?void 0:yt.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 gt=0;gt0&&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(gt=>getAction$1(et,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:nt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let gt=0;gtlistenersCache.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 gt=et.transport.transports.find(bt=>bt.config.type==="webSocket");return gt?gt.value:et.transport}return et.transport})(),{unsubscribe:yt}=await pt.subscribe({params:["newHeads"],onData(gt){var xt;if(!mt)return;const bt=hexToBigInt((xt=gt.result)==null?void 0:xt.number);ht.onBlockNumber(bt,at),at=bt},onError(gt){var bt;(bt=ht.onError)==null||bt.call(ht,gt)}});ft=yt,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)},yt=new Request(et,pt),gt=await(nt==null?void 0:nt(yt,pt))??{...pt,url:et};return await fetch(gt.url??et,gt)},{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)],yt=[],gt=[],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,gt>ct&&(gt-=mt,st+=_1n$6);const bt=yt,xt=yt+Math.abs(gt)-1,vt=pt%2!==0,Et=gt<0;gt===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,yt,gt)=>{const bt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(bt.x),tt.toBytes(bt.y))}),ot=o.fromBytes||(pt=>{const yt=pt.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),bt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:bt}});function it(pt){const{a:yt,b:gt}=o,bt=tt.sqr(pt),xt=tt.mul(bt,pt);return tt.add(tt.add(xt,tt.mul(pt,yt)),gt)}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:yt,nByteLength:gt,wrapPrivateKey:bt,n:xt}=o;if(yt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!yt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(gt*2,"0")}let vt;try{vt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,gt))}catch{throw new Error(`private key must be ${gt} 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,yt)=>{const{px:gt,py:bt,pz:xt}=pt;if(tt.eql(xt,tt.ONE))return{x:gt,y:bt};const vt=pt.is0();yt==null&&(yt=vt?tt.ONE:tt.inv(xt));const Et=tt.mul(gt,yt),Ct=tt.mul(bt,yt),St=tt.mul(xt,yt);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:yt,y:gt}=pt.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const bt=tt.sqr(gt),xt=it(yt);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(yt,gt,bt){if(this.px=yt,this.py=gt,this.pz=bt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(bt==null||!tt.isValid(bt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:bt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(bt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const xt=vt=>tt.eql(vt,tt.ZERO);return xt(gt)&&xt(bt)?ht.ZERO:new ht(gt,bt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(bt=>bt.pz));return yt.map((bt,xt)=>bt.toAffine(gt[xt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,rt,yt,gt)}_setWindowSize(yt){ft.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=yt,St=tt.eql(tt.mul(gt,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:yt,b:gt}=o,bt=tt.mul(gt,_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),Nt=tt.mul(Et,Et),Lt=tt.mul(xt,vt);return Lt=tt.add(Lt,Lt),At=tt.mul(xt,Et),At=tt.add(At,At),Ct=tt.mul(yt,At),St=tt.mul(bt,Nt),St=tt.add(Ct,St),Ct=tt.sub(It,St),St=tt.add(It,St),St=tt.mul(Ct,St),Ct=tt.mul(Lt,Ct),At=tt.mul(bt,At),Nt=tt.mul(yt,Nt),Lt=tt.sub(kt,Nt),Lt=tt.mul(yt,Lt),Lt=tt.add(Lt,At),At=tt.add(kt,kt),kt=tt.add(At,kt),kt=tt.add(kt,Nt),kt=tt.mul(kt,Lt),St=tt.add(St,kt),Nt=tt.mul(vt,Et),Nt=tt.add(Nt,Nt),kt=tt.mul(Nt,Lt),Ct=tt.sub(Ct,kt),At=tt.mul(Nt,It),At=tt.add(At,At),At=tt.add(At,At),new ht(Ct,St,At)}add(yt){ct(yt);const{px:gt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=yt;let St=tt.ZERO,At=tt.ZERO,kt=tt.ZERO;const It=o.a,Nt=tt.mul(o.b,_3n$2);let Lt=tt.mul(gt,vt),Mt=tt.mul(bt,Et),zt=tt.mul(xt,Ct),Ut=tt.add(gt,bt),Xt=tt.add(vt,Et);Ut=tt.mul(Ut,Xt),Xt=tt.add(Lt,Mt),Ut=tt.sub(Ut,Xt),Xt=tt.add(gt,xt);let Wt=tt.add(vt,Ct);return Xt=tt.mul(Xt,Wt),Wt=tt.add(Lt,zt),Xt=tt.sub(Xt,Wt),Wt=tt.add(bt,xt),St=tt.add(Et,Ct),Wt=tt.mul(Wt,St),St=tt.add(Mt,zt),Wt=tt.sub(Wt,St),kt=tt.mul(It,Xt),St=tt.mul(Nt,zt),kt=tt.add(St,kt),St=tt.sub(Mt,kt),kt=tt.add(Mt,kt),At=tt.mul(St,kt),Mt=tt.add(Lt,Lt),Mt=tt.add(Mt,Lt),zt=tt.mul(It,zt),Xt=tt.mul(Nt,Xt),Mt=tt.add(Mt,zt),zt=tt.sub(Lt,zt),zt=tt.mul(It,zt),Xt=tt.add(Xt,zt),Lt=tt.mul(Mt,Xt),At=tt.add(At,Lt),Lt=tt.mul(Wt,Xt),St=tt.mul(Ut,St),St=tt.sub(St,Lt),Lt=tt.mul(Ut,Mt),kt=tt.mul(Wt,kt),kt=tt.add(kt,Lt),new ht(St,At,kt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return ft.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,o.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:bt}=o;if(!bt)return ft.unsafeLadder(this,yt);let{k1neg:xt,k1:vt,k2neg:Et,k2:Ct}=bt.splitScalar(yt),St=gt,At=gt,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(yt){const{endo:gt,n:bt}=o;aInRange("scalar",yt,_1n$5,bt);let xt,vt;if(gt){const{k1neg:Et,k1:Ct,k2neg:St,k2:At}=gt.splitScalar(yt);let{p:kt,f:It}=this.wNAF(Ct),{p:Nt,f:Lt}=this.wNAF(At);kt=ft.constTimeNegate(Et,kt),Nt=ft.constTimeNegate(St,Nt),Nt=new ht(tt.mul(Nt.px,gt.beta),Nt.py,Nt.pz),xt=kt.add(Nt),vt=It.add(Lt)}else{const{p:Et,f:Ct}=this.wNAF(yt);xt=Et,vt=Ct}return ht.normalizeZ([xt,vt])[0]}multiplyAndAddUnsafe(yt,gt,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,gt).add(vt(yt,bt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=o;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=o;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(o.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),nt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}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(zt){return mod$1(zt,rt)}function st(zt){return invert$1(zt,rt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...o,toBytes(zt,Ut,Xt){const Wt=Ut.toAffine(),Ft=tt.toBytes(Wt.x),qt=concatBytes$1;return abool("isCompressed",Xt),Xt?qt(Uint8Array.from([Ut.hasEvenY()?2:3]),Ft):qt(Uint8Array.from([4]),Ft,tt.toBytes(Wt.y))},fromBytes(zt){const Ut=zt.length,Xt=zt[0],Wt=zt.subarray(1);if(Ut===nt&&(Xt===2||Xt===3)){const Ft=bytesToNumberBE(Wt);if(!inRange(Ft,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ft);let Pt;try{Pt=tt.sqrt(qt)}catch(jt){const Gt=jt instanceof Error?": "+jt.message:"";throw new Error("Point is not on curve"+Gt)}const Yt=(Pt&_1n$5)===_1n$5;return(Xt&1)===1!==Yt&&(Pt=tt.neg(Pt)),{x:Ft,y:Pt}}else if(Ut===ot&&Xt===4){const Ft=tt.fromBytes(Wt.subarray(0,tt.BYTES)),qt=tt.fromBytes(Wt.subarray(tt.BYTES,2*tt.BYTES));return{x:Ft,y:qt}}else throw new Error(`Point of length ${Ut} was invalid. Expected ${nt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,o.nByteLength));function mt(zt){const Ut=rt>>_1n$5;return zt>Ut}function ft(zt){return mt(zt)?it(-zt):zt}const pt=(zt,Ut,Xt)=>bytesToNumberBE(zt.slice(Ut,Xt));class yt{constructor(Ut,Xt,Wt){this.r=Ut,this.s=Xt,this.recovery=Wt,this.assertValidity()}static fromCompact(Ut){const Xt=o.nByteLength;return Ut=ensureBytes$1("compactSignature",Ut,Xt*2),new yt(pt(Ut,0,Xt),pt(Ut,Xt,2*Xt))}static fromDER(Ut){const{r:Xt,s:Wt}=DER.toSig(ensureBytes$1("DER",Ut));return new yt(Xt,Wt)}assertValidity(){aInRange("r",this.r,_1n$5,rt),aInRange("s",this.s,_1n$5,rt)}addRecoveryBit(Ut){return new yt(this.r,this.s,Ut)}recoverPublicKey(Ut){const{r:Xt,s:Wt,recovery:Ft}=this,qt=Ct(ensureBytes$1("msgHash",Ut));if(Ft==null||![0,1,2,3].includes(Ft))throw new Error("recovery id invalid");const Pt=Ft===2||Ft===3?Xt+o.n:Xt;if(Pt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Yt=Ft&1?"03":"02",Qt=at.fromHex(Yt+ht(Pt)),jt=st(Pt),Gt=it(-qt*jt),rr=it(Wt*jt),Ht=at.BASE.multiplyAndAddUnsafe(Qt,Gt,rr);if(!Ht)throw new Error("point at infinify");return Ht.assertValidity(),Ht}hasHighS(){return mt(this.s)}normalizeS(){return this.hasHighS()?new yt(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 gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(o.n);return mapHashToField(o.randomBytes(zt),o.n)},precompute(zt=8,Ut=at.BASE){return Ut._setWindowSize(zt),Ut.multiply(BigInt(3)),Ut}};function bt(zt,Ut=!0){return at.fromPrivateKey(zt).toRawBytes(Ut)}function xt(zt){const Ut=isBytes$2(zt),Xt=typeof zt=="string",Wt=(Ut||Xt)&&zt.length;return Ut?Wt===nt||Wt===ot:Xt?Wt===2*nt||Wt===2*ot:zt instanceof at}function vt(zt,Ut,Xt=!0){if(xt(zt))throw new Error("first arg must be private key");if(!xt(Ut))throw new Error("second arg must be public key");return at.fromHex(Ut).multiply(ct(zt)).toRawBytes(Xt)}const Et=o.bits2int||function(zt){const Ut=bytesToNumberBE(zt),Xt=zt.length*8-o.nBitLength;return Xt>0?Ut>>BigInt(Xt):Ut},Ct=o.bits2int_modN||function(zt){return it(Et(zt))},St=bitMask(o.nBitLength);function At(zt){return aInRange(`num < 2^${o.nBitLength}`,zt,_0n$3,St),numberToBytesBE(zt,o.nByteLength)}function kt(zt,Ut,Xt=It){if(["recovered","canonical"].some(Zt=>Zt in Xt))throw new Error("sign() legacy options not supported");const{hash:Wt,randomBytes:Ft}=o;let{lowS:qt,prehash:Pt,extraEntropy:Yt}=Xt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Xt),Pt&&(zt=ensureBytes$1("prehashed msgHash",Wt(zt)));const Qt=Ct(zt),jt=ct(Ut),Gt=[At(jt),At(Qt)];if(Yt!=null&&Yt!==!1){const Zt=Yt===!0?Ft(tt.BYTES):Yt;Gt.push(ensureBytes$1("extraEntropy",Zt))}const rr=concatBytes$1(...Gt),Ht=Qt;function dr(Zt){const Jt=Et(Zt);if(!dt(Jt))return;const tr=st(Jt),_t=at.BASE.multiply(Jt).toAffine(),Bt=it(_t.x);if(Bt===_0n$3)return;const Vt=it(tr*it(Ht+Bt*jt));if(Vt===_0n$3)return;let er=(_t.x===Bt?0:2)|Number(_t.y&_1n$5),ar=Vt;return qt&&mt(Vt)&&(ar=ft(Vt),er^=1),new yt(Bt,ar,er)}return{seed:rr,k2sig:dr}}const It={lowS:o.lowS,prehash:!1},Nt={lowS:o.lowS,prehash:!1};function Lt(zt,Ut,Xt=It){const{seed:Wt,k2sig:Ft}=kt(zt,Ut,Xt),qt=o;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Wt,Ft)}at.BASE._setWindowSize(8);function Mt(zt,Ut,Xt,Wt=Nt){var _t;const Ft=zt;if(Ut=ensureBytes$1("msgHash",Ut),Xt=ensureBytes$1("publicKey",Xt),"strict"in Wt)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Wt);const{lowS:qt,prehash:Pt}=Wt;let Yt,Qt;try{if(typeof Ft=="string"||isBytes$2(Ft))try{Yt=yt.fromDER(Ft)}catch(Bt){if(!(Bt instanceof DER.Err))throw Bt;Yt=yt.fromCompact(Ft)}else if(typeof Ft=="object"&&typeof Ft.r=="bigint"&&typeof Ft.s=="bigint"){const{r:Bt,s:Vt}=Ft;Yt=new yt(Bt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Xt)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Yt.hasHighS())return!1;Pt&&(Ut=o.hash(Ut));const{r:jt,s:Gt}=Yt,rr=Ct(Ut),Ht=st(Gt),dr=it(rr*Ht),Zt=it(jt*Ht),Jt=(_t=at.BASE.multiplyAndAddUnsafe(Qt,dr,Zt))==null?void 0:_t.toAffine();return Jt?it(Jt.x)===jt:!1}return{CURVE:o,getPublicKey:bt,getSharedSecret:vt,sign:Lt,verify:Mt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! 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,yt=pow2$1(pt,st,o)*pt%o,gt=pow2$1(yt,at,o)*yt%o,bt=pow2$1(gt,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$1=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(` +`):`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,yt)=>{dt.resolve=pt,dt.reject=yt});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 Nt,Lt,Mt,zt;const{account:tt=et.account,batch:rt=!!((Nt=et.batch)!=null&&Nt.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:yt,nonce:gt,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 Xt=(nt?numberToHex(nt):void 0)||ot,Wt=serializeStateOverride(vt),Ft=(zt=(Mt=(Lt=et.chain)==null?void 0:Lt.formatters)==null?void 0:Mt.transactionRequest)==null?void 0:zt.format,Pt=(Ft||formatTransactionRequest)({...extract$1(Et,{format:Ft}),from:Ct==null?void 0:Ct.address,accessList:it,blobs:st,data:It,gas:ht,gasPrice:mt,maxFeePerBlobGas:ft,maxFeePerGas:pt,maxPriorityFeePerGas:yt,nonce:gt,to:kt?void 0:bt,value:xt});if(rt&&shouldPerformMulticall({request:Pt})&&!Wt)try{return await scheduleMulticall(et,{...Pt,blockNumber:nt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Yt=await et.request({method:"eth_call",params:Wt?[Pt,Xt,Wt]:[Pt,Xt]});return Yt==="0x"?{data:void 0}:{data:Yt}}catch(Ut){const Xt=getRevertErrorData(Ut),{offchainLookup:Wt,offchainLookupSignature:Ft}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Pt}=await import("./ccip-hSU-as8c.js");return{offchainLookup:qt,offchainLookupSignature:Pt}},[]);if(et.ccipRead!==!1&&(Xt==null?void 0:Xt.slice(0,10))===Ft&&bt)return{data:await Wt(et,{data:Xt,to:bt})};throw kt&&(Xt==null?void 0:Xt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ut,{...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(yt){return yt.reduce((bt,{data:xt})=>bt+(xt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(vt=>({allowFailure:!0,callData:vt.data,target:vt.to})),bt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),xt=await et.request({method:"eth_call",params:[{data:bt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],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=/^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.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 yt;const{allowFailure:tt=!0,batchSize:rt,blockNumber:nt,blockTag:ot,multicallAddress:it,stateOverride:st}=o,at=o.contracts,ct=rt??(typeof((yt=et.batch)==null?void 0:yt.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 gt=0;gt0&&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(gt=>getAction$1(et,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:nt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),pt=[];for(let gt=0;gtlistenersCache.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 gt=et.transport.transports.find(bt=>bt.config.type==="webSocket");return gt?gt.value:et.transport}return et.transport})(),{unsubscribe:yt}=await pt.subscribe({params:["newHeads"],onData(gt){var xt;if(!mt)return;const bt=hexToBigInt((xt=gt.result)==null?void 0:xt.number);ht.onBlockNumber(bt,at),at=bt},onError(gt){var bt;(bt=ht.onError)==null||bt.call(ht,gt)}});ft=yt,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)},yt=new Request(et,pt),gt=await(nt==null?void 0:nt(yt,pt))??{...pt,url:et};return await fetch(gt.url??et,gt)},{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)],yt=[],gt=[],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,gt>ct&&(gt-=mt,st+=_1n$6);const bt=yt,xt=yt+Math.abs(gt)-1,vt=pt%2!==0,Et=gt<0;gt===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,yt,gt)=>{const bt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(bt.x),tt.toBytes(bt.y))}),ot=o.fromBytes||(pt=>{const yt=pt.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),bt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:bt}});function it(pt){const{a:yt,b:gt}=o,bt=tt.sqr(pt),xt=tt.mul(bt,pt);return tt.add(tt.add(xt,tt.mul(pt,yt)),gt)}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:yt,nByteLength:gt,wrapPrivateKey:bt,n:xt}=o;if(yt&&typeof pt!="bigint"){if(isBytes$2(pt)&&(pt=bytesToHex$2(pt)),typeof pt!="string"||!yt.includes(pt.length))throw new Error("Invalid key");pt=pt.padStart(gt*2,"0")}let vt;try{vt=typeof pt=="bigint"?pt:bytesToNumberBE(ensureBytes$1("private key",pt,gt))}catch{throw new Error(`private key must be ${gt} 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,yt)=>{const{px:gt,py:bt,pz:xt}=pt;if(tt.eql(xt,tt.ONE))return{x:gt,y:bt};const vt=pt.is0();yt==null&&(yt=vt?tt.ONE:tt.inv(xt));const Et=tt.mul(gt,yt),Ct=tt.mul(bt,yt),St=tt.mul(xt,yt);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:yt,y:gt}=pt.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const bt=tt.sqr(gt),xt=it(yt);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(yt,gt,bt){if(this.px=yt,this.py=gt,this.pz=bt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(bt==null||!tt.isValid(bt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:bt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(bt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const xt=vt=>tt.eql(vt,tt.ZERO);return xt(gt)&&xt(bt)?ht.ZERO:new ht(gt,bt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(bt=>bt.pz));return yt.map((bt,xt)=>bt.toAffine(gt[xt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,rt,yt,gt)}_setWindowSize(yt){ft.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=yt,St=tt.eql(tt.mul(gt,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:yt,b:gt}=o,bt=tt.mul(gt,_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),Nt=tt.mul(Et,Et),Lt=tt.mul(xt,vt);return Lt=tt.add(Lt,Lt),At=tt.mul(xt,Et),At=tt.add(At,At),Ct=tt.mul(yt,At),St=tt.mul(bt,Nt),St=tt.add(Ct,St),Ct=tt.sub(It,St),St=tt.add(It,St),St=tt.mul(Ct,St),Ct=tt.mul(Lt,Ct),At=tt.mul(bt,At),Nt=tt.mul(yt,Nt),Lt=tt.sub(kt,Nt),Lt=tt.mul(yt,Lt),Lt=tt.add(Lt,At),At=tt.add(kt,kt),kt=tt.add(At,kt),kt=tt.add(kt,Nt),kt=tt.mul(kt,Lt),St=tt.add(St,kt),Nt=tt.mul(vt,Et),Nt=tt.add(Nt,Nt),kt=tt.mul(Nt,Lt),Ct=tt.sub(Ct,kt),At=tt.mul(Nt,It),At=tt.add(At,At),At=tt.add(At,At),new ht(Ct,St,At)}add(yt){ct(yt);const{px:gt,py:bt,pz:xt}=this,{px:vt,py:Et,pz:Ct}=yt;let St=tt.ZERO,At=tt.ZERO,kt=tt.ZERO;const It=o.a,Nt=tt.mul(o.b,_3n$2);let Lt=tt.mul(gt,vt),Mt=tt.mul(bt,Et),zt=tt.mul(xt,Ct),Ut=tt.add(gt,bt),Xt=tt.add(vt,Et);Ut=tt.mul(Ut,Xt),Xt=tt.add(Lt,Mt),Ut=tt.sub(Ut,Xt),Xt=tt.add(gt,xt);let Wt=tt.add(vt,Ct);return Xt=tt.mul(Xt,Wt),Wt=tt.add(Lt,zt),Xt=tt.sub(Xt,Wt),Wt=tt.add(bt,xt),St=tt.add(Et,Ct),Wt=tt.mul(Wt,St),St=tt.add(Mt,zt),Wt=tt.sub(Wt,St),kt=tt.mul(It,Xt),St=tt.mul(Nt,zt),kt=tt.add(St,kt),St=tt.sub(Mt,kt),kt=tt.add(Mt,kt),At=tt.mul(St,kt),Mt=tt.add(Lt,Lt),Mt=tt.add(Mt,Lt),zt=tt.mul(It,zt),Xt=tt.mul(Nt,Xt),Mt=tt.add(Mt,zt),zt=tt.sub(Lt,zt),zt=tt.mul(It,zt),Xt=tt.add(Xt,zt),Lt=tt.mul(Mt,Xt),At=tt.add(At,Lt),Lt=tt.mul(Wt,Xt),St=tt.mul(Ut,St),St=tt.sub(St,Lt),Lt=tt.mul(Ut,Mt),kt=tt.mul(Wt,kt),kt=tt.add(kt,Lt),new ht(St,At,kt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return ft.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,o.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:bt}=o;if(!bt)return ft.unsafeLadder(this,yt);let{k1neg:xt,k1:vt,k2neg:Et,k2:Ct}=bt.splitScalar(yt),St=gt,At=gt,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(yt){const{endo:gt,n:bt}=o;aInRange("scalar",yt,_1n$5,bt);let xt,vt;if(gt){const{k1neg:Et,k1:Ct,k2neg:St,k2:At}=gt.splitScalar(yt);let{p:kt,f:It}=this.wNAF(Ct),{p:Nt,f:Lt}=this.wNAF(At);kt=ft.constTimeNegate(Et,kt),Nt=ft.constTimeNegate(St,Nt),Nt=new ht(tt.mul(Nt.px,gt.beta),Nt.py,Nt.pz),xt=kt.add(Nt),vt=It.add(Lt)}else{const{p:Et,f:Ct}=this.wNAF(yt);xt=Et,vt=Ct}return ht.normalizeZ([xt,vt])[0]}multiplyAndAddUnsafe(yt,gt,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,gt).add(vt(yt,bt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=o;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=o;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(o.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),nt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}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(zt){return mod$1(zt,rt)}function st(zt){return invert$1(zt,rt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...o,toBytes(zt,Ut,Xt){const Wt=Ut.toAffine(),Ft=tt.toBytes(Wt.x),qt=concatBytes$1;return abool("isCompressed",Xt),Xt?qt(Uint8Array.from([Ut.hasEvenY()?2:3]),Ft):qt(Uint8Array.from([4]),Ft,tt.toBytes(Wt.y))},fromBytes(zt){const Ut=zt.length,Xt=zt[0],Wt=zt.subarray(1);if(Ut===nt&&(Xt===2||Xt===3)){const Ft=bytesToNumberBE(Wt);if(!inRange(Ft,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ft);let Pt;try{Pt=tt.sqrt(qt)}catch(jt){const Gt=jt instanceof Error?": "+jt.message:"";throw new Error("Point is not on curve"+Gt)}const Yt=(Pt&_1n$5)===_1n$5;return(Xt&1)===1!==Yt&&(Pt=tt.neg(Pt)),{x:Ft,y:Pt}}else if(Ut===ot&&Xt===4){const Ft=tt.fromBytes(Wt.subarray(0,tt.BYTES)),qt=tt.fromBytes(Wt.subarray(tt.BYTES,2*tt.BYTES));return{x:Ft,y:qt}}else throw new Error(`Point of length ${Ut} was invalid. Expected ${nt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,o.nByteLength));function mt(zt){const Ut=rt>>_1n$5;return zt>Ut}function ft(zt){return mt(zt)?it(-zt):zt}const pt=(zt,Ut,Xt)=>bytesToNumberBE(zt.slice(Ut,Xt));class yt{constructor(Ut,Xt,Wt){this.r=Ut,this.s=Xt,this.recovery=Wt,this.assertValidity()}static fromCompact(Ut){const Xt=o.nByteLength;return Ut=ensureBytes$1("compactSignature",Ut,Xt*2),new yt(pt(Ut,0,Xt),pt(Ut,Xt,2*Xt))}static fromDER(Ut){const{r:Xt,s:Wt}=DER.toSig(ensureBytes$1("DER",Ut));return new yt(Xt,Wt)}assertValidity(){aInRange("r",this.r,_1n$5,rt),aInRange("s",this.s,_1n$5,rt)}addRecoveryBit(Ut){return new yt(this.r,this.s,Ut)}recoverPublicKey(Ut){const{r:Xt,s:Wt,recovery:Ft}=this,qt=Ct(ensureBytes$1("msgHash",Ut));if(Ft==null||![0,1,2,3].includes(Ft))throw new Error("recovery id invalid");const Pt=Ft===2||Ft===3?Xt+o.n:Xt;if(Pt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Yt=Ft&1?"03":"02",Qt=at.fromHex(Yt+ht(Pt)),jt=st(Pt),Gt=it(-qt*jt),rr=it(Wt*jt),Ht=at.BASE.multiplyAndAddUnsafe(Qt,Gt,rr);if(!Ht)throw new Error("point at infinify");return Ht.assertValidity(),Ht}hasHighS(){return mt(this.s)}normalizeS(){return this.hasHighS()?new yt(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 gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(o.n);return mapHashToField(o.randomBytes(zt),o.n)},precompute(zt=8,Ut=at.BASE){return Ut._setWindowSize(zt),Ut.multiply(BigInt(3)),Ut}};function bt(zt,Ut=!0){return at.fromPrivateKey(zt).toRawBytes(Ut)}function xt(zt){const Ut=isBytes$2(zt),Xt=typeof zt=="string",Wt=(Ut||Xt)&&zt.length;return Ut?Wt===nt||Wt===ot:Xt?Wt===2*nt||Wt===2*ot:zt instanceof at}function vt(zt,Ut,Xt=!0){if(xt(zt))throw new Error("first arg must be private key");if(!xt(Ut))throw new Error("second arg must be public key");return at.fromHex(Ut).multiply(ct(zt)).toRawBytes(Xt)}const Et=o.bits2int||function(zt){const Ut=bytesToNumberBE(zt),Xt=zt.length*8-o.nBitLength;return Xt>0?Ut>>BigInt(Xt):Ut},Ct=o.bits2int_modN||function(zt){return it(Et(zt))},St=bitMask(o.nBitLength);function At(zt){return aInRange(`num < 2^${o.nBitLength}`,zt,_0n$3,St),numberToBytesBE(zt,o.nByteLength)}function kt(zt,Ut,Xt=It){if(["recovered","canonical"].some(Zt=>Zt in Xt))throw new Error("sign() legacy options not supported");const{hash:Wt,randomBytes:Ft}=o;let{lowS:qt,prehash:Pt,extraEntropy:Yt}=Xt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Xt),Pt&&(zt=ensureBytes$1("prehashed msgHash",Wt(zt)));const Qt=Ct(zt),jt=ct(Ut),Gt=[At(jt),At(Qt)];if(Yt!=null&&Yt!==!1){const Zt=Yt===!0?Ft(tt.BYTES):Yt;Gt.push(ensureBytes$1("extraEntropy",Zt))}const rr=concatBytes$1(...Gt),Ht=Qt;function dr(Zt){const Jt=Et(Zt);if(!dt(Jt))return;const tr=st(Jt),_t=at.BASE.multiply(Jt).toAffine(),Bt=it(_t.x);if(Bt===_0n$3)return;const Vt=it(tr*it(Ht+Bt*jt));if(Vt===_0n$3)return;let er=(_t.x===Bt?0:2)|Number(_t.y&_1n$5),ar=Vt;return qt&&mt(Vt)&&(ar=ft(Vt),er^=1),new yt(Bt,ar,er)}return{seed:rr,k2sig:dr}}const It={lowS:o.lowS,prehash:!1},Nt={lowS:o.lowS,prehash:!1};function Lt(zt,Ut,Xt=It){const{seed:Wt,k2sig:Ft}=kt(zt,Ut,Xt),qt=o;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Wt,Ft)}at.BASE._setWindowSize(8);function Mt(zt,Ut,Xt,Wt=Nt){var _t;const Ft=zt;if(Ut=ensureBytes$1("msgHash",Ut),Xt=ensureBytes$1("publicKey",Xt),"strict"in Wt)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Wt);const{lowS:qt,prehash:Pt}=Wt;let Yt,Qt;try{if(typeof Ft=="string"||isBytes$2(Ft))try{Yt=yt.fromDER(Ft)}catch(Bt){if(!(Bt instanceof DER.Err))throw Bt;Yt=yt.fromCompact(Ft)}else if(typeof Ft=="object"&&typeof Ft.r=="bigint"&&typeof Ft.s=="bigint"){const{r:Bt,s:Vt}=Ft;Yt=new yt(Bt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Xt)}catch(Bt){if(Bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Yt.hasHighS())return!1;Pt&&(Ut=o.hash(Ut));const{r:jt,s:Gt}=Yt,rr=Ct(Ut),Ht=st(Gt),dr=it(rr*Ht),Zt=it(jt*Ht),Jt=(_t=at.BASE.multiplyAndAddUnsafe(Qt,dr,Zt))==null?void 0:_t.toAffine();return Jt?it(Jt.x)===jt:!1}return{CURVE:o,getPublicKey:bt,getSharedSecret:vt,sign:Lt,verify:Mt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! 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,yt=pow2$1(pt,st,o)*pt%o,gt=pow2$1(yt,at,o)*yt%o,bt=pow2$1(gt,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$1=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$1(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$1(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$1;function uid$1(et=11){if(!buffer$1||index$3+et>size$1*2){buffer$1="",index$3=0;for(let o=0;o{const bt=gt(yt);for(const vt in ft)delete bt[vt];const xt={...yt,...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(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,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{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:yt,wait:mt,shouldSplitBatch(kt){return kt.length>ht},fn:kt=>gt.request({body:kt}),sort:(kt,It)=>kt.id-It.id}),Ct=async kt=>tt?Et(kt):[await gt.request({body:kt})],[{error:St,result:At}]=await Ct(vt);if(St)throw new RpcRequestError({body:vt,error:St,url:yt});return At},retryCount:ft,retryDelay:at,timeout:pt,type:"http"},{fetchOptions:rt,url:yt})}}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(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 yt=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:yt}}),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,yt,gt,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=(yt=(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:yt.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((gt=at.storage)==null?void 0:gt.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(gt=>window.addEventListener("ethereum#initialized",()=>gt(ft()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(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,yt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(gt=>gt.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(gt=>{const bt=xt=>{"chainId"in xt&&xt.chainId===lt&&(at.emitter.off("change",bt),gt())};at.emitter.on("change",bt)})]),ht}catch(gt){const bt=gt;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=[((yt=ht.rpcUrls.default)==null?void 0:yt.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__$1={BASE_URL:"/buddybook/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},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:yt=>yt,version:0,merge:(yt,gt)=>({...gt,...yt}),...o},it=!1;const st=new Set,at=new Set;let ct;try{ct=ot.getStorage()}catch{}if(!ct)return et((...yt)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...yt)},rt,nt);const lt=toThenable(ot.serialize),dt=()=>{const yt=ot.partialize({...rt()});let gt;const bt=lt({state:yt,version:ot.version}).then(xt=>ct.setItem(ot.name,xt)).catch(xt=>{gt=xt});if(gt)throw gt;return bt},ht=nt.setState;nt.setState=(yt,gt)=>{ht(yt,gt),dt()};const mt=et((...yt)=>{tt(...yt),dt()},rt,nt);let ft;const pt=()=>{var yt;if(!ct)return;it=!1,st.forEach(bt=>bt(rt()));const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.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(()=>{gt==null||gt(ft,void 0),it=!0,at.forEach(bt=>bt(ft))}).catch(bt=>{gt==null||gt(void 0,bt)})};return nt.persist={setOptions:yt=>{ot={...ot,...yt},yt.getStorage&&(ct=yt.getStorage())},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>pt(),hasHydrated:()=>it,onHydrate:yt=>(st.add(yt),()=>{st.delete(yt)}),onFinishHydration:yt=>(at.add(yt),()=>{at.delete(yt)})},pt(),ft||mt},newImpl=(et,o)=>(tt,rt,nt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:pt=>pt,version:0,merge:(pt,yt)=>({...yt,...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,yt)=>{dt(pt,yt),lt()};const ht=et((...pt)=>{tt(...pt),lt()},rt,nt);let mt;const ft=()=>{var pt,yt;if(!ct)return;it=!1,st.forEach(bt=>{var xt;return bt((xt=rt())!=null?xt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.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(()=>{gt==null||gt(mt,void 0),mt=rt(),it=!0,at.forEach(bt=>bt(mt))}).catch(bt=>{gt==null||gt(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__$1?"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__={BASE_URL:"/buddybook/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},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__?"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;function uid(et=11){if(!buffer||index$2+et>size*2){buffer="",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??yt.getState().chainId,St=st.getState().find(kt=>kt.id===Ct);if(Et.chainId&&!St)throw new ChainNotConfiguredError;{const kt=dt.get(yt.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(Mt=>Mt.id),Nt={},Lt=Object.entries(ot);for(const[Mt,zt]of Lt)if(!(Mt==="chains"||Mt==="client"||Mt==="connectors"||Mt==="transports"))if(typeof zt=="object")if(kt in zt)Nt[Mt]=zt[kt];else{if(It.some(Xt=>Xt in zt))continue;Nt[Mt]=zt}else Nt[Mt]=zt;At=createClient({...Nt,chain:St,batch:Nt.batch??{multicall:!0},transport:Mt=>ot.transports[kt]({...Mt,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 yt=createStore(subscribeWithSelector(tt?persist(mt,{migrate(Et,Ct){if(Ct===ft)return Et;const St=mt(),At=gt(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:Nt}=St.connector;return[Ct,{...St,connector:{id:At,name:kt,type:It,uid:Nt}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,Ct){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const St=gt(Et,Ct.chainId);return{...Ct,...Et,chainId:St}},skipHydration:nt,storage:tt,version:ft}):mt));function gt(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&&yt.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 yt.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&&!yt.persist.hasHydrated()||at.setState(At=>[...At,...St],!0)});function bt(Et){yt.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){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.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){yt.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 yt.getState()},setState(Et){let Ct;typeof Et=="function"?Ct=Et(yt.getState()):Ct=Et;const St=mt();typeof Ct!="object"&&(Ct=St),Object.keys(St).some(kt=>!(kt in Ct))&&(Ct=St),yt.setState(Ct,!0)},subscribe(Et,Ct,St){return yt.subscribe(Et,Ct,St?{...St,fireImmediately:St.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,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 @@ -92,7 +92,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,zs,FocusManager=(zs=class extends Subscribable{constructor(){super();fr(this,kn);fr(this,hn);fr(this,Mn);lr(this,Mn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Ot(this,hn)||this.setEventListener(Ot(this,Mn))}onUnsubscribe(){var o;this.hasListeners()||((o=Ot(this,hn))==null||o.call(this),lr(this,hn,void 0))}setEventListener(o){var tt;lr(this,Mn,o),(tt=Ot(this,hn))==null||tt.call(this),lr(this,hn,o(rt=>{typeof rt=="boolean"?this.setFocused(rt):this.onFocus()}))}setFocused(o){Ot(this,kn)!==o&&(lr(this,kn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(tt=>{tt(o)})}isFocused(){var o;return typeof Ot(this,kn)=="boolean"?Ot(this,kn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},kn=new WeakMap,hn=new WeakMap,Mn=new WeakMap,zs),focusManager=new FocusManager,Bn,fn,Fn,Vs,OnlineManager=(Vs=class extends Subscribable{constructor(){super();fr(this,Bn,!0);fr(this,fn);fr(this,Fn);lr(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(){Ot(this,fn)||this.setEventListener(Ot(this,Fn))}onUnsubscribe(){var o;this.hasListeners()||((o=Ot(this,fn))==null||o.call(this),lr(this,fn,void 0))}setEventListener(o){var tt;lr(this,Fn,o),(tt=Ot(this,fn))==null||tt.call(this),lr(this,fn,o(this.setOnline.bind(this)))}setOnline(o){Ot(this,Bn)!==o&&(lr(this,Bn,o),this.listeners.forEach(rt=>{rt(o)}))}isOnline(){return Ot(this,Bn)}},Bn=new WeakMap,fn=new WeakMap,Fn=new WeakMap,Vs),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 yt;rt||(ht(new CancelledError(pt)),(yt=et.abort)==null||yt.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 yt;rt||(rt=!0,(yt=et.onSuccess)==null||yt.call(et,pt),nt==null||nt(),ot.resolve(pt))},ht=pt=>{var yt;rt||(rt=!0,(yt=et.onError)==null||yt.call(et,pt),nt==null||nt(),ot.reject(pt))},mt=()=>new Promise(pt=>{var yt;nt=gt=>{(rt||ct())&&pt(gt)},(yt=et.onPause)==null||yt.call(et)}).then(()=>{var pt;nt=void 0,rt||(pt=et.onContinue)==null||pt.call(et)}),ft=()=>{if(rt)return;let pt;const yt=tt===0?et.initialPromise:void 0;try{pt=yt??et.fn()}catch(gt){pt=Promise.reject(gt)}Promise.resolve(pt).then(dt).catch(gt=>{var Ct;if(rt)return;const bt=et.retry??(isServer?0:3),xt=et.retryDelay??defaultRetryDelay,vt=typeof xt=="function"?xt(tt,gt):xt,Et=bt===!0||typeof bt=="number"&&ttct()?void 0:mt()).then(()=>{o?ht(gt):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(),Rn,Hs,Removable=(Hs=class{constructor(){fr(this,Rn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&lr(this,Rn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(et){this.gcTime=Math.max(this.gcTime||0,et??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Ot(this,Rn)&&(clearTimeout(Ot(this,Rn)),lr(this,Rn,void 0))}},Rn=new WeakMap,Hs),Un,zn,Vr,Lr,io,_n,Gr,nn,Ws,Query=(Ws=class extends Removable{constructor(o){super();fr(this,Gr);fr(this,Un);fr(this,zn);fr(this,Vr);fr(this,Lr);fr(this,io);fr(this,_n);lr(this,_n,!1),lr(this,io,o.defaultOptions),this.setOptions(o.options),this.observers=[],lr(this,Vr,o.cache),this.queryKey=o.queryKey,this.queryHash=o.queryHash,lr(this,Un,getDefaultState$1(this.options)),this.state=o.state??Ot(this,Un),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var o;return(o=Ot(this,Lr))==null?void 0:o.promise}setOptions(o){this.options={...Ot(this,io),...o},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Ot(this,Vr).remove(this)}setData(o,tt){const rt=replaceData(this.state.data,o,this.options);return mr(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){mr(this,Gr,nn).call(this,{type:"setState",state:o,setStateOptions:tt})}cancel(o){var rt,nt;const tt=(rt=Ot(this,Lr))==null?void 0:rt.promise;return(nt=Ot(this,Lr))==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(Ot(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=Ot(this,Lr))==null||tt.continue()}onOnline(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(tt=Ot(this,Lr))==null||tt.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),Ot(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||(Ot(this,Lr)&&(Ot(this,_n)?Ot(this,Lr).cancel({revert:!0}):Ot(this,Lr).cancelRetry()),this.scheduleGc()),Ot(this,Vr).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||mr(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(Ot(this,Lr))return Ot(this,Lr).continueRetry(),Ot(this,Lr).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:()=>(lr(this,_n,!0),rt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return nt(ht),lr(this,_n,!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),lr(this,zn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&mr(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||mr(this,Gr,nn).call(this,{type:"error",error:dt}),isCancelledError(dt)||((mt=(ht=Ot(this,Vr).config).onError)==null||mt.call(ht,dt,this),(pt=(ft=Ot(this,Vr).config).onSettled)==null||pt.call(ft,this.state.data,dt,this)),this.scheduleGc()};return lr(this,Lr,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(yt){st(yt);return}(mt=(ht=Ot(this,Vr).config).onSuccess)==null||mt.call(ht,dt,this),(pt=(ft=Ot(this,Vr).config).onSettled)==null||pt.call(ft,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{mr(this,Gr,nn).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{mr(this,Gr,nn).call(this,{type:"pause"})},onContinue:()=>{mr(this,Gr,nn).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Ot(this,Lr).start()}},Un=new WeakMap,zn=new WeakMap,Vr=new WeakMap,Lr=new WeakMap,io=new WeakMap,_n=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&&Ot(this,zn)?{...Ot(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()}),Ot(this,Vr).notify({query:this,type:"updated",action:o})})},Ws);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 qr,Gs,QueryCache=(Gs=class extends Subscribable{constructor(o={}){super();fr(this,qr);this.config=o,lr(this,qr,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){Ot(this,qr).has(o.queryHash)||(Ot(this,qr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const tt=Ot(this,qr).get(o.queryHash);tt&&(o.destroy(),tt===o&&Ot(this,qr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return Ot(this,qr).get(o)}getAll(){return[...Ot(this,qr).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()})})}},qr=new WeakMap,Gs),Kr,Or,Tn,Qr,un,qs,Mutation=(qs=class extends Removable{constructor(o){super();fr(this,Qr);fr(this,Kr);fr(this,Or);fr(this,Tn);this.mutationId=o.mutationId,lr(this,Or,o.mutationCache),lr(this,Kr,[]),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){Ot(this,Kr).includes(o)||(Ot(this,Kr).push(o),this.clearGcTimeout(),Ot(this,Or).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){lr(this,Kr,Ot(this,Kr).filter(tt=>tt!==o)),this.scheduleGc(),Ot(this,Or).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){Ot(this,Kr).length||(this.state.status==="pending"?this.scheduleGc():Ot(this,Or).remove(this))}continue(){var o;return((o=Ot(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,yt,gt,bt,xt,vt,Et,Ct,St;lr(this,Tn,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(o):Promise.reject(new Error("No mutationFn found")),onFail:(At,kt)=>{mr(this,Qr,un).call(this,{type:"failed",failureCount:At,error:kt})},onPause:()=>{mr(this,Qr,un).call(this,{type:"pause"})},onContinue:()=>{mr(this,Qr,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Ot(this,Or).canRun(this)}));const tt=this.state.status==="pending",rt=!Ot(this,Tn).canStart();try{if(!tt){mr(this,Qr,un).call(this,{type:"pending",variables:o,isPaused:rt}),await((ot=(nt=Ot(this,Or).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&&mr(this,Qr,un).call(this,{type:"pending",context:kt,variables:o,isPaused:rt})}const At=await Ot(this,Tn).start();return await((ct=(at=Ot(this,Or).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=Ot(this,Or).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)),mr(this,Qr,un).call(this,{type:"success",data:At}),At}catch(At){try{throw await((gt=(yt=Ot(this,Or).config).onError)==null?void 0:gt.call(yt,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=Ot(this,Or).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{mr(this,Qr,un).call(this,{type:"error",error:At})}}finally{Ot(this,Or).runNext(this)}}},Kr=new WeakMap,Or=new WeakMap,Tn=new WeakMap,Qr=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(()=>{Ot(this,Kr).forEach(rt=>{rt.onMutationUpdate(o)}),Ot(this,Or).notify({mutation:this,type:"updated",action:o})})},qs);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,Ks,MutationCache=(Ks=class extends Subscribable{constructor(o={}){super();fr(this,zr);fr(this,so);this.config=o,lr(this,zr,new Map),lr(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=Ot(this,zr).get(tt)??[];rt.push(o),Ot(this,zr).set(tt,rt),this.notify({type:"added",mutation:o})}remove(o){var rt;const tt=scopeFor(o);if(Ot(this,zr).has(tt)){const nt=(rt=Ot(this,zr).get(tt))==null?void 0:rt.filter(ot=>ot!==o);nt&&(nt.length===0?Ot(this,zr).delete(tt):Ot(this,zr).set(tt,nt))}this.notify({type:"removed",mutation:o})}canRun(o){var rt;const tt=(rt=Ot(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=Ot(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[...Ot(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,Ks);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 yt=xt=>{Object.defineProperty(xt,"signal",{enumerable:!0,get:()=>(o.signal.aborted?pt=!0:o.signal.addEventListener("abort",()=>{pt=!0}),o.signal)})},gt=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};yt(Ct);const St=await gt(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,yt;return(yt=(pt=o.options).persister)==null?void 0:yt.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 Pr,pn,mn,Vn,Hn,gn,Wn,Gn,Qs,QueryClient=(Qs=class{constructor(et={}){fr(this,Pr);fr(this,pn);fr(this,mn);fr(this,Vn);fr(this,Hn);fr(this,gn);fr(this,Wn);fr(this,Gn);lr(this,Pr,et.queryCache||new QueryCache),lr(this,pn,et.mutationCache||new MutationCache),lr(this,mn,et.defaultOptions||{}),lr(this,Vn,new Map),lr(this,Hn,new Map),lr(this,gn,0)}mount(){Cn(this,gn)._++,Ot(this,gn)===1&&(lr(this,Wn,focusManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Ot(this,Pr).onFocus())})),lr(this,Gn,onlineManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Ot(this,Pr).onOnline())})))}unmount(){var et,o;Cn(this,gn)._--,Ot(this,gn)===0&&((et=Ot(this,Wn))==null||et.call(this),lr(this,Wn,void 0),(o=Ot(this,Gn))==null||o.call(this),lr(this,Gn,void 0))}isFetching(et){return Ot(this,Pr).findAll({...et,fetchStatus:"fetching"}).length}isMutating(et){return Ot(this,pn).findAll({...et,status:"pending"}).length}getQueryData(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Ot(this,Pr).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=Ot(this,Pr).build(this,tt);return et.revalidateIfStale&&rt.isStaleByTime(resolveStaleTime(tt.staleTime,rt))&&this.prefetchQuery(tt),Promise.resolve(o)}}getQueriesData(et){return Ot(this,Pr).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=Ot(this,Pr).get(rt.queryHash),ot=nt==null?void 0:nt.state.data,it=functionalUpdate(o,ot);if(it!==void 0)return Ot(this,Pr).build(this,rt).setData(it,{...tt,manual:!0})}setQueriesData(et,o,tt){return notifyManager.batch(()=>Ot(this,Pr).findAll(et).map(({queryKey:rt})=>[rt,this.setQueryData(rt,o,tt)]))}getQueryState(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Ot(this,Pr).get(o.queryHash))==null?void 0:tt.state}removeQueries(et){const o=Ot(this,Pr);notifyManager.batch(()=>{o.findAll(et).forEach(tt=>{o.remove(tt)})})}resetQueries(et,o){const tt=Ot(this,Pr),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(()=>Ot(this,Pr).findAll(et).map(nt=>nt.cancel(tt)));return Promise.all(rt).then(noop$4).catch(noop$4)}invalidateQueries(et={},o={}){return notifyManager.batch(()=>{if(Ot(this,Pr).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(()=>Ot(this,Pr).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=Ot(this,Pr).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()?Ot(this,pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return Ot(this,Pr)}getMutationCache(){return Ot(this,pn)}getDefaultOptions(){return Ot(this,mn)}setDefaultOptions(et){lr(this,mn,et)}setQueryDefaults(et,o){Ot(this,Vn).set(hashKey(et),{queryKey:et,defaultOptions:o})}getQueryDefaults(et){const o=[...Ot(this,Vn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.queryKey)&&(tt={...tt,...rt.defaultOptions})}),tt}setMutationDefaults(et,o){Ot(this,Hn).set(hashKey(et),{mutationKey:et,defaultOptions:o})}getMutationDefaults(et){const o=[...Ot(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={...Ot(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:{...Ot(this,mn).mutations,...(et==null?void 0:et.mutationKey)&&this.getMutationDefaults(et.mutationKey),...et,_defaulted:!0}}clear(){Ot(this,Pr).clear(),Ot(this,pn).clear()}},Pr=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,qn,bn,Xr,co,Kn,Qn,Pn,jn,yn,Xn,Rr,oo,Ts,Is,Ps,js,Ns,Ds,Ls,tu,Xs,QueryObserver=(Xs=class extends Subscribable{constructor(o,tt){super();fr(this,Rr);fr(this,Br);fr(this,Cr);fr(this,ao);fr(this,Mr);fr(this,In);fr(this,qn);fr(this,bn);fr(this,Xr);fr(this,co);fr(this,Kn);fr(this,Qn);fr(this,Pn);fr(this,jn);fr(this,yn);fr(this,Xn,new Set);this.options=tt,lr(this,Br,o),lr(this,Xr,null),lr(this,bn,pendingThenable()),this.options.experimental_prefetchInRender||Ot(this,bn).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&&(Ot(this,Cr).addObserver(this),shouldFetchOnMount(Ot(this,Cr),this.options)?mr(this,Rr,oo).call(this):this.updateResult(),mr(this,Rr,js).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Ot(this,Cr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Ot(this,Cr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,mr(this,Rr,Ns).call(this),mr(this,Rr,Ds).call(this),Ot(this,Cr).removeObserver(this)}setOptions(o,tt){const rt=this.options,nt=Ot(this,Cr);if(this.options=Ot(this,Br).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Ot(this,Cr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");mr(this,Rr,Ls).call(this),Ot(this,Cr).setOptions(this.options),rt._defaulted&&!shallowEqualObjects(this.options,rt)&&Ot(this,Br).getQueryCache().notify({type:"observerOptionsUpdated",query:Ot(this,Cr),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Ot(this,Cr),nt,this.options,rt)&&mr(this,Rr,oo).call(this),this.updateResult(tt),ot&&(Ot(this,Cr)!==nt||resolveEnabled(this.options.enabled,Ot(this,Cr))!==resolveEnabled(rt.enabled,Ot(this,Cr))||resolveStaleTime(this.options.staleTime,Ot(this,Cr))!==resolveStaleTime(rt.staleTime,Ot(this,Cr)))&&mr(this,Rr,Ts).call(this);const it=mr(this,Rr,Is).call(this);ot&&(Ot(this,Cr)!==nt||resolveEnabled(this.options.enabled,Ot(this,Cr))!==resolveEnabled(rt.enabled,Ot(this,Cr))||it!==Ot(this,yn))&&mr(this,Rr,Ps).call(this,it)}getOptimisticResult(o){const tt=Ot(this,Br).getQueryCache().build(Ot(this,Br),o),rt=this.createResult(tt,o);return shouldAssignObserverCurrentProperties(this,rt)&&(lr(this,Mr,rt),lr(this,qn,this.options),lr(this,In,Ot(this,Cr).state)),rt}getCurrentResult(){return Ot(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){Ot(this,Xn).add(o)}getCurrentQuery(){return Ot(this,Cr)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const tt=Ot(this,Br).defaultQueryOptions(o),rt=Ot(this,Br).getQueryCache().build(Ot(this,Br),tt);return rt.fetch().then(()=>this.createResult(rt,tt))}fetch(o){return mr(this,Rr,oo).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),Ot(this,Mr)))}createResult(o,tt){var At;const rt=Ot(this,Cr),nt=this.options,ot=Ot(this,Mr),it=Ot(this,In),st=Ot(this,qn),ct=o!==rt?o.state:Ot(this,ao),{state:lt}=o;let dt={...lt},ht=!1,mt;if(tt._optimisticResults){const kt=this.hasListeners(),It=!kt&&shouldFetchOnMount(o,tt),Nt=kt&&shouldFetchOptionally(o,rt,tt,nt);(It||Nt)&&(dt={...dt,...fetchState(lt.data,o.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:ft,errorUpdatedAt:pt,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Ot(this,co))mt=Ot(this,Kn);else try{lr(this,co,tt.select),mt=tt.select(dt.data),mt=replaceData(ot==null?void 0:ot.data,mt,tt),lr(this,Kn,mt),lr(this,Xr,null)}catch(kt){lr(this,Xr,kt)}else mt=dt.data;if(tt.placeholderData!==void 0&&mt===void 0&&yt==="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=Ot(this,Qn))==null?void 0:At.state.data,Ot(this,Qn)):tt.placeholderData,tt.select&&kt!==void 0)try{kt=tt.select(kt),lr(this,Xr,null)}catch(It){lr(this,Xr,It)}kt!==void 0&&(yt="success",mt=replaceData(ot==null?void 0:ot.data,kt,tt),ht=!0)}Ot(this,Xr)&&(ft=Ot(this,Xr),mt=Ot(this,Kn),pt=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",bt=yt==="pending",xt=yt==="error",vt=bt&>,Et=mt!==void 0,St={status:yt,fetchStatus:dt.fetchStatus,isPending:bt,isSuccess:yt==="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:gt,isRefetching:gt&&!bt,isLoadingError:xt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:xt&&Et,isStale:isStale(o,tt),refetch:this.refetch,promise:Ot(this,bn)};if(this.options.experimental_prefetchInRender){const kt=Lt=>{St.status==="error"?Lt.reject(St.error):St.data!==void 0&&Lt.resolve(St.data)},It=()=>{const Lt=lr(this,bn,St.promise=pendingThenable());kt(Lt)},Nt=Ot(this,bn);switch(Nt.status){case"pending":o.queryHash===rt.queryHash&&kt(Nt);break;case"fulfilled":(St.status==="error"||St.data!==Nt.value)&&It();break;case"rejected":(St.status!=="error"||St.error!==Nt.reason)&&It();break}}return St}updateResult(o){const tt=Ot(this,Mr),rt=this.createResult(Ot(this,Cr),this.options);if(lr(this,In,Ot(this,Cr).state),lr(this,qn,this.options),Ot(this,In).data!==void 0&&lr(this,Qn,Ot(this,Cr)),shallowEqualObjects(rt,tt))return;lr(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&&!Ot(this,Xn).size)return!0;const at=new Set(st??Ot(this,Xn));return this.options.throwOnError&&at.add("error"),Object.keys(Ot(this,Mr)).some(ct=>{const lt=ct;return Ot(this,Mr)[lt]!==tt[lt]&&at.has(lt)})};(o==null?void 0:o.listeners)!==!1&&ot()&&(nt.listeners=!0),mr(this,Rr,tu).call(this,{...nt,...o})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&mr(this,Rr,js).call(this)}},Br=new WeakMap,Cr=new WeakMap,ao=new WeakMap,Mr=new WeakMap,In=new WeakMap,qn=new WeakMap,bn=new WeakMap,Xr=new WeakMap,co=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Pn=new WeakMap,jn=new WeakMap,yn=new WeakMap,Xn=new WeakMap,Rr=new WeakSet,oo=function(o){mr(this,Rr,Ls).call(this);let tt=Ot(this,Cr).fetch(this.options,o);return o!=null&&o.throwOnError||(tt=tt.catch(noop$4)),tt},Ts=function(){mr(this,Rr,Ns).call(this);const o=resolveStaleTime(this.options.staleTime,Ot(this,Cr));if(isServer||Ot(this,Mr).isStale||!isValidTimeout(o))return;const rt=timeUntilStale(Ot(this,Mr).dataUpdatedAt,o)+1;lr(this,Pn,setTimeout(()=>{Ot(this,Mr).isStale||this.updateResult()},rt))},Is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Ot(this,Cr)):this.options.refetchInterval)??!1},Ps=function(o){mr(this,Rr,Ds).call(this),lr(this,yn,o),!(isServer||resolveEnabled(this.options.enabled,Ot(this,Cr))===!1||!isValidTimeout(Ot(this,yn))||Ot(this,yn)===0)&&lr(this,jn,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&mr(this,Rr,oo).call(this)},Ot(this,yn)))},js=function(){mr(this,Rr,Ts).call(this),mr(this,Rr,Ps).call(this,mr(this,Rr,Is).call(this))},Ns=function(){Ot(this,Pn)&&(clearTimeout(Ot(this,Pn)),lr(this,Pn,void 0))},Ds=function(){Ot(this,jn)&&(clearInterval(Ot(this,jn)),lr(this,jn,void 0))},Ls=function(){const o=Ot(this,Br).getQueryCache().build(Ot(this,Br),this.options);if(o===Ot(this,Cr))return;const tt=Ot(this,Cr);lr(this,Cr,o),lr(this,ao,o.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),o.addObserver(this))},tu=function(o){notifyManager.batch(()=>{o.listeners&&this.listeners.forEach(tt=>{tt(Ot(this,Mr))}),Ot(this,Br).getQueryCache().notify({query:Ot(this,Cr),type:"observerResultsUpdated"})})},Xs);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,Jo,Os,Ys,MutationObserver$1=(Ys=class extends Subscribable{constructor(tt,rt){super();fr(this,ln);fr(this,xn);fr(this,vn);fr(this,Fr);fr(this,sn);lr(this,xn,tt),this.setOptions(rt),this.bindMethods(),mr(this,ln,Jo).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=Ot(this,xn).defaultMutationOptions(tt),shallowEqualObjects(this.options,rt)||Ot(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Ot(this,Fr),observer:this}),rt!=null&&rt.mutationKey&&this.options.mutationKey&&hashKey(rt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((nt=Ot(this,Fr))==null?void 0:nt.state.status)==="pending"&&Ot(this,Fr).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Ot(this,Fr))==null||tt.removeObserver(this)}onMutationUpdate(tt){mr(this,ln,Jo).call(this),mr(this,ln,Os).call(this,tt)}getCurrentResult(){return Ot(this,vn)}reset(){var tt;(tt=Ot(this,Fr))==null||tt.removeObserver(this),lr(this,Fr,void 0),mr(this,ln,Jo).call(this),mr(this,ln,Os).call(this)}mutate(tt,rt){var nt;return lr(this,sn,rt),(nt=Ot(this,Fr))==null||nt.removeObserver(this),lr(this,Fr,Ot(this,xn).getMutationCache().build(Ot(this,xn),this.options)),Ot(this,Fr).addObserver(this),Ot(this,Fr).execute(tt)}},xn=new WeakMap,vn=new WeakMap,Fr=new WeakMap,sn=new WeakMap,ln=new WeakSet,Jo=function(){var rt;const tt=((rt=Ot(this,Fr))==null?void 0:rt.state)??getDefaultState();lr(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(Ot(this,sn)&&this.hasListeners()){const dt=Ot(this,vn).variables,ht=Ot(this,vn).context;(tt==null?void 0:tt.type)==="success"?((nt=(rt=Ot(this,sn)).onSuccess)==null||nt.call(rt,tt.data,dt,ht),(it=(ot=Ot(this,sn)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Ot(this,sn)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Ot(this,sn)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Ot(this,vn))})})},Ys);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:yt,getNextPageParam:gt,initialPageParam:bt,_optimisticResults:xt,enabled:vt,notifyOnChangeProps:Et,placeholderData:Ct,refetchInterval:St,refetchIntervalInBackground:At,refetchOnMount:kt,refetchOnReconnect:It,refetchOnWindowFocus:Nt,retryOnMount:Lt,select:Mt,staleTime:zt,suspense:Ut,throwOnError:Xt,config:Wt,connector:Ft,query:qt,...Pt}=et;return Pt}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 yt=nt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),yt},[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-DrKwSPd8.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 yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(mt=st==null?void 0:st.rpcUrls)!=null&&mt.length?gt=st.rpcUrls:gt=[((ft=ct.rpcUrls.default)==null?void 0:ft.http[0])??""];const bt={blockExplorerUrls:yt,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:gt};return await lt.request({method:"wallet_addEthereumChain",params:[bt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}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-CT_b5y6n.js").then(yt=>yt.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(yt=>yt.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(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(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:gt,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(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},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-DbFRd9te.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-DY_rTz6S.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 yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((ft=dt.storage)==null?void 0:ft.getItem("state"))??{};dt.chains.some(St=>St.id===Et.chainId)?gt=Et.chainId:gt=(pt=dt.chains[0])==null?void 0:pt.id}if(!gt)throw new Error("No chains found on connector.");const bt=await this.isChainsStale();if(yt.session&&bt&&await yt.disconnect(),!yt.session||bt){const Et=dt.chains.filter(Ct=>Ct.id!==gt).map(Ct=>Ct.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in mt?{pairingTopic:mt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(Ct=>Ct.id))}const xt=(await yt.enable()).map(Et=>getAddress(Et)),vt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:xt,chainId:vt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},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(gt=>gt.id);if(!pt.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-Bushv2uZ.js");return{EthereumProvider:gt}},__vite__mapDeps([6,2,3]));return await yt.init({...et,disableProviderPing:!0,optionalChains:pt,projectId:et.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[bt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.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 yt,gt,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=(yt=pt.blockExplorers)!=null&&yt.default.url?[(gt=pt.blockExplorers)==null?void 0:gt.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(yt=>Number.parseInt(yt.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 define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(et,o,tt){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.length=0;st--)(it=et[st])&&(ot=(nt<3?it(ot):nt>3?it(o,tt,ot):it(o,tt))||ot);return nt>3&&ot&&Object.defineProperty(o,tt,ot),ot}function __param(et,o){return function(tt,rt){o(tt,rt,et)}}function __esDecorate(et,o,tt,rt,nt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=rt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!o&&et?rt.static?et:et.prototype:null,lt=o||(ct?Object.getOwnPropertyDescriptor(ct,rt.name):{}),dt,ht=!1,mt=tt.length-1;mt>=0;mt--){var ft={};for(var pt in rt)ft[pt]=pt==="access"?{}:rt[pt];for(var pt in rt.access)ft.access[pt]=rt.access[pt];ft.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[mt])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],ft);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&nt.unshift(dt)}else(dt=it(yt))&&(st==="field"?nt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,rt.name,lt),ht=!0}function __runInitializers(et,o,tt){for(var rt=arguments.length>2,nt=0;nt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=et.length&&(et=void 0),{value:et&&et[rt++],done:!et}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(et,o){var tt=typeof Symbol=="function"&&et[Symbol.iterator];if(!tt)return et;var rt=tt.call(et),nt,ot=[],it;try{for(;(o===void 0||o-- >0)&&!(nt=rt.next()).done;)ot.push(nt.value)}catch(st){it={error:st}}finally{try{nt&&!nt.done&&(tt=rt.return)&&tt.call(rt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var et=[],o=0;o1||at(mt,pt)})},ft&&(nt[mt]=ft(nt[mt])))}function at(mt,ft){try{ct(rt[mt](ft))}catch(pt){ht(ot[0][3],pt)}}function ct(mt){mt.value instanceof __await?Promise.resolve(mt.value.v).then(lt,dt):ht(ot[0][2],mt)}function lt(mt){at("next",mt)}function dt(mt){at("throw",mt)}function ht(mt,ft){mt(ft),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(et){var o,tt;return o={},rt("next"),rt("throw",function(nt){throw nt}),rt("return"),o[Symbol.iterator]=function(){return this},o;function rt(nt,ot){o[nt]=et[nt]?function(it){return(tt=!tt)?{value:__await(et[nt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(et){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=et[Symbol.asyncIterator],tt;return o?o.call(et):(et=typeof __values=="function"?__values(et):et[Symbol.iterator](),tt={},rt("next"),rt("throw"),rt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function rt(ot){tt[ot]=et[ot]&&function(it){return new Promise(function(st,at){it=et[ot](it),nt(st,at,it.done,it.value)})}}function nt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(et,o){return Object.defineProperty?Object.defineProperty(et,"raw",{value:o}):et.raw=o,et}var __setModuleDefault=Object.create?function(et,o){Object.defineProperty(et,"default",{enumerable:!0,value:o})}:function(et,o){et.default=o};function __importStar(et){if(et&&et.__esModule)return et;var o={};if(et!=null)for(var tt in et)tt!=="default"&&Object.prototype.hasOwnProperty.call(et,tt)&&__createBinding(o,et,tt);return __setModuleDefault(o,et),o}function __importDefault$1(et){return et&&et.__esModule?et:{default:et}}function __classPrivateFieldGet(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)}function __classPrivateFieldSet(et,o,tt,rt,nt){if(rt==="m")throw new TypeError("Private method is not writable");if(rt==="a"&&!nt)throw new TypeError("Private accessor was defined without a setter");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 rt==="a"?nt.call(et,tt):nt?nt.value=tt:o.set(et,tt),tt}function __classPrivateFieldIn(et,o){if(o===null||typeof o!="object"&&typeof o!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof et=="function"?o===et:et.has(o)}function __addDisposableResource(et,o,tt){if(o!=null){if(typeof o!="object"&&typeof o!="function")throw new TypeError("Object expected.");var rt,nt;if(tt){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");rt=o[Symbol.asyncDispose]}if(rt===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");rt=o[Symbol.dispose],tt&&(nt=rt)}if(typeof rt!="function")throw new TypeError("Object not disposable.");nt&&(rt=function(){try{nt.call(this)}catch(ot){return Promise.reject(ot)}}),et.stack.push({value:o,dispose:rt,async:tt})}else tt&&et.stack.push({async:!0});return o}var _SuppressedError=typeof SuppressedError=="function"?SuppressedError:function(et,o,tt){var rt=new Error(tt);return rt.name="SuppressedError",rt.error=et,rt.suppressed=o,rt};function __disposeResources(et){function o(ot){et.error=et.hasError?new _SuppressedError(ot,et.error,"An error was suppressed during disposal."):ot,et.hasError=!0}var tt,rt=0;function nt(){for(;tt=et.stack.pop();)try{if(!tt.async&&rt===1)return rt=0,et.stack.push(tt),Promise.resolve().then(nt);if(tt.dispose){var ot=tt.dispose.call(tt.value);if(tt.async)return rt|=2,Promise.resolve(ot).then(nt,function(it){return o(it),nt()})}else rt|=1}catch(it){o(it)}if(rt===1)return et.hasError?Promise.reject(et.error):Promise.resolve();if(et.hasError)throw et.error}return nt()}function __rewriteRelativeImportExtension(et,o){return typeof et=="string"&&/^\.\.?\//.test(et)?et.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(tt,rt,nt,ot,it){return rt?o?".jsx":".js":nt&&(!ot||!it)?tt:nt+ot+"."+it.toLowerCase()+"js"}):et}const tslib_es6={__extends,__assign,__rest,__decorate,__param,__esDecorate,__runInitializers,__propKey,__setFunctionName,__metadata,__awaiter,__generator,__createBinding,__exportStar,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault:__importDefault$1,__classPrivateFieldGet,__classPrivateFieldSet,__classPrivateFieldIn,__addDisposableResource,__disposeResources,__rewriteRelativeImportExtension},tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter,__classPrivateFieldGet,__classPrivateFieldIn,__classPrivateFieldSet,__createBinding,__decorate,__disposeResources,__esDecorate,__exportStar,__extends,__generator,__importDefault:__importDefault$1,__importStar,__makeTemplateObject,__metadata,__param,__propKey,__read,__rest,__rewriteRelativeImportExtension,__runInitializers,__setFunctionName,__spread,__spreadArray,__spreadArrays,__values,default:tslib_es6},Symbol.toStringTag,{value:"Module"}));var define_process_default$2={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},define_process_env_default$1={},defaultEnvironment="production",env$1=typeof define_process_default$2>"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(et){return{isEnabled:function(o){return et.some(function(tt){return!!o[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(et){for(var o in et)et[o]!==null&&(o==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=et[o]:featureDefinitions[o].Component=et[o])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(et,o,tt){var rt=[],nt=reactExports.useContext(LazyContext);if(!o)return null;env$1!=="production"&&tt&&nt.strict;for(var ot=0;ot"u")return o;var tt=new Map;return new Proxy(o,{get:function(rt,nt){return tt.has(nt)||tt.set(nt,o(nt)),tt.get(nt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(et){return typeof et!="string"||et.includes("-")?!1:!!(lowercaseSVGElements.indexOf(et)>-1||/[A-Z]/.test(et))}var scaleCorrectors={};function addScaleCorrector(et){Object.assign(scaleCorrectors,et)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(et){return transformAxes.forEach(function(o){return transformProps.push(et+o)})});function sortTransformProps(et,o){return transformProps.indexOf(et)-transformProps.indexOf(o)}var transformPropSet=new Set(transformProps);function isTransformProp(et){return transformPropSet.has(et)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(et){return transformOriginProps.has(et)}function isForcedMotionValue(et,o){var tt=o.layout,rt=o.layoutId;return isTransformProp(et)||isTransformOriginProp(et)||(tt||rt!==void 0)&&(!!scaleCorrectors[et]||et==="opacity")}var isMotionValue=function(et){return!!(et!==null&&typeof et=="object"&&et.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(et,o,tt,rt){var nt=et.transform,ot=et.transformKeys,it=o.enableHardwareAcceleration,st=it===void 0?!0:it,at=o.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,mt=0;mttt=>Math.max(Math.min(tt,o),et),sanitize=et=>et%1?Number(et.toFixed(5)):et,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(et){return typeof et=="string"}const number$3={test:et=>typeof et=="number",parse:parseFloat,transform:et=>et},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=et=>({test:o=>isString(o)&&o.endsWith(et)&&o.split(" ").length===1,parse:parseFloat,transform:o=>`${o}${et}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:et=>percent.parse(et)/100,transform:et=>percent.transform(et*100)}),isColorString=(et,o)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(et)||o&&Object.prototype.hasOwnProperty.call(tt,o)),splitColor=(et,o,tt)=>rt=>{if(!isString(rt))return rt;const[nt,ot,it,st]=rt.match(floatRegex);return{[et]:parseFloat(nt),[o]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:et,saturation:o,lightness:tt,alpha:rt=1})=>"hsla("+Math.round(et)+", "+percent.transform(sanitize(o))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(rt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:et=>Math.round(clampRgbUnit(et))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:et,green:o,blue:tt,alpha:rt=1})=>"rgba("+rgbUnit.transform(et)+", "+rgbUnit.transform(o)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(rt))+")"};function parseHex(et){let o="",tt="",rt="",nt="";return et.length>5?(o=et.substr(1,2),tt=et.substr(3,2),rt=et.substr(5,2),nt=et.substr(7,2)):(o=et.substr(1,1),tt=et.substr(2,1),rt=et.substr(3,1),nt=et.substr(4,1),o+=o,tt+=tt,rt+=rt,nt+=nt),{red:parseInt(o,16),green:parseInt(tt,16),blue:parseInt(rt,16),alpha:nt?parseInt(nt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:et=>rgba.test(et)||hex.test(et)||hsla.test(et),parse:et=>rgba.test(et)?rgba.parse(et):hsla.test(et)?hsla.parse(et):hex.parse(et),transform:et=>isString(et)?et:et.hasOwnProperty("red")?rgba.transform(et):hsla.transform(et)},colorToken="${c}",numberToken="${n}";function test(et){var o,tt,rt,nt;return isNaN(et)&&isString(et)&&((tt=(o=et.match(floatRegex))===null||o===void 0?void 0:o.length)!==null&&tt!==void 0?tt:0)+((nt=(rt=et.match(colorRegex))===null||rt===void 0?void 0:rt.length)!==null&&nt!==void 0?nt:0)>0}function analyse$1(et){typeof et=="number"&&(et=`${et}`);const o=[];let tt=0;const rt=et.match(colorRegex);rt&&(tt=rt.length,et=et.replace(colorRegex,colorToken),o.push(...rt.map(color$1.parse)));const nt=et.match(floatRegex);return nt&&(et=et.replace(floatRegex,numberToken),o.push(...nt.map(number$3.parse))),{values:o,numColors:tt,tokenised:et}}function parse$4(et){return analyse$1(et).values}function createTransformer(et){const{values:o,numColors:tt,tokenised:rt}=analyse$1(et),nt=o.length;return ot=>{let it=rt;for(let st=0;sttypeof et=="number"?0:et;function getAnimatableNone$1(et){const o=parse$4(et);return createTransformer(et)(o.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(et){let[o,tt]=et.slice(0,-1).split("(");if(o==="drop-shadow")return et;const[rt]=tt.match(floatRegex)||[];if(!rt)return et;const nt=tt.replace(rt,"");let ot=maxDefaults.has(o)?1:0;return rt!==tt&&(ot*=100),o+"("+ot+nt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:et=>{const o=et.match(functionRegex);return o?o.map(applyDefaultFilter).join(" "):et}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(et,o,tt,rt){var nt,ot=et.style,it=et.vars,st=et.transform,at=et.transformKeys,ct=et.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var mt in o){var ft=o[mt];if(isCSSVariable$1(mt)){it[mt]=ft;continue}var pt=numberValueTypes[mt],yt=getValueAsType(ft,pt);if(isTransformProp(mt)){if(lt=!0,st[mt]=yt,at.push(mt),!ht)continue;ft!==((nt=pt.default)!==null&&nt!==void 0?nt:0)&&(ht=!1)}else isTransformOriginProp(mt)?(ct[mt]=yt,dt=!0):ot[mt]=yt}lt?ot.transform=buildTransform(et,tt,ht,rt):rt?ot.transform=rt({},""):!o.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(et,o,tt){for(var rt in o)!isMotionValue(o[rt])&&!isForcedMotionValue(rt,tt)&&(et[rt]=o[rt])}function useInitialMotionValues(et,o,tt){var rt=et.transformTemplate;return reactExports.useMemo(function(){var nt=createHtmlRenderState();buildHTMLStyles(nt,o,{enableHardwareAcceleration:!tt},rt);var ot=nt.vars,it=nt.style;return __assign(__assign({},ot),it)},[o])}function useStyle(et,o,tt){var rt=et.style||{},nt={};return copyRawValuesOnly(nt,rt,et),Object.assign(nt,useInitialMotionValues(et,o,tt)),et.transformValues&&(nt=et.transformValues(nt)),nt}function useHTMLProps(et,o,tt){var rt={},nt=useStyle(et,o,tt);return et.drag&&et.dragListener!==!1&&(rt.draggable=!1,nt.userSelect=nt.WebkitUserSelect=nt.WebkitTouchCallout="none",nt.touchAction=et.drag===!0?"none":"pan-".concat(et.drag==="x"?"y":"x")),rt.style=nt,rt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(et){return validMotionProps.has(et)}var shouldForward=function(et){return!isValidMotionProp(et)};function loadExternalIsValidProp(et){et&&(shouldForward=function(o){return o.startsWith("on")?!isValidMotionProp(o):et(o)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(et,o,tt){var rt={};for(var nt in et)(shouldForward(nt)||tt===!0&&isValidMotionProp(nt)||!o&&!isValidMotionProp(nt)||et.draggable&&nt.startsWith("onDrag"))&&(rt[nt]=et[nt]);return rt}function calcOrigin$1(et,o,tt){return typeof et=="string"?et:px.transform(o+tt*et)}function calcSVGTransformOrigin(et,o,tt){var rt=calcOrigin$1(o,et.x,et.width),nt=calcOrigin$1(tt,et.y,et.height);return"".concat(rt," ").concat(nt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(et,o,tt,rt,nt){tt===void 0&&(tt=1),rt===void 0&&(rt=0),et.pathLength=1;var ot=camelKeys;et[ot.offset]=px.transform(-rt);var it=px.transform(o),st=px.transform(tt);et[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(et,o,tt,rt){var nt=o.attrX,ot=o.attrY,it=o.originX,st=o.originY,at=o.pathLength,ct=o.pathSpacing,lt=ct===void 0?1:ct,dt=o.pathOffset,ht=dt===void 0?0:dt,mt=__rest(o,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(et,mt,tt,rt),et.attrs=et.style,et.style={};var ft=et.attrs,pt=et.style,yt=et.dimensions;ft.transform&&(yt&&(pt.transform=ft.transform),delete ft.transform),yt&&(it!==void 0||st!==void 0||pt.transform)&&(pt.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),nt!==void 0&&(ft.x=nt),ot!==void 0&&(ft.y=ot),at!==void 0&&buildSVGPath(ft,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(et,o){var tt=reactExports.useMemo(function(){var nt=createSvgRenderState();return buildSVGAttrs(nt,o,{enableHardwareAcceleration:!1},et.transformTemplate),__assign(__assign({},nt.attrs),{style:__assign({},nt.style)})},[o]);if(et.style){var rt={};copyRawValuesOnly(rt,et.style,et),tt.style=__assign(__assign({},rt),tt.style)}return tt}function createUseRender(et){et===void 0&&(et=!1);var o=function(tt,rt,nt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(rt,at,st),dt=filterProps(rt,typeof tt=="string",et),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return nt&&(ht["data-projection-id"]=nt),reactExports.createElement(tt,ht)};return o}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(et){return et.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(et,o,tt,rt){var nt=o.style,ot=o.vars;Object.assign(et.style,nt,rt&&rt.getProjectionStyles(tt));for(var it in ot)et.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(et,o,tt,rt){renderHTML(et,o,void 0,rt);for(var nt in o.attrs)et.setAttribute(camelCaseAttributes.has(nt)?nt:camelToDash(nt),o.attrs[nt])}function scrapeMotionValuesFromProps$1(et){var o=et.style,tt={};for(var rt in o)(isMotionValue(o[rt])||isForcedMotionValue(rt,et))&&(tt[rt]=o[rt]);return tt}function scrapeMotionValuesFromProps(et){var o=scrapeMotionValuesFromProps$1(et);for(var tt in et)if(isMotionValue(et[tt])){var rt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;o[rt]=et[tt]}return o}function isAnimationControls(et){return typeof et=="object"&&typeof et.start=="function"}var isKeyframesTarget=function(et){return Array.isArray(et)},isCustomValue=function(et){return!!(et&&typeof et=="object"&&et.mix&&et.toValue)},resolveFinalValueInKeyframes=function(et){return isKeyframesTarget(et)?et[et.length-1]||0:et};function resolveMotionValue(et){var o=isMotionValue(et)?et.get():et;return isCustomValue(o)?o.toValue():o}function makeState(et,o,tt,rt){var nt=et.scrapeMotionValuesFromProps,ot=et.createRenderState,it=et.onMount,st={latestValues:makeLatestValues(o,tt,rt,nt),renderState:ot()};return it&&(st.mount=function(at){return it(o,at,st)}),st}var makeUseVisualState=function(et){return function(o,tt){var rt=reactExports.useContext(MotionContext),nt=reactExports.useContext(PresenceContext);return tt?makeState(et,o,rt,nt):useConstant(function(){return makeState(et,o,rt,nt)})}};function makeLatestValues(et,o,tt,rt){var nt={},ot=(tt==null?void 0:tt.initial)===!1,it=rt(et);for(var st in it)nt[st]=resolveMotionValue(it[st]);var at=et.initial,ct=et.animate,lt=checkIfControllingVariants(et),dt=checkIfVariantNode(et);o&&dt&&!lt&&et.inherit!==!1&&(at??(at=o.initial),ct??(ct=o.animate));var ht=ot||at===!1,mt=ht?ct:at;if(mt&&typeof mt!="boolean"&&!isAnimationControls(mt)){var ft=Array.isArray(mt)?mt:[mt];ft.forEach(function(pt){var yt=resolveVariantFromProps(et,pt);if(yt){var gt=yt.transitionEnd;yt.transition;var bt=__rest(yt,["transitionEnd","transition"]);for(var xt in bt){var vt=bt[xt];if(Array.isArray(vt)){var Et=ht?vt.length-1:0;vt=vt[Et]}vt!==null&&(nt[xt]=vt)}for(var xt in gt)nt[xt]=gt[xt]}})}return nt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(et,o,tt){var rt=tt.renderState,nt=tt.latestValues;try{rt.dimensions=typeof o.getBBox=="function"?o.getBBox():o.getBoundingClientRect()}catch{rt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(rt,nt,{enableHardwareAcceleration:!1},et.transformTemplate),renderSVG(o,rt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(et,o,tt,rt,nt){var ot=o.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(et)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:rt,projectionNodeConstructor:nt,Component:et})}var AnimationType;(function(et){et.Animate="animate",et.Hover="whileHover",et.Tap="whileTap",et.Drag="whileDrag",et.Focus="whileFocus",et.InView="whileInView",et.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(et,o,tt,rt){return rt===void 0&&(rt={passive:!0}),et.addEventListener(o,tt,rt),function(){return et.removeEventListener(o,tt)}}function useDomEvent(et,o,tt,rt){reactExports.useEffect(function(){var nt=et.current;if(tt&&nt)return addDomEvent(nt,o,tt,rt)},[et,o,tt,rt])}function useFocusGesture(et){var o=et.whileFocus,tt=et.visualElement,rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",o?rt:void 0),useDomEvent(tt,"blur",o?nt:void 0)}function isMouseEvent(et){return typeof PointerEvent<"u"&&et instanceof PointerEvent?et.pointerType==="mouse":et instanceof MouseEvent}function isTouchEvent(et){var o=!!et.touches;return o}function filterPrimaryPointer(et){return function(o){var tt=o instanceof MouseEvent,rt=!tt||tt&&o.button===0;rt&&et(o)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(et,o){o===void 0&&(o="page");var tt=et.touches[0]||et.changedTouches[0],rt=tt||defaultPagePoint;return{x:rt[o+"X"],y:rt[o+"Y"]}}function pointFromMouse(et,o){return o===void 0&&(o="page"),{x:et[o+"X"],y:et[o+"Y"]}}function extractEventInfo(et,o){return o===void 0&&(o="page"),{point:isTouchEvent(et)?pointFromTouch(et,o):pointFromMouse(et,o)}}var wrapHandler=function(et,o){o===void 0&&(o=!1);var tt=function(rt){return et(rt,extractEventInfo(rt))};return o?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(et){return supportsPointerEvents()?et:supportsTouchEvents()?touchEventNames[et]:supportsMouseEvents()?mouseEventNames[et]:et}function addPointerEvent(et,o,tt,rt){return addDomEvent(et,getPointerEventName(o),wrapHandler(tt,o==="pointerdown"),rt)}function usePointerEvent(et,o,tt,rt){return useDomEvent(et,getPointerEventName(o),tt&&wrapHandler(tt,o==="pointerdown"),rt)}function createLock(et){var o=null;return function(){var tt=function(){o=null};return o===null?(o=et,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(et){var o=!1;if(et==="y")o=globalVerticalLock();else if(et==="x")o=globalHorizontalLock();else{var tt=globalHorizontalLock(),rt=globalVerticalLock();tt&&rt?o=function(){tt(),rt()}:(tt&&tt(),rt&&rt())}return o}function isDragActive(){var et=getGlobalLock(!0);return et?(et(),!1):!0}function createHoverEvent(et,o,tt){return function(rt,nt){var ot;!isMouseEvent(rt)||isDragActive()||((ot=et.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,o),tt==null||tt(rt,nt))}}function useHoverGesture(et){var o=et.onHoverStart,tt=et.onHoverEnd,rt=et.whileHover,nt=et.visualElement;usePointerEvent(nt,"pointerenter",o||rt?createHoverEvent(nt,!0,o):void 0,{passive:!o}),usePointerEvent(nt,"pointerleave",tt||rt?createHoverEvent(nt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(et,o){return o?et===o?!0:isNodeOrChild(et,o.parentElement):!1};function useUnmountEffect(et){return reactExports.useEffect(function(){return function(){return et()}},[])}const clamp$1=(et,o,tt)=>Math.min(Math.max(tt,et),o),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:et=800,bounce:o=.25,velocity:tt=0,mass:rt=1}){let nt,ot,it=1-o;it=clamp$1(minDamping,maxDamping,it),et=clamp$1(minDuration,maxDuration,et/1e3),it<1?(nt=ct=>{const lt=ct*it,dt=lt*et,ht=lt-tt,mt=calcAngularFreq(ct,it),ft=Math.exp(-dt);return safeMin-ht/mt*ft},ot=ct=>{const dt=ct*it*et,ht=dt*tt+tt,mt=Math.pow(it,2)*Math.pow(ct,2)*et,ft=Math.exp(-dt),pt=calcAngularFreq(Math.pow(ct,2),it);return(-nt(ct)+safeMin>0?-1:1)*((ht-mt)*ft)/pt}):(nt=ct=>{const lt=Math.exp(-ct*et),dt=(ct-tt)*et+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*et),dt=(tt-ct)*(et*et);return lt*dt});const st=5/et,at=approximateRoot(nt,ot,st);if(et=et*1e3,isNaN(at))return{stiffness:100,damping:10,duration:et};{const ct=Math.pow(at,2)*rt;return{stiffness:ct,damping:it*2*Math.sqrt(rt*ct),duration:et}}}const rootIterations=12;function approximateRoot(et,o,tt){let rt=tt;for(let nt=1;ntet[tt]!==void 0)}function getSpringOptions(et){let o=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},et);if(!isSpringType(et,physicsKeys)&&isSpringType(et,durationKeys)){const tt=findSpring(et);o=Object.assign(Object.assign(Object.assign({},o),tt),{velocity:0,mass:1}),o.isResolvedFromDuration=!0}return o}function spring(et){var{from:o=0,to:tt=1,restSpeed:rt=2,restDelta:nt}=et,ot=__rest(et,["from","to","restSpeed","restDelta"]);const it={done:!1,value:o};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),mt=zero$1,ft=zero$1;function pt(){const yt=lt?-(lt/1e3):0,gt=tt-o,bt=at/(2*Math.sqrt(st*ct)),xt=Math.sqrt(st/ct)/1e3;if(nt===void 0&&(nt=Math.min(Math.abs(tt-o)/100,.4)),bt<1){const vt=calcAngularFreq(xt,bt);mt=Et=>{const Ct=Math.exp(-bt*xt*Et);return tt-Ct*((yt+bt*xt*gt)/vt*Math.sin(vt*Et)+gt*Math.cos(vt*Et))},ft=Et=>{const Ct=Math.exp(-bt*xt*Et);return bt*xt*Ct*(Math.sin(vt*Et)*(yt+bt*xt*gt)/vt+gt*Math.cos(vt*Et))-Ct*(Math.cos(vt*Et)*(yt+bt*xt*gt)-vt*gt*Math.sin(vt*Et))}}else if(bt===1)mt=vt=>tt-Math.exp(-xt*vt)*(gt+(yt+xt*gt)*vt);else{const vt=xt*Math.sqrt(bt*bt-1);mt=Et=>{const Ct=Math.exp(-bt*xt*Et),St=Math.min(vt*Et,300);return tt-Ct*((yt+bt*xt*gt)*Math.sinh(St)+vt*gt*Math.cosh(St))/vt}}}return pt(),{next:yt=>{const gt=mt(yt);if(ht)it.done=yt>=dt;else{const bt=ft(yt)*1e3,xt=Math.abs(bt)<=rt,vt=Math.abs(tt-gt)<=nt;it.done=xt&&vt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[o,tt]=[tt,o],pt()}}}spring.needsInterpolation=(et,o)=>typeof et=="string"||typeof o=="string";const zero$1=et=>0,progress=(et,o,tt)=>{const rt=o-et;return rt===0?1:(tt-et)/rt},mix=(et,o,tt)=>-tt*et+tt*o+et;function hueToRgb(et,o,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?et+(o-et)*6*tt:tt<1/2?o:tt<2/3?et+(o-et)*(2/3-tt)*6:et}function hslaToRgba({hue:et,saturation:o,lightness:tt,alpha:rt}){et/=360,o/=100,tt/=100;let nt=0,ot=0,it=0;if(!o)nt=ot=it=tt;else{const st=tt<.5?tt*(1+o):tt+o-tt*o,at=2*tt-st;nt=hueToRgb(at,st,et+1/3),ot=hueToRgb(at,st,et),it=hueToRgb(at,st,et-1/3)}return{red:Math.round(nt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:rt}}const mixLinearColor=(et,o,tt)=>{const rt=et*et,nt=o*o;return Math.sqrt(Math.max(0,tt*(nt-rt)+rt))},colorTypes=[hex,rgba,hsla],getColorType=et=>colorTypes.find(o=>o.test(et)),mixColor=(et,o)=>{let tt=getColorType(et),rt=getColorType(o),nt=tt.parse(et),ot=rt.parse(o);tt===hsla&&(nt=hslaToRgba(nt),tt=rgba),rt===hsla&&(ot=hslaToRgba(ot),rt=rgba);const it=Object.assign({},nt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(nt[at],ot[at],st));return it.alpha=mix(nt.alpha,ot.alpha,st),tt.transform(it)}},isNum=et=>typeof et=="number",combineFunctions=(et,o)=>tt=>o(et(tt)),pipe$1=(...et)=>et.reduce(combineFunctions);function getMixer(et,o){return isNum(et)?tt=>mix(et,o,tt):color$1.test(et)?mixColor(et,o):mixComplex(et,o)}const mixArray=(et,o)=>{const tt=[...et],rt=tt.length,nt=et.map((ot,it)=>getMixer(ot,o[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},et),o),rt={};for(const nt in tt)et[nt]!==void 0&&o[nt]!==void 0&&(rt[nt]=getMixer(et[nt],o[nt]));return nt=>{for(const ot in rt)tt[ot]=rt[ot](nt);return tt}};function analyse(et){const o=complex.parse(et),tt=o.length;let rt=0,nt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(o),rt=analyse(et),nt=analyse(o);return rt.numHSL===nt.numHSL&&rt.numRGB===nt.numRGB&&rt.numNumbers>=nt.numNumbers?pipe$1(mixArray(rt.parsed,nt.parsed),tt):it=>`${it>0?o:et}`},mixNumber=(et,o)=>tt=>mix(et,o,tt);function detectMixerFactory(et){if(typeof et=="number")return mixNumber;if(typeof et=="string")return color$1.test(et)?mixColor:mixComplex;if(Array.isArray(et))return mixArray;if(typeof et=="object")return mixObject}function createMixers(et,o,tt){const rt=[],nt=tt||detectMixerFactory(et[0]),ot=et.length-1;for(let it=0;ittt(progress(et,o,rt))}function slowInterpolate(et,o){const tt=et.length,rt=tt-1;return nt=>{let ot=0,it=!1;if(nt<=et[0]?it=!0:nt>=et[rt]&&(ot=rt-1,it=!0),!it){let at=1;for(;atnt||at===rt);at++);ot=at-1}const st=progress(et[ot],et[ot+1],nt);return o[ot](st)}}function interpolate(et,o,{clamp:tt=!0,ease:rt,mixer:nt}={}){const ot=et.length;invariant$1(ot===o.length),invariant$1(!rt||!Array.isArray(rt)||rt.length===ot-1),et[0]>et[ot-1]&&(et=[].concat(et),o=[].concat(o),et.reverse(),o.reverse());const it=createMixers(o,rt,nt),st=ot===2?fastInterpolate(et,it):slowInterpolate(et,it);return tt?at=>st(clamp$1(et[0],et[ot-1],at)):st}const reverseEasing=et=>o=>1-et(1-o),mirrorEasing=et=>o=>o<=.5?et(2*o)/2:(2-et(2*(1-o)))/2,createExpoIn=et=>o=>Math.pow(o,et),createBackIn=et=>o=>o*o*((et+1)*o-et),createAnticipate=et=>{const o=createBackIn(et);return tt=>(tt*=2)<1?.5*o(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=et=>et,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=et=>1-Math.sin(Math.acos(et)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=et=>{if(et===1||et===0)return et;const o=et*et;return etet<.5?.5*(1-bounceOut(1-et*2)):.5*bounceOut(et*2-1)+.5;function defaultEasing(et,o){return et.map(()=>o||easeInOut).splice(0,et.length-1)}function defaultOffset(et){const o=et.length;return et.map((tt,rt)=>rt!==0?rt/(o-1):0)}function convertOffsetToTimes(et,o){return et.map(tt=>tt*o)}function keyframes$1({from:et=0,to:o=1,ease:tt,offset:rt,duration:nt=300}){const ot={done:!1,value:et},it=Array.isArray(o)?o:[et,o],st=convertOffsetToTimes(rt&&rt.length===it.length?rt:defaultOffset(it),nt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=nt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:et=0,from:o=0,power:tt=.8,timeConstant:rt=350,restDelta:nt=.5,modifyTarget:ot}){const it={done:!1,value:o};let st=tt*et;const at=o+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-o),{next:lt=>{const dt=-st*Math.exp(-lt/rt);return it.done=!(dt>nt||dt<-nt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(et){if(Array.isArray(et.to))return keyframes$1;if(types$3[et.type])return types$3[et.type];const o=new Set(Object.keys(et));return o.has("ease")||o.has("duration")&&!o.has("dampingRatio")?keyframes$1:o.has("dampingRatio")||o.has("stiffness")||o.has("mass")||o.has("damping")||o.has("restSpeed")||o.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?et=>window.requestAnimationFrame(et):et=>setTimeout(()=>et(getCurrentTime()),defaultTimestep);function createRenderStep(et){let o=[],tt=[],rt=0,nt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&nt,ht=dt?o:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&nt&&(rt=o.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(nt){ot=!0;return}if(nt=!0,[o,tt]=[tt,o],tt.length=0,rt=o.length,rt)for(let ct=0;ct(et[o]=createRenderStep(()=>runNextFrame=!0),et),{}),sync=stepsOrder.reduce((et,o)=>{const tt=steps[o];return et[o]=(rt,nt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(rt,nt,ot)),et},{}),cancelSync=stepsOrder.reduce((et,o)=>(et[o]=steps[o].cancel,et),{}),flushSync=stepsOrder.reduce((et,o)=>(et[o]=()=>steps[o].process(frame),et),{}),processStep=et=>steps[et].process(frame),processFrame=et=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(et-frame.timestamp,maxElapsed),1),frame.timestamp=et,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(et,o,tt=0){return et-o-tt}function reverseElapsed(et,o,tt=0,rt=!0){return rt?loopElapsed(o+-et,o,tt):o-(et-o)+tt}function hasRepeatDelayElapsed(et,o,tt,rt){return rt?et>=o+tt:et<=-tt}const framesync=et=>{const o=({delta:tt})=>et(tt);return{start:()=>sync.update(o,!0),stop:()=>cancelSync.update(o)}};function animate$1(et){var o,tt,{from:rt,autoplay:nt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:mt,onUpdate:ft}=et,pt=__rest(et,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=pt,gt,bt=0,xt=pt.duration,vt,Et=!1,Ct=!0,St;const At=detectAnimationFromOptions(pt);!((tt=(o=At).needsInterpolation)===null||tt===void 0)&&tt.call(o,rt,yt)&&(St=interpolate([0,100],[rt,yt],{clamp:!1}),rt=0,yt=100);const kt=At(Object.assign(Object.assign({},pt),{from:rt,to:yt}));function It(){bt++,at==="reverse"?(Ct=bt%2===0,it=reverseElapsed(it,xt,ct,Ct)):(it=loopElapsed(it,xt,ct),at==="mirror"&&kt.flipTarget()),Et=!1,mt&&mt()}function Nt(){gt.stop(),ht&&ht()}function Lt(zt){if(Ct||(zt=-zt),it+=zt,!Et){const Ut=kt.next(Math.max(0,it));vt=Ut.value,St&&(vt=St(vt)),Et=Ct?Ut.done:it<=0}ft==null||ft(vt),Et&&(bt===0&&(xt??(xt=it)),bt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(et,o){return o?et*(1e3/o):0}function inertia({from:et=0,velocity:o=0,min:tt,max:rt,power:nt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:mt}){let ft;function pt(xt){return tt!==void 0&&xtrt}function yt(xt){return tt===void 0?rt:rt===void 0||Math.abs(tt-xt){var Et;dt==null||dt(vt),(Et=xt.onUpdate)===null||Et===void 0||Et.call(xt,vt)},onComplete:ht,onStop:mt}))}function bt(xt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},xt))}if(pt(et))bt({from:et,velocity:o,to:yt(et)});else{let xt=nt*o+et;typeof ct<"u"&&(xt=ct(xt));const vt=yt(xt),Et=vt===tt?-1:1;let Ct,St;const At=kt=>{Ct=St,St=kt,o=velocityPerSecond(kt-Ct,getFrameData().delta),(Et===1&&kt>vt||Et===-1&&ktft==null?void 0:ft.stop()}}const isPoint=et=>et.hasOwnProperty("x")&&et.hasOwnProperty("y"),isPoint3D=et=>isPoint(et)&&et.hasOwnProperty("z"),distance1D=(et,o)=>Math.abs(et-o);function distance(et,o){if(isNum(et)&&isNum(o))return distance1D(et,o);if(isPoint(et)&&isPoint(o)){const tt=distance1D(et.x,o.x),rt=distance1D(et.y,o.y),nt=isPoint3D(et)&&isPoint3D(o)?distance1D(et.z,o.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(rt,2)+Math.pow(nt,2))}}const a=(et,o)=>1-3*o+3*et,b$3=(et,o)=>3*o-6*et,c$2=et=>3*et,calcBezier=(et,o,tt)=>((a(o,tt)*et+b$3(o,tt))*et+c$2(o))*et,getSlope=(et,o,tt)=>3*a(o,tt)*et*et+2*b$3(o,tt)*et+c$2(o),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(et,o,tt,rt,nt){let ot,it,st=0;do it=o+(tt-o)/2,ot=calcBezier(it,rt,nt)-et,ot>0?tt=it:o=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,et,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,et,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),o,rt)}function useTapGesture(et){var o=et.onTap,tt=et.onTapStart,rt=et.onTapCancel,nt=et.whileTap,ot=et.visualElement,it=o||tt||rt||nt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||o||rt||ft)};function lt(){var pt;(pt=at.current)===null||pt===void 0||pt.call(at),at.current=null}function dt(){var pt;return lt(),st.current=!1,(pt=ot.animationState)===null||pt===void 0||pt.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(pt,yt){dt()&&(isNodeOrChild(ot.getInstance(),pt.target)?o==null||o(pt,yt):rt==null||rt(pt,yt))}function mt(pt,yt){dt()&&(rt==null||rt(pt,yt))}function ft(pt,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",mt,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(pt,yt))}usePointerEvent(ot,"pointerdown",it?ft:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce(et,o,tt){warned.has(o)||(console.warn(o),warned.add(o))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(et){var o;(o=observerCallbacks.get(et.target))===null||o===void 0||o(et)},fireAllObserverCallbacks=function(et){et.forEach(fireObserverCallback)};function initIntersectionObserver(et){var o=et.root,tt=__rest(et,["root"]),rt=o||document;observers$1.has(rt)||observers$1.set(rt,{});var nt=observers$1.get(rt),ot=JSON.stringify(tt);return nt[ot]||(nt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:o},tt))),nt[ot]}function observeIntersection(et,o,tt){var rt=initIntersectionObserver(o);return observerCallbacks.set(et,tt),rt.observe(et),function(){observerCallbacks.delete(et),rt.unobserve(et)}}function useViewport(et){var o=et.visualElement,tt=et.whileInView,rt=et.onViewportEnter,nt=et.onViewportLeave,ot=et.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||rt||nt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,o,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(et,o,tt,rt){var nt=rt.root,ot=rt.margin,it=rt.amount,st=it===void 0?"some":it,at=rt.once;reactExports.useEffect(function(){if(et){var ct={root:nt==null?void 0:nt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,mt=dt.isIntersecting;if(o.isInView!==mt&&(o.isInView=mt,!(at&&!mt&&o.hasEnteredView))){mt&&(o.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,mt);var ft=tt.getProps(),pt=mt?ft.onViewportEnter:ft.onViewportLeave;pt==null||pt(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[et,nt,ot,st])}function useMissingIntersectionObserver(et,o,tt,rt){var nt=rt.fallback,ot=nt===void 0?!0:nt;reactExports.useEffect(function(){!et||!ot||(env$1!=="production"&&warnOnce(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;o.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[et])}var makeRenderlessComponent=function(et){return function(o){return et(o),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var et=reactExports.useContext(PresenceContext);if(et===null)return[!0,null];var o=et.isPresent,tt=et.onExitComplete,rt=et.register,nt=useId$1();reactExports.useEffect(function(){return rt(nt)},[]);var ot=function(){return tt==null?void 0:tt(nt)};return!o&&tt?[!1,ot]:[!0]}function shallowCompare(et,o){if(!Array.isArray(o))return!1;var tt=o.length;if(tt!==et.length)return!1;for(var rt=0;rt-1&&et.splice(tt,1)}var SubscriptionManager$1=function(){function et(){this.subscriptions=[]}return et.prototype.add=function(o){var tt=this;return addUniqueItem(this.subscriptions,o),function(){return removeItem(tt.subscriptions,o)}},et.prototype.notify=function(o,tt,rt){var nt=this.subscriptions.length;if(nt)if(nt===1)this.subscriptions[0](o,tt,rt);else for(var ot=0;otbt&&Nt,Xt=Array.isArray(It)?It:[It],Wt=Xt.reduce(ot,{});Lt===!1&&(Wt={});var Ft=kt.prevResolvedValues,qt=Ft===void 0?{}:Ft,Pt=__assign(__assign({},qt),Wt),Yt=function(rr){Ut=!0,yt.delete(rr),kt.needsAnimating[rr]=!0};for(var Qt in Pt){var jt=Wt[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(jt!==Gt?isKeyframesTarget(jt)&&isKeyframesTarget(Gt)?!shallowCompare(jt,Gt)||zt?Yt(Qt):kt.protectedKeys[Qt]=!0:jt!==void 0?Yt(Qt):yt.add(Qt):jt!==void 0&&yt.has(Qt)?Yt(Qt):kt.protectedKeys[Qt]=!0)}kt.prevProp=It,kt.prevResolvedValues=Wt,kt.isActive&&(gt=__assign(__assign({},gt),Wt)),nt&&et.blockInitialAnimation&&(Ut=!1),Ut&&!Mt&&pt.push.apply(pt,__spreadArray([],__read(Xt.map(function(rr){return{animation:rr,options:__assign({type:At},lt)}})),!1))},vt=0;vt=3;if(!(!mt&&!ft)){var pt=ht.point,yt=getFrameData().timestamp;nt.history.push(__assign(__assign({},pt),{timestamp:yt}));var gt=nt.handlers,bt=gt.onStart,xt=gt.onMove;mt||(bt&&bt(nt.lastMoveEvent,ht),nt.startEvent=nt.lastMoveEvent),xt&&xt(nt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,mt){if(nt.lastMoveEvent=ht,nt.lastMoveEventInfo=transformPoint(mt,nt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){nt.handlePointerUp(ht,mt);return}sync.update(nt.updatePoint,!0)},this.handlePointerUp=function(ht,mt){nt.end();var ft=nt.handlers,pt=ft.onEnd,yt=ft.onSessionEnd,gt=getPanInfo(transformPoint(mt,nt.transformPagePoint),nt.history);nt.startEvent&&pt&&pt(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(o)&&o.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(o),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(o,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return et.prototype.updateHandlers=function(o){this.handlers=o},et.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},et}();function transformPoint(et,o){return o?{point:o(et.point)}:et}function subtractPoint(et,o){return{x:et.x-o.x,y:et.y-o.y}}function getPanInfo(et,o){var tt=et.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(o)),offset:subtractPoint(tt,startDevicePoint(o)),velocity:getVelocity(o,.1)}}function startDevicePoint(et){return et[0]}function lastDevicePoint(et){return et[et.length-1]}function getVelocity(et,o){if(et.length<2)return{x:0,y:0};for(var tt=et.length-1,rt=null,nt=lastDevicePoint(et);tt>=0&&(rt=et[tt],!(nt.timestamp-rt.timestamp>secondsToMilliseconds(o)));)tt--;if(!rt)return{x:0,y:0};var ot=(nt.timestamp-rt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(nt.x-rt.x)/ot,y:(nt.y-rt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(et){return et.max-et.min}function isNear(et,o,tt){return o===void 0&&(o=0),tt===void 0&&(tt=.01),distance(et,o)nt&&(et=tt?mix(nt,et,tt.max):Math.min(et,nt)),et}function calcRelativeAxisConstraints(et,o,tt){return{min:o!==void 0?et.min+o:void 0,max:tt!==void 0?et.max+tt-(et.max-et.min):void 0}}function calcRelativeConstraints(et,o){var tt=o.top,rt=o.left,nt=o.bottom,ot=o.right;return{x:calcRelativeAxisConstraints(et.x,rt,ot),y:calcRelativeAxisConstraints(et.y,tt,nt)}}function calcViewportAxisConstraints(et,o){var tt,rt=o.min-et.min,nt=o.max-et.max;return o.max-o.minrt?tt=progress(o.min,o.max-rt,et.min):rt>nt&&(tt=progress(et.min,et.max-nt,o.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(et,o){var tt={};return o.min!==void 0&&(tt.min=o.min-et.min),o.max!==void 0&&(tt.max=o.max-et.min),tt}var defaultElastic=.35;function resolveDragElastic(et){return et===void 0&&(et=defaultElastic),et===!1?et=0:et===!0&&(et=defaultElastic),{x:resolveAxisElastic(et,"left","right"),y:resolveAxisElastic(et,"top","bottom")}}function resolveAxisElastic(et,o,tt){return{min:resolvePointElastic(et,o),max:resolvePointElastic(et,tt)}}function resolvePointElastic(et,o){var tt;return typeof et=="number"?et:(tt=et[o])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(et){return[et("x"),et("y")]}function convertBoundingBoxToBox(et){var o=et.top,tt=et.left,rt=et.right,nt=et.bottom;return{x:{min:tt,max:rt},y:{min:o,max:nt}}}function convertBoxToBoundingBox(et){var o=et.x,tt=et.y;return{top:tt.min,right:o.max,bottom:tt.max,left:o.min}}function transformBoxPoints(et,o){if(!o)return et;var tt=o({x:et.left,y:et.top}),rt=o({x:et.right,y:et.bottom});return{top:tt.y,left:tt.x,bottom:rt.y,right:rt.x}}function isIdentityScale(et){return et===void 0||et===1}function hasScale(et){var o=et.scale,tt=et.scaleX,rt=et.scaleY;return!isIdentityScale(o)||!isIdentityScale(tt)||!isIdentityScale(rt)}function hasTransform(et){return hasScale(et)||hasTranslate(et.x)||hasTranslate(et.y)||et.z||et.rotate||et.rotateX||et.rotateY}function hasTranslate(et){return et&&et!=="0%"}function scalePoint(et,o,tt){var rt=et-tt,nt=o*rt;return tt+nt}function applyPointDelta(et,o,tt,rt,nt){return nt!==void 0&&(et=scalePoint(et,nt,rt)),scalePoint(et,tt,rt)+o}function applyAxisDelta(et,o,tt,rt,nt){o===void 0&&(o=0),tt===void 0&&(tt=1),et.min=applyPointDelta(et.min,o,tt,rt,nt),et.max=applyPointDelta(et.max,o,tt,rt,nt)}function applyBoxDelta(et,o){var tt=o.x,rt=o.y;applyAxisDelta(et.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(et.y,rt.translate,rt.scale,rt.originPoint)}function applyTreeDeltas(et,o,tt,rt){var nt,ot;rt===void 0&&(rt=!1);var it=tt.length;if(it){o.x=o.y=1;for(var st,at,ct=0;cto?tt="y":Math.abs(et.x)>o&&(tt="x"),tt}function useDrag(et){var o=et.dragControls,tt=et.visualElement,rt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return o&&o.subscribe(rt)},[rt,o]),reactExports.useEffect(function(){return rt.addListeners()},[rt])}function usePanGesture(et){var o=et.onPan,tt=et.onPanStart,rt=et.onPanEnd,nt=et.onPanSessionStart,ot=et.visualElement,it=o||tt||rt||nt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:nt,onStart:tt,onMove:o,onEnd:function(dt,ht){st.current=null,rt&&rt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var et=names$1.map(function(){return new SubscriptionManager$1}),o={},tt={clearAllListeners:function(){return et.forEach(function(rt){return rt.clear()})},updatePropListeners:function(rt){names$1.forEach(function(nt){var ot,it="on"+nt,st=rt[it];(ot=o[nt])===null||ot===void 0||ot.call(o),st&&(o[nt]=tt[it](st))})}};return et.forEach(function(rt,nt){tt["on"+names$1[nt]]=function(ot){return rt.add(ot)},tt["notify"+names$1[nt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(o,et,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],mt=dt[1];et.getValue(ht).set(mt)}),et.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:rt}}else return{target:o,transitionEnd:rt}};function unitConversion(et,o,tt,rt){return hasPositionalKey(o)?checkAndConvertChangedValueTypes(et,o,tt,rt):{target:o,transitionEnd:rt}}var parseDomVariant=function(et,o,tt,rt){var nt=resolveCSSVariables(et,o,rt);return o=nt.target,rt=nt.transitionEnd,unitConversion(et,o,tt,rt)};function getComputedStyle$1(et){return window.getComputedStyle(et)}var htmlConfig={treeType:"dom",readValueFromInstance:function(et,o){if(isTransformProp(o)){var tt=getDefaultValueType(o);return tt&&tt.default||0}else{var rt=getComputedStyle$1(et);return(isCSSVariable$1(o)?rt.getPropertyValue(o):rt[o])||0}},sortNodePosition:function(et,o){return et.compareDocumentPosition(o)&2?1:-1},getBaseTarget:function(et,o){var tt;return(tt=et.style)===null||tt===void 0?void 0:tt[o]},measureViewportBox:function(et,o){var tt=o.transformPagePoint;return measureViewportBox(et,tt)},resetTransform:function(et,o,tt){var rt=tt.transformTemplate;o.style.transform=rt?rt({},""):"none",et.scheduleRender()},restoreTransform:function(et,o){et.style.transform=o.style.transform},removeValueFromRenderState:function(et,o){var tt=o.vars,rt=o.style;delete tt[et],delete rt[et]},makeTargetAnimatable:function(et,o,tt,rt){var nt=tt.transformValues;rt===void 0&&(rt=!0);var ot=o.transition,it=o.transitionEnd,st=__rest(o,["transition","transitionEnd"]),at=getOrigin(st,ot||{},et);if(nt&&(it&&(it=nt(it)),st&&(st=nt(st)),at&&(at=nt(at))),rt){checkTargetForNewValues(et,st,at);var ct=parseDomVariant(et,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(et,o,tt,rt,nt){et.isVisible!==void 0&&(o.style.visibility=et.isVisible?"visible":"hidden"),buildHTMLStyles(o,tt,rt,nt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(et,o){return et[o]},readValueFromInstance:function(et,o){var tt;return isTransformProp(o)?((tt=getDefaultValueType(o))===null||tt===void 0?void 0:tt.default)||0:(o=camelCaseAttributes.has(o)?o:camelToDash(o),et.getAttribute(o))},scrapeMotionValuesFromProps,build:function(et,o,tt,rt,nt){buildSVGAttrs(o,tt,rt,nt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(et,o){return isSVGComponent(et)?svgVisualElement(o,{enableHardwareAcceleration:!1}):htmlVisualElement(o,{enableHardwareAcceleration:!0})};function pixelsToPercent(et,o){return o.max===o.min?0:et/(o.max-o.min)*100}var correctBorderRadius={correct:function(et,o){if(!o.target)return et;if(typeof et=="string")if(px.test(et))et=parseFloat(et);else return et;var tt=pixelsToPercent(et,o.target.x),rt=pixelsToPercent(et,o.target.y);return"".concat(tt,"% ").concat(rt,"%")}},varToken="_$css",correctBoxShadow={correct:function(et,o){var tt=o.treeScale,rt=o.projectionDelta,nt=et,ot=et.includes("var("),it=[];ot&&(et=et.replace(cssVariableRegex,function(pt){return it.push(pt),varToken}));var st=complex.parse(et);if(st.length>5)return nt;var at=complex.createTransformer(et),ct=typeof st[0]!="number"?1:0,lt=rt.x.scale*tt.x,dt=rt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var mt=at(st);if(ot){var ft=0;mt=mt.replace(varToken,function(){var pt=it[ft];return ft++,pt})}return mt}},MeasureLayoutWithContext=function(et){__extends(o,et);function o(){return et!==null&&et.apply(this,arguments)||this}return o.prototype.componentDidMount=function(){var tt=this,rt=this.props,nt=rt.visualElement,ot=rt.layoutGroup,it=rt.switchLayoutGroup,st=rt.layoutId,at=nt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},o.prototype.getSnapshotBeforeUpdate=function(tt){var rt=this,nt=this.props,ot=nt.layoutDependency,it=nt.visualElement,st=nt.drag,at=nt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||rt.safeToRemove()}))),null},o.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},o.prototype.componentWillUnmount=function(){var tt=this.props,rt=tt.visualElement,nt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=rt.projection;it&&(it.scheduleCheckAfterUnmount(),nt!=null&&nt.group&&nt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},o.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},o.prototype.render=function(){return null},o}(React.Component);function MeasureLayout(et){var o=__read(usePresence$1(),2),tt=o[0],rt=o[1],nt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},et,{layoutGroup:nt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:rt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(et,o,tt){tt===void 0&&(tt={});var rt=isMotionValue(et)?et:motionValue(et);return startAnimation("",rt,o,tt),{stop:function(){return rt.stop()},isAnimating:function(){return rt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(et){return typeof et=="string"?parseFloat(et):et},isPx=function(et){return typeof et=="number"||px.test(et)};function mixValues(et,o,tt,rt,nt,ot){var it,st,at,ct;nt?(et.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(rt)),et.opacityExit=mix((st=o.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(rt))):ot&&(et.opacity=mix((at=o.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,rt));for(var lt=0;lto?1:tt(progress(et,o,rt))}}function copyAxisInto(et,o){et.min=o.min,et.max=o.max}function copyBoxInto(et,o){copyAxisInto(et.x,o.x),copyAxisInto(et.y,o.y)}function removePointDelta(et,o,tt,rt,nt){return et-=o,et=scalePoint(et,1/tt,rt),nt!==void 0&&(et=scalePoint(et,1/nt,rt)),et}function removeAxisDelta(et,o,tt,rt,nt,ot,it){if(o===void 0&&(o=0),tt===void 0&&(tt=1),rt===void 0&&(rt=.5),ot===void 0&&(ot=et),it===void 0&&(it=et),percent.test(o)){o=parseFloat(o);var st=mix(it.min,it.max,o/100);o=st-it.min}if(typeof o=="number"){var at=mix(ot.min,ot.max,rt);et===ot&&(at-=o),et.min=removePointDelta(et.min,o,tt,at,nt),et.max=removePointDelta(et.max,o,tt,at,nt)}}function removeAxisTransforms(et,o,tt,rt,nt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(et,o[it],o[st],o[at],o.scale,rt,nt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(et,o,tt,rt){removeAxisTransforms(et.x,o,xKeys,tt==null?void 0:tt.x,rt==null?void 0:rt.x),removeAxisTransforms(et.y,o,yKeys,tt==null?void 0:tt.y,rt==null?void 0:rt.y)}function isAxisDeltaZero(et){return et.translate===0&&et.scale===1}function isDeltaZero(et){return isAxisDeltaZero(et.x)&&isAxisDeltaZero(et.y)}function boxEquals(et,o){return et.x.min===o.x.min&&et.x.max===o.x.max&&et.y.min===o.y.min&&et.y.max===o.y.max}var NodeStack=function(){function et(){this.members=[]}return et.prototype.add=function(o){addUniqueItem(this.members,o),o.scheduleRender()},et.prototype.remove=function(o){if(removeItem(this.members,o),o===this.prevLead&&(this.prevLead=void 0),o===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},et.prototype.relegate=function(o){var tt=this.members.findIndex(function(it){return o===it});if(tt===0)return!1;for(var rt,nt=tt;nt>=0;nt--){var ot=this.members[nt];if(ot.isPresent!==!1){rt=ot;break}}return rt?(this.promote(rt),!0):!1},et.prototype.promote=function(o,tt){var rt,nt=this.lead;if(o!==nt&&(this.prevLead=nt,this.lead=o,o.show(),nt)){nt.instance&&nt.scheduleRender(),o.scheduleRender(),o.resumeFrom=nt,tt&&(o.resumeFrom.preserveOpacity=!0),nt.snapshot&&(o.snapshot=nt.snapshot,o.snapshot.latestValues=nt.animationValues||nt.latestValues,o.snapshot.isShared=!0),!((rt=o.root)===null||rt===void 0)&&rt.isUpdating&&(o.isLayoutDirty=!0);var ot=o.options.crossfade;ot===!1&&nt.hide()}},et.prototype.exitAnimationComplete=function(){this.members.forEach(function(o){var tt,rt,nt,ot,it;(rt=(tt=o.options).onExitComplete)===null||rt===void 0||rt.call(tt),(it=(nt=o.resumingFrom)===null||nt===void 0?void 0:(ot=nt.options).onExitComplete)===null||it===void 0||it.call(ot)})},et.prototype.scheduleRender=function(){this.members.forEach(function(o){o.instance&&o.scheduleRender(!1)})},et.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},et}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(et,o,tt){var rt=et.x.translate/o.x,nt=et.y.translate/o.y,ot="translate3d(".concat(rt,"px, ").concat(nt,"px, 0) ");if(ot+="scale(".concat(1/o.x,", ").concat(1/o.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=et.x.scale*o.x,lt=et.y.scale*o.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(et,o){return et.depth-o.depth},FlatTree=function(){function et(){this.children=[],this.isDirty=!1}return et.prototype.add=function(o){addUniqueItem(this.children,o),this.isDirty=!0},et.prototype.remove=function(o){removeItem(this.children,o),this.isDirty=!0},et.prototype.forEach=function(o){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(o)},et}(),animationTarget=1e3;function createProjectionNode(et){var o=et.attachResizeListener,tt=et.defaultParent,rt=et.measureScroll,nt=et.checkIsScrollRoot,ot=et.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;rt--)if(et.path[rt].instance){tt=et.path[rt];break}var nt=tt&&tt!==et.root?tt.instance:document,ot=nt.querySelector('[data-projection-id="'.concat(o,'"]'));ot&&et.mount(ot,!0)}function roundAxis(et){et.min=Math.round(et.min),et.max=Math.round(et.max)}function roundBox(et){roundAxis(et.x),roundAxis(et.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(et,o){return addDomEvent(et,"resize",o)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(et){return{x:et.scrollLeft,y:et.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var et=new DocumentProjectionNode(0,{});et.mount(window),et.setOptions({layoutScroll:!0}),rootProjectionNode.current=et}return rootProjectionNode.current},resetTransform:function(et,o){et.style.transform=o??"none"},checkIsScrollRoot:function(et){return window.getComputedStyle(et).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(et,o){return createDomMotionConfig(et,o,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var et=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return et.current=!0,function(){et.current=!1}},[]),et}function useForceUpdate(){var et=useIsMounted$1(),o=__read(reactExports.useState(0),2),tt=o[0],rt=o[1],nt=reactExports.useCallback(function(){et.current&&rt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(nt)},[nt]);return[ot,tt]}var PresenceChild=function(et){var o=et.children,tt=et.initial,rt=et.isPresent,nt=et.onExitComplete,ot=et.custom,it=et.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:rt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var mt=__values(st.values()),ft=mt.next();!ft.done;ft=mt.next()){var pt=ft.value;if(!pt)return}}catch(yt){dt={error:yt}}finally{try{ft&&!ft.done&&(ht=mt.return)&&ht.call(mt)}finally{if(dt)throw dt.error}}nt==null||nt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[rt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[rt]),reactExports.useEffect(function(){!rt&&!st.size&&(nt==null||nt())},[rt]),reactExports.createElement(PresenceContext.Provider,{value:ct},o)};function newChildrenMap(){return new Map}var getChildKey=function(et){return et.key||""};function updateChildLookup(et,o){et.forEach(function(tt){var rt=getChildKey(tt);o.set(rt,tt)})}function onlyElements(et){var o=[];return reactExports.Children.forEach(et,function(tt){reactExports.isValidElement(tt)&&o.push(tt)}),o}var AnimatePresence=function(et){var o=et.children,tt=et.custom,rt=et.initial,nt=rt===void 0?!0:rt,ot=et.onExitComplete,it=et.exitBeforeEnter,st=et.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),mt=onlyElements(o),ft=mt,pt=new Set,yt=reactExports.useRef(ft),gt=reactExports.useRef(new Map).current,bt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){bt.current=!1,updateChildLookup(mt,gt),yt.current=ft}),useUnmountEffect(function(){bt.current=!0,gt.clear(),pt.clear()}),bt.current)return reactExports.createElement(reactExports.Fragment,null,ft.map(function(At){return reactExports.createElement(PresenceChild,{key:getChildKey(At),isPresent:!0,initial:nt?void 0:!1,presenceAffectsLayout:at},At)}));ft=__spreadArray([],__read(ft),!1);for(var xt=yt.current.map(getChildKey),vt=mt.map(getChildKey),Et=xt.length,Ct=0;Ct1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,pt.size?ft:ft.map(function(At){return reactExports.cloneElement(At)}))};function MotionConfig(et){var o=et.children,tt=et.isValidProp,rt=__rest(et,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),rt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),rt),rt.isStatic=useConstant(function(){return rt.isStatic});var nt=reactExports.useMemo(function(){return rt},[JSON.stringify(rt.transition),rt.transformPagePoint,rt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:nt},o)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** + */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,zs,FocusManager=(zs=class extends Subscribable{constructor(){super();fr(this,kn);fr(this,hn);fr(this,Mn);lr(this,Mn,o=>{if(!isServer&&window.addEventListener){const tt=()=>o();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Ot(this,hn)||this.setEventListener(Ot(this,Mn))}onUnsubscribe(){var o;this.hasListeners()||((o=Ot(this,hn))==null||o.call(this),lr(this,hn,void 0))}setEventListener(o){var tt;lr(this,Mn,o),(tt=Ot(this,hn))==null||tt.call(this),lr(this,hn,o(rt=>{typeof rt=="boolean"?this.setFocused(rt):this.onFocus()}))}setFocused(o){Ot(this,kn)!==o&&(lr(this,kn,o),this.onFocus())}onFocus(){const o=this.isFocused();this.listeners.forEach(tt=>{tt(o)})}isFocused(){var o;return typeof Ot(this,kn)=="boolean"?Ot(this,kn):((o=globalThis.document)==null?void 0:o.visibilityState)!=="hidden"}},kn=new WeakMap,hn=new WeakMap,Mn=new WeakMap,zs),focusManager=new FocusManager,Bn,fn,Fn,Vs,OnlineManager=(Vs=class extends Subscribable{constructor(){super();fr(this,Bn,!0);fr(this,fn);fr(this,Fn);lr(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(){Ot(this,fn)||this.setEventListener(Ot(this,Fn))}onUnsubscribe(){var o;this.hasListeners()||((o=Ot(this,fn))==null||o.call(this),lr(this,fn,void 0))}setEventListener(o){var tt;lr(this,Fn,o),(tt=Ot(this,fn))==null||tt.call(this),lr(this,fn,o(this.setOnline.bind(this)))}setOnline(o){Ot(this,Bn)!==o&&(lr(this,Bn,o),this.listeners.forEach(rt=>{rt(o)}))}isOnline(){return Ot(this,Bn)}},Bn=new WeakMap,fn=new WeakMap,Fn=new WeakMap,Vs),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 yt;rt||(ht(new CancelledError(pt)),(yt=et.abort)==null||yt.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 yt;rt||(rt=!0,(yt=et.onSuccess)==null||yt.call(et,pt),nt==null||nt(),ot.resolve(pt))},ht=pt=>{var yt;rt||(rt=!0,(yt=et.onError)==null||yt.call(et,pt),nt==null||nt(),ot.reject(pt))},mt=()=>new Promise(pt=>{var yt;nt=gt=>{(rt||ct())&&pt(gt)},(yt=et.onPause)==null||yt.call(et)}).then(()=>{var pt;nt=void 0,rt||(pt=et.onContinue)==null||pt.call(et)}),ft=()=>{if(rt)return;let pt;const yt=tt===0?et.initialPromise:void 0;try{pt=yt??et.fn()}catch(gt){pt=Promise.reject(gt)}Promise.resolve(pt).then(dt).catch(gt=>{var Ct;if(rt)return;const bt=et.retry??(isServer?0:3),xt=et.retryDelay??defaultRetryDelay,vt=typeof xt=="function"?xt(tt,gt):xt,Et=bt===!0||typeof bt=="number"&&ttct()?void 0:mt()).then(()=>{o?ht(gt):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(),Rn,Hs,Removable=(Hs=class{constructor(){fr(this,Rn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&lr(this,Rn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(et){this.gcTime=Math.max(this.gcTime||0,et??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Ot(this,Rn)&&(clearTimeout(Ot(this,Rn)),lr(this,Rn,void 0))}},Rn=new WeakMap,Hs),Un,zn,Vr,Lr,io,_n,Gr,nn,Ws,Query=(Ws=class extends Removable{constructor(o){super();fr(this,Gr);fr(this,Un);fr(this,zn);fr(this,Vr);fr(this,Lr);fr(this,io);fr(this,_n);lr(this,_n,!1),lr(this,io,o.defaultOptions),this.setOptions(o.options),this.observers=[],lr(this,Vr,o.cache),this.queryKey=o.queryKey,this.queryHash=o.queryHash,lr(this,Un,getDefaultState$1(this.options)),this.state=o.state??Ot(this,Un),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var o;return(o=Ot(this,Lr))==null?void 0:o.promise}setOptions(o){this.options={...Ot(this,io),...o},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Ot(this,Vr).remove(this)}setData(o,tt){const rt=replaceData(this.state.data,o,this.options);return mr(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){mr(this,Gr,nn).call(this,{type:"setState",state:o,setStateOptions:tt})}cancel(o){var rt,nt;const tt=(rt=Ot(this,Lr))==null?void 0:rt.promise;return(nt=Ot(this,Lr))==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(Ot(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=Ot(this,Lr))==null||tt.continue()}onOnline(){var tt;const o=this.observers.find(rt=>rt.shouldFetchOnReconnect());o==null||o.refetch({cancelRefetch:!1}),(tt=Ot(this,Lr))==null||tt.continue()}addObserver(o){this.observers.includes(o)||(this.observers.push(o),this.clearGcTimeout(),Ot(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||(Ot(this,Lr)&&(Ot(this,_n)?Ot(this,Lr).cancel({revert:!0}):Ot(this,Lr).cancelRetry()),this.scheduleGc()),Ot(this,Vr).notify({type:"observerRemoved",query:this,observer:o}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||mr(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(Ot(this,Lr))return Ot(this,Lr).continueRetry(),Ot(this,Lr).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:()=>(lr(this,_n,!0),rt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return nt(ht),lr(this,_n,!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),lr(this,zn,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&mr(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||mr(this,Gr,nn).call(this,{type:"error",error:dt}),isCancelledError(dt)||((mt=(ht=Ot(this,Vr).config).onError)==null||mt.call(ht,dt,this),(pt=(ft=Ot(this,Vr).config).onSettled)==null||pt.call(ft,this.state.data,dt,this)),this.scheduleGc()};return lr(this,Lr,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(yt){st(yt);return}(mt=(ht=Ot(this,Vr).config).onSuccess)==null||mt.call(ht,dt,this),(pt=(ft=Ot(this,Vr).config).onSettled)==null||pt.call(ft,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{mr(this,Gr,nn).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{mr(this,Gr,nn).call(this,{type:"pause"})},onContinue:()=>{mr(this,Gr,nn).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Ot(this,Lr).start()}},Un=new WeakMap,zn=new WeakMap,Vr=new WeakMap,Lr=new WeakMap,io=new WeakMap,_n=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&&Ot(this,zn)?{...Ot(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()}),Ot(this,Vr).notify({query:this,type:"updated",action:o})})},Ws);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 qr,Gs,QueryCache=(Gs=class extends Subscribable{constructor(o={}){super();fr(this,qr);this.config=o,lr(this,qr,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){Ot(this,qr).has(o.queryHash)||(Ot(this,qr).set(o.queryHash,o),this.notify({type:"added",query:o}))}remove(o){const tt=Ot(this,qr).get(o.queryHash);tt&&(o.destroy(),tt===o&&Ot(this,qr).delete(o.queryHash),this.notify({type:"removed",query:o}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(o=>{this.remove(o)})})}get(o){return Ot(this,qr).get(o)}getAll(){return[...Ot(this,qr).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()})})}},qr=new WeakMap,Gs),Kr,Or,Tn,Qr,un,qs,Mutation=(qs=class extends Removable{constructor(o){super();fr(this,Qr);fr(this,Kr);fr(this,Or);fr(this,Tn);this.mutationId=o.mutationId,lr(this,Or,o.mutationCache),lr(this,Kr,[]),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){Ot(this,Kr).includes(o)||(Ot(this,Kr).push(o),this.clearGcTimeout(),Ot(this,Or).notify({type:"observerAdded",mutation:this,observer:o}))}removeObserver(o){lr(this,Kr,Ot(this,Kr).filter(tt=>tt!==o)),this.scheduleGc(),Ot(this,Or).notify({type:"observerRemoved",mutation:this,observer:o})}optionalRemove(){Ot(this,Kr).length||(this.state.status==="pending"?this.scheduleGc():Ot(this,Or).remove(this))}continue(){var o;return((o=Ot(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,yt,gt,bt,xt,vt,Et,Ct,St;lr(this,Tn,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(o):Promise.reject(new Error("No mutationFn found")),onFail:(At,kt)=>{mr(this,Qr,un).call(this,{type:"failed",failureCount:At,error:kt})},onPause:()=>{mr(this,Qr,un).call(this,{type:"pause"})},onContinue:()=>{mr(this,Qr,un).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Ot(this,Or).canRun(this)}));const tt=this.state.status==="pending",rt=!Ot(this,Tn).canStart();try{if(!tt){mr(this,Qr,un).call(this,{type:"pending",variables:o,isPaused:rt}),await((ot=(nt=Ot(this,Or).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&&mr(this,Qr,un).call(this,{type:"pending",context:kt,variables:o,isPaused:rt})}const At=await Ot(this,Tn).start();return await((ct=(at=Ot(this,Or).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=Ot(this,Or).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)),mr(this,Qr,un).call(this,{type:"success",data:At}),At}catch(At){try{throw await((gt=(yt=Ot(this,Or).config).onError)==null?void 0:gt.call(yt,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=Ot(this,Or).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{mr(this,Qr,un).call(this,{type:"error",error:At})}}finally{Ot(this,Or).runNext(this)}}},Kr=new WeakMap,Or=new WeakMap,Tn=new WeakMap,Qr=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(()=>{Ot(this,Kr).forEach(rt=>{rt.onMutationUpdate(o)}),Ot(this,Or).notify({mutation:this,type:"updated",action:o})})},qs);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,Ks,MutationCache=(Ks=class extends Subscribable{constructor(o={}){super();fr(this,zr);fr(this,so);this.config=o,lr(this,zr,new Map),lr(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=Ot(this,zr).get(tt)??[];rt.push(o),Ot(this,zr).set(tt,rt),this.notify({type:"added",mutation:o})}remove(o){var rt;const tt=scopeFor(o);if(Ot(this,zr).has(tt)){const nt=(rt=Ot(this,zr).get(tt))==null?void 0:rt.filter(ot=>ot!==o);nt&&(nt.length===0?Ot(this,zr).delete(tt):Ot(this,zr).set(tt,nt))}this.notify({type:"removed",mutation:o})}canRun(o){var rt;const tt=(rt=Ot(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=Ot(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[...Ot(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,Ks);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 yt=xt=>{Object.defineProperty(xt,"signal",{enumerable:!0,get:()=>(o.signal.aborted?pt=!0:o.signal.addEventListener("abort",()=>{pt=!0}),o.signal)})},gt=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};yt(Ct);const St=await gt(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,yt;return(yt=(pt=o.options).persister)==null?void 0:yt.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 Pr,pn,mn,Vn,Hn,gn,Wn,Gn,Qs,QueryClient=(Qs=class{constructor(et={}){fr(this,Pr);fr(this,pn);fr(this,mn);fr(this,Vn);fr(this,Hn);fr(this,gn);fr(this,Wn);fr(this,Gn);lr(this,Pr,et.queryCache||new QueryCache),lr(this,pn,et.mutationCache||new MutationCache),lr(this,mn,et.defaultOptions||{}),lr(this,Vn,new Map),lr(this,Hn,new Map),lr(this,gn,0)}mount(){Cn(this,gn)._++,Ot(this,gn)===1&&(lr(this,Wn,focusManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Ot(this,Pr).onFocus())})),lr(this,Gn,onlineManager.subscribe(async et=>{et&&(await this.resumePausedMutations(),Ot(this,Pr).onOnline())})))}unmount(){var et,o;Cn(this,gn)._--,Ot(this,gn)===0&&((et=Ot(this,Wn))==null||et.call(this),lr(this,Wn,void 0),(o=Ot(this,Gn))==null||o.call(this),lr(this,Gn,void 0))}isFetching(et){return Ot(this,Pr).findAll({...et,fetchStatus:"fetching"}).length}isMutating(et){return Ot(this,pn).findAll({...et,status:"pending"}).length}getQueryData(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Ot(this,Pr).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=Ot(this,Pr).build(this,tt);return et.revalidateIfStale&&rt.isStaleByTime(resolveStaleTime(tt.staleTime,rt))&&this.prefetchQuery(tt),Promise.resolve(o)}}getQueriesData(et){return Ot(this,Pr).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=Ot(this,Pr).get(rt.queryHash),ot=nt==null?void 0:nt.state.data,it=functionalUpdate(o,ot);if(it!==void 0)return Ot(this,Pr).build(this,rt).setData(it,{...tt,manual:!0})}setQueriesData(et,o,tt){return notifyManager.batch(()=>Ot(this,Pr).findAll(et).map(({queryKey:rt})=>[rt,this.setQueryData(rt,o,tt)]))}getQueryState(et){var tt;const o=this.defaultQueryOptions({queryKey:et});return(tt=Ot(this,Pr).get(o.queryHash))==null?void 0:tt.state}removeQueries(et){const o=Ot(this,Pr);notifyManager.batch(()=>{o.findAll(et).forEach(tt=>{o.remove(tt)})})}resetQueries(et,o){const tt=Ot(this,Pr),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(()=>Ot(this,Pr).findAll(et).map(nt=>nt.cancel(tt)));return Promise.all(rt).then(noop$4).catch(noop$4)}invalidateQueries(et={},o={}){return notifyManager.batch(()=>{if(Ot(this,Pr).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(()=>Ot(this,Pr).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=Ot(this,Pr).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()?Ot(this,pn).resumePausedMutations():Promise.resolve()}getQueryCache(){return Ot(this,Pr)}getMutationCache(){return Ot(this,pn)}getDefaultOptions(){return Ot(this,mn)}setDefaultOptions(et){lr(this,mn,et)}setQueryDefaults(et,o){Ot(this,Vn).set(hashKey(et),{queryKey:et,defaultOptions:o})}getQueryDefaults(et){const o=[...Ot(this,Vn).values()];let tt={};return o.forEach(rt=>{partialMatchKey(et,rt.queryKey)&&(tt={...tt,...rt.defaultOptions})}),tt}setMutationDefaults(et,o){Ot(this,Hn).set(hashKey(et),{mutationKey:et,defaultOptions:o})}getMutationDefaults(et){const o=[...Ot(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={...Ot(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:{...Ot(this,mn).mutations,...(et==null?void 0:et.mutationKey)&&this.getMutationDefaults(et.mutationKey),...et,_defaulted:!0}}clear(){Ot(this,Pr).clear(),Ot(this,pn).clear()}},Pr=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,qn,bn,Xr,co,Kn,Qn,Pn,jn,yn,Xn,Rr,oo,Ts,Is,Ps,js,Ns,Ds,Ls,tu,Xs,QueryObserver=(Xs=class extends Subscribable{constructor(o,tt){super();fr(this,Rr);fr(this,Br);fr(this,Cr);fr(this,ao);fr(this,Mr);fr(this,In);fr(this,qn);fr(this,bn);fr(this,Xr);fr(this,co);fr(this,Kn);fr(this,Qn);fr(this,Pn);fr(this,jn);fr(this,yn);fr(this,Xn,new Set);this.options=tt,lr(this,Br,o),lr(this,Xr,null),lr(this,bn,pendingThenable()),this.options.experimental_prefetchInRender||Ot(this,bn).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&&(Ot(this,Cr).addObserver(this),shouldFetchOnMount(Ot(this,Cr),this.options)?mr(this,Rr,oo).call(this):this.updateResult(),mr(this,Rr,js).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Ot(this,Cr),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Ot(this,Cr),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,mr(this,Rr,Ns).call(this),mr(this,Rr,Ds).call(this),Ot(this,Cr).removeObserver(this)}setOptions(o,tt){const rt=this.options,nt=Ot(this,Cr);if(this.options=Ot(this,Br).defaultQueryOptions(o),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Ot(this,Cr))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");mr(this,Rr,Ls).call(this),Ot(this,Cr).setOptions(this.options),rt._defaulted&&!shallowEqualObjects(this.options,rt)&&Ot(this,Br).getQueryCache().notify({type:"observerOptionsUpdated",query:Ot(this,Cr),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Ot(this,Cr),nt,this.options,rt)&&mr(this,Rr,oo).call(this),this.updateResult(tt),ot&&(Ot(this,Cr)!==nt||resolveEnabled(this.options.enabled,Ot(this,Cr))!==resolveEnabled(rt.enabled,Ot(this,Cr))||resolveStaleTime(this.options.staleTime,Ot(this,Cr))!==resolveStaleTime(rt.staleTime,Ot(this,Cr)))&&mr(this,Rr,Ts).call(this);const it=mr(this,Rr,Is).call(this);ot&&(Ot(this,Cr)!==nt||resolveEnabled(this.options.enabled,Ot(this,Cr))!==resolveEnabled(rt.enabled,Ot(this,Cr))||it!==Ot(this,yn))&&mr(this,Rr,Ps).call(this,it)}getOptimisticResult(o){const tt=Ot(this,Br).getQueryCache().build(Ot(this,Br),o),rt=this.createResult(tt,o);return shouldAssignObserverCurrentProperties(this,rt)&&(lr(this,Mr,rt),lr(this,qn,this.options),lr(this,In,Ot(this,Cr).state)),rt}getCurrentResult(){return Ot(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){Ot(this,Xn).add(o)}getCurrentQuery(){return Ot(this,Cr)}refetch({...o}={}){return this.fetch({...o})}fetchOptimistic(o){const tt=Ot(this,Br).defaultQueryOptions(o),rt=Ot(this,Br).getQueryCache().build(Ot(this,Br),tt);return rt.fetch().then(()=>this.createResult(rt,tt))}fetch(o){return mr(this,Rr,oo).call(this,{...o,cancelRefetch:o.cancelRefetch??!0}).then(()=>(this.updateResult(),Ot(this,Mr)))}createResult(o,tt){var At;const rt=Ot(this,Cr),nt=this.options,ot=Ot(this,Mr),it=Ot(this,In),st=Ot(this,qn),ct=o!==rt?o.state:Ot(this,ao),{state:lt}=o;let dt={...lt},ht=!1,mt;if(tt._optimisticResults){const kt=this.hasListeners(),It=!kt&&shouldFetchOnMount(o,tt),Nt=kt&&shouldFetchOptionally(o,rt,tt,nt);(It||Nt)&&(dt={...dt,...fetchState(lt.data,o.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:ft,errorUpdatedAt:pt,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Ot(this,co))mt=Ot(this,Kn);else try{lr(this,co,tt.select),mt=tt.select(dt.data),mt=replaceData(ot==null?void 0:ot.data,mt,tt),lr(this,Kn,mt),lr(this,Xr,null)}catch(kt){lr(this,Xr,kt)}else mt=dt.data;if(tt.placeholderData!==void 0&&mt===void 0&&yt==="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=Ot(this,Qn))==null?void 0:At.state.data,Ot(this,Qn)):tt.placeholderData,tt.select&&kt!==void 0)try{kt=tt.select(kt),lr(this,Xr,null)}catch(It){lr(this,Xr,It)}kt!==void 0&&(yt="success",mt=replaceData(ot==null?void 0:ot.data,kt,tt),ht=!0)}Ot(this,Xr)&&(ft=Ot(this,Xr),mt=Ot(this,Kn),pt=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",bt=yt==="pending",xt=yt==="error",vt=bt&>,Et=mt!==void 0,St={status:yt,fetchStatus:dt.fetchStatus,isPending:bt,isSuccess:yt==="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:gt,isRefetching:gt&&!bt,isLoadingError:xt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:xt&&Et,isStale:isStale(o,tt),refetch:this.refetch,promise:Ot(this,bn)};if(this.options.experimental_prefetchInRender){const kt=Lt=>{St.status==="error"?Lt.reject(St.error):St.data!==void 0&&Lt.resolve(St.data)},It=()=>{const Lt=lr(this,bn,St.promise=pendingThenable());kt(Lt)},Nt=Ot(this,bn);switch(Nt.status){case"pending":o.queryHash===rt.queryHash&&kt(Nt);break;case"fulfilled":(St.status==="error"||St.data!==Nt.value)&&It();break;case"rejected":(St.status!=="error"||St.error!==Nt.reason)&&It();break}}return St}updateResult(o){const tt=Ot(this,Mr),rt=this.createResult(Ot(this,Cr),this.options);if(lr(this,In,Ot(this,Cr).state),lr(this,qn,this.options),Ot(this,In).data!==void 0&&lr(this,Qn,Ot(this,Cr)),shallowEqualObjects(rt,tt))return;lr(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&&!Ot(this,Xn).size)return!0;const at=new Set(st??Ot(this,Xn));return this.options.throwOnError&&at.add("error"),Object.keys(Ot(this,Mr)).some(ct=>{const lt=ct;return Ot(this,Mr)[lt]!==tt[lt]&&at.has(lt)})};(o==null?void 0:o.listeners)!==!1&&ot()&&(nt.listeners=!0),mr(this,Rr,tu).call(this,{...nt,...o})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&mr(this,Rr,js).call(this)}},Br=new WeakMap,Cr=new WeakMap,ao=new WeakMap,Mr=new WeakMap,In=new WeakMap,qn=new WeakMap,bn=new WeakMap,Xr=new WeakMap,co=new WeakMap,Kn=new WeakMap,Qn=new WeakMap,Pn=new WeakMap,jn=new WeakMap,yn=new WeakMap,Xn=new WeakMap,Rr=new WeakSet,oo=function(o){mr(this,Rr,Ls).call(this);let tt=Ot(this,Cr).fetch(this.options,o);return o!=null&&o.throwOnError||(tt=tt.catch(noop$4)),tt},Ts=function(){mr(this,Rr,Ns).call(this);const o=resolveStaleTime(this.options.staleTime,Ot(this,Cr));if(isServer||Ot(this,Mr).isStale||!isValidTimeout(o))return;const rt=timeUntilStale(Ot(this,Mr).dataUpdatedAt,o)+1;lr(this,Pn,setTimeout(()=>{Ot(this,Mr).isStale||this.updateResult()},rt))},Is=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Ot(this,Cr)):this.options.refetchInterval)??!1},Ps=function(o){mr(this,Rr,Ds).call(this),lr(this,yn,o),!(isServer||resolveEnabled(this.options.enabled,Ot(this,Cr))===!1||!isValidTimeout(Ot(this,yn))||Ot(this,yn)===0)&&lr(this,jn,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&mr(this,Rr,oo).call(this)},Ot(this,yn)))},js=function(){mr(this,Rr,Ts).call(this),mr(this,Rr,Ps).call(this,mr(this,Rr,Is).call(this))},Ns=function(){Ot(this,Pn)&&(clearTimeout(Ot(this,Pn)),lr(this,Pn,void 0))},Ds=function(){Ot(this,jn)&&(clearInterval(Ot(this,jn)),lr(this,jn,void 0))},Ls=function(){const o=Ot(this,Br).getQueryCache().build(Ot(this,Br),this.options);if(o===Ot(this,Cr))return;const tt=Ot(this,Cr);lr(this,Cr,o),lr(this,ao,o.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),o.addObserver(this))},tu=function(o){notifyManager.batch(()=>{o.listeners&&this.listeners.forEach(tt=>{tt(Ot(this,Mr))}),Ot(this,Br).getQueryCache().notify({query:Ot(this,Cr),type:"observerResultsUpdated"})})},Xs);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,Jo,Os,Ys,MutationObserver$1=(Ys=class extends Subscribable{constructor(tt,rt){super();fr(this,ln);fr(this,xn);fr(this,vn);fr(this,Fr);fr(this,sn);lr(this,xn,tt),this.setOptions(rt),this.bindMethods(),mr(this,ln,Jo).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=Ot(this,xn).defaultMutationOptions(tt),shallowEqualObjects(this.options,rt)||Ot(this,xn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Ot(this,Fr),observer:this}),rt!=null&&rt.mutationKey&&this.options.mutationKey&&hashKey(rt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((nt=Ot(this,Fr))==null?void 0:nt.state.status)==="pending"&&Ot(this,Fr).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Ot(this,Fr))==null||tt.removeObserver(this)}onMutationUpdate(tt){mr(this,ln,Jo).call(this),mr(this,ln,Os).call(this,tt)}getCurrentResult(){return Ot(this,vn)}reset(){var tt;(tt=Ot(this,Fr))==null||tt.removeObserver(this),lr(this,Fr,void 0),mr(this,ln,Jo).call(this),mr(this,ln,Os).call(this)}mutate(tt,rt){var nt;return lr(this,sn,rt),(nt=Ot(this,Fr))==null||nt.removeObserver(this),lr(this,Fr,Ot(this,xn).getMutationCache().build(Ot(this,xn),this.options)),Ot(this,Fr).addObserver(this),Ot(this,Fr).execute(tt)}},xn=new WeakMap,vn=new WeakMap,Fr=new WeakMap,sn=new WeakMap,ln=new WeakSet,Jo=function(){var rt;const tt=((rt=Ot(this,Fr))==null?void 0:rt.state)??getDefaultState();lr(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(Ot(this,sn)&&this.hasListeners()){const dt=Ot(this,vn).variables,ht=Ot(this,vn).context;(tt==null?void 0:tt.type)==="success"?((nt=(rt=Ot(this,sn)).onSuccess)==null||nt.call(rt,tt.data,dt,ht),(it=(ot=Ot(this,sn)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Ot(this,sn)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Ot(this,sn)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Ot(this,vn))})})},Ys);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:yt,getNextPageParam:gt,initialPageParam:bt,_optimisticResults:xt,enabled:vt,notifyOnChangeProps:Et,placeholderData:Ct,refetchInterval:St,refetchIntervalInBackground:At,refetchOnMount:kt,refetchOnReconnect:It,refetchOnWindowFocus:Nt,retryOnMount:Lt,select:Mt,staleTime:zt,suspense:Ut,throwOnError:Xt,config:Wt,connector:Ft,query:qt,...Pt}=et;return Pt}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 yt=nt?()=>{}:at.subscribe(notifyManager.batchCalls(pt));return at.updateResult(),yt},[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-BN-E6inN.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 yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(mt=st==null?void 0:st.rpcUrls)!=null&&mt.length?gt=st.rpcUrls:gt=[((ft=ct.rpcUrls.default)==null?void 0:ft.http[0])??""];const bt={blockExplorerUrls:yt,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:gt};return await lt.request({method:"wallet_addEthereumChain",params:[bt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}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-BBMEgiCJ.js").then(yt=>yt.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(yt=>yt.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(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(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:gt,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(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},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-CK0s9qz-.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-Brvd2aRO.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 yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((ft=dt.storage)==null?void 0:ft.getItem("state"))??{};dt.chains.some(St=>St.id===Et.chainId)?gt=Et.chainId:gt=(pt=dt.chains[0])==null?void 0:pt.id}if(!gt)throw new Error("No chains found on connector.");const bt=await this.isChainsStale();if(yt.session&&bt&&await yt.disconnect(),!yt.session||bt){const Et=dt.chains.filter(Ct=>Ct.id!==gt).map(Ct=>Ct.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in mt?{pairingTopic:mt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(Ct=>Ct.id))}const xt=(await yt.enable()).map(Et=>getAddress(Et)),vt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:xt,chainId:vt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},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(gt=>gt.id);if(!pt.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-BN4D2FYF.js");return{EthereumProvider:gt}},__vite__mapDeps([6,2,3]));return await yt.init({...et,disableProviderPing:!0,optionalChains:pt,projectId:et.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[bt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.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 yt,gt,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=(yt=pt.blockExplorers)!=null&&yt.default.url?[(gt=pt.blockExplorers)==null?void 0:gt.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(yt=>Number.parseInt(yt.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 define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(et,o,tt){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.length=0;st--)(it=et[st])&&(ot=(nt<3?it(ot):nt>3?it(o,tt,ot):it(o,tt))||ot);return nt>3&&ot&&Object.defineProperty(o,tt,ot),ot}function __param(et,o){return function(tt,rt){o(tt,rt,et)}}function __esDecorate(et,o,tt,rt,nt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=rt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!o&&et?rt.static?et:et.prototype:null,lt=o||(ct?Object.getOwnPropertyDescriptor(ct,rt.name):{}),dt,ht=!1,mt=tt.length-1;mt>=0;mt--){var ft={};for(var pt in rt)ft[pt]=pt==="access"?{}:rt[pt];for(var pt in rt.access)ft.access[pt]=rt.access[pt];ft.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[mt])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],ft);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&nt.unshift(dt)}else(dt=it(yt))&&(st==="field"?nt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,rt.name,lt),ht=!0}function __runInitializers(et,o,tt){for(var rt=arguments.length>2,nt=0;nt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=et.length&&(et=void 0),{value:et&&et[rt++],done:!et}}};throw new TypeError(o?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(et,o){var tt=typeof Symbol=="function"&&et[Symbol.iterator];if(!tt)return et;var rt=tt.call(et),nt,ot=[],it;try{for(;(o===void 0||o-- >0)&&!(nt=rt.next()).done;)ot.push(nt.value)}catch(st){it={error:st}}finally{try{nt&&!nt.done&&(tt=rt.return)&&tt.call(rt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var et=[],o=0;o1||at(mt,pt)})},ft&&(nt[mt]=ft(nt[mt])))}function at(mt,ft){try{ct(rt[mt](ft))}catch(pt){ht(ot[0][3],pt)}}function ct(mt){mt.value instanceof __await?Promise.resolve(mt.value.v).then(lt,dt):ht(ot[0][2],mt)}function lt(mt){at("next",mt)}function dt(mt){at("throw",mt)}function ht(mt,ft){mt(ft),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(et){var o,tt;return o={},rt("next"),rt("throw",function(nt){throw nt}),rt("return"),o[Symbol.iterator]=function(){return this},o;function rt(nt,ot){o[nt]=et[nt]?function(it){return(tt=!tt)?{value:__await(et[nt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(et){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=et[Symbol.asyncIterator],tt;return o?o.call(et):(et=typeof __values=="function"?__values(et):et[Symbol.iterator](),tt={},rt("next"),rt("throw"),rt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function rt(ot){tt[ot]=et[ot]&&function(it){return new Promise(function(st,at){it=et[ot](it),nt(st,at,it.done,it.value)})}}function nt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(et,o){return Object.defineProperty?Object.defineProperty(et,"raw",{value:o}):et.raw=o,et}var __setModuleDefault=Object.create?function(et,o){Object.defineProperty(et,"default",{enumerable:!0,value:o})}:function(et,o){et.default=o};function __importStar(et){if(et&&et.__esModule)return et;var o={};if(et!=null)for(var tt in et)tt!=="default"&&Object.prototype.hasOwnProperty.call(et,tt)&&__createBinding(o,et,tt);return __setModuleDefault(o,et),o}function __importDefault$1(et){return et&&et.__esModule?et:{default:et}}function __classPrivateFieldGet(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)}function __classPrivateFieldSet(et,o,tt,rt,nt){if(rt==="m")throw new TypeError("Private method is not writable");if(rt==="a"&&!nt)throw new TypeError("Private accessor was defined without a setter");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 rt==="a"?nt.call(et,tt):nt?nt.value=tt:o.set(et,tt),tt}function __classPrivateFieldIn(et,o){if(o===null||typeof o!="object"&&typeof o!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof et=="function"?o===et:et.has(o)}function __addDisposableResource(et,o,tt){if(o!=null){if(typeof o!="object"&&typeof o!="function")throw new TypeError("Object expected.");var rt,nt;if(tt){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");rt=o[Symbol.asyncDispose]}if(rt===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");rt=o[Symbol.dispose],tt&&(nt=rt)}if(typeof rt!="function")throw new TypeError("Object not disposable.");nt&&(rt=function(){try{nt.call(this)}catch(ot){return Promise.reject(ot)}}),et.stack.push({value:o,dispose:rt,async:tt})}else tt&&et.stack.push({async:!0});return o}var _SuppressedError=typeof SuppressedError=="function"?SuppressedError:function(et,o,tt){var rt=new Error(tt);return rt.name="SuppressedError",rt.error=et,rt.suppressed=o,rt};function __disposeResources(et){function o(ot){et.error=et.hasError?new _SuppressedError(ot,et.error,"An error was suppressed during disposal."):ot,et.hasError=!0}var tt,rt=0;function nt(){for(;tt=et.stack.pop();)try{if(!tt.async&&rt===1)return rt=0,et.stack.push(tt),Promise.resolve().then(nt);if(tt.dispose){var ot=tt.dispose.call(tt.value);if(tt.async)return rt|=2,Promise.resolve(ot).then(nt,function(it){return o(it),nt()})}else rt|=1}catch(it){o(it)}if(rt===1)return et.hasError?Promise.reject(et.error):Promise.resolve();if(et.hasError)throw et.error}return nt()}function __rewriteRelativeImportExtension(et,o){return typeof et=="string"&&/^\.\.?\//.test(et)?et.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(tt,rt,nt,ot,it){return rt?o?".jsx":".js":nt&&(!ot||!it)?tt:nt+ot+"."+it.toLowerCase()+"js"}):et}const tslib_es6={__extends,__assign,__rest,__decorate,__param,__esDecorate,__runInitializers,__propKey,__setFunctionName,__metadata,__awaiter,__generator,__createBinding,__exportStar,__values,__read,__spread,__spreadArrays,__spreadArray,__await,__asyncGenerator,__asyncDelegator,__asyncValues,__makeTemplateObject,__importStar,__importDefault:__importDefault$1,__classPrivateFieldGet,__classPrivateFieldSet,__classPrivateFieldIn,__addDisposableResource,__disposeResources,__rewriteRelativeImportExtension},tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter,__classPrivateFieldGet,__classPrivateFieldIn,__classPrivateFieldSet,__createBinding,__decorate,__disposeResources,__esDecorate,__exportStar,__extends,__generator,__importDefault:__importDefault$1,__importStar,__makeTemplateObject,__metadata,__param,__propKey,__read,__rest,__rewriteRelativeImportExtension,__runInitializers,__setFunctionName,__spread,__spreadArray,__spreadArrays,__values,default:tslib_es6},Symbol.toStringTag,{value:"Module"}));var define_process_default$2={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},define_process_env_default$1={},defaultEnvironment="production",env$1=typeof define_process_default$2>"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(et){return{isEnabled:function(o){return et.some(function(tt){return!!o[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(et){for(var o in et)et[o]!==null&&(o==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=et[o]:featureDefinitions[o].Component=et[o])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(et,o,tt){var rt=[],nt=reactExports.useContext(LazyContext);if(!o)return null;env$1!=="production"&&tt&&nt.strict;for(var ot=0;ot"u")return o;var tt=new Map;return new Proxy(o,{get:function(rt,nt){return tt.has(nt)||tt.set(nt,o(nt)),tt.get(nt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(et){return typeof et!="string"||et.includes("-")?!1:!!(lowercaseSVGElements.indexOf(et)>-1||/[A-Z]/.test(et))}var scaleCorrectors={};function addScaleCorrector(et){Object.assign(scaleCorrectors,et)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(et){return transformAxes.forEach(function(o){return transformProps.push(et+o)})});function sortTransformProps(et,o){return transformProps.indexOf(et)-transformProps.indexOf(o)}var transformPropSet=new Set(transformProps);function isTransformProp(et){return transformPropSet.has(et)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(et){return transformOriginProps.has(et)}function isForcedMotionValue(et,o){var tt=o.layout,rt=o.layoutId;return isTransformProp(et)||isTransformOriginProp(et)||(tt||rt!==void 0)&&(!!scaleCorrectors[et]||et==="opacity")}var isMotionValue=function(et){return!!(et!==null&&typeof et=="object"&&et.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(et,o,tt,rt){var nt=et.transform,ot=et.transformKeys,it=o.enableHardwareAcceleration,st=it===void 0?!0:it,at=o.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,mt=0;mttt=>Math.max(Math.min(tt,o),et),sanitize=et=>et%1?Number(et.toFixed(5)):et,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(et){return typeof et=="string"}const number$3={test:et=>typeof et=="number",parse:parseFloat,transform:et=>et},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=et=>({test:o=>isString(o)&&o.endsWith(et)&&o.split(" ").length===1,parse:parseFloat,transform:o=>`${o}${et}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:et=>percent.parse(et)/100,transform:et=>percent.transform(et*100)}),isColorString=(et,o)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(et)||o&&Object.prototype.hasOwnProperty.call(tt,o)),splitColor=(et,o,tt)=>rt=>{if(!isString(rt))return rt;const[nt,ot,it,st]=rt.match(floatRegex);return{[et]:parseFloat(nt),[o]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:et,saturation:o,lightness:tt,alpha:rt=1})=>"hsla("+Math.round(et)+", "+percent.transform(sanitize(o))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(rt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:et=>Math.round(clampRgbUnit(et))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:et,green:o,blue:tt,alpha:rt=1})=>"rgba("+rgbUnit.transform(et)+", "+rgbUnit.transform(o)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(rt))+")"};function parseHex(et){let o="",tt="",rt="",nt="";return et.length>5?(o=et.substr(1,2),tt=et.substr(3,2),rt=et.substr(5,2),nt=et.substr(7,2)):(o=et.substr(1,1),tt=et.substr(2,1),rt=et.substr(3,1),nt=et.substr(4,1),o+=o,tt+=tt,rt+=rt,nt+=nt),{red:parseInt(o,16),green:parseInt(tt,16),blue:parseInt(rt,16),alpha:nt?parseInt(nt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:et=>rgba.test(et)||hex.test(et)||hsla.test(et),parse:et=>rgba.test(et)?rgba.parse(et):hsla.test(et)?hsla.parse(et):hex.parse(et),transform:et=>isString(et)?et:et.hasOwnProperty("red")?rgba.transform(et):hsla.transform(et)},colorToken="${c}",numberToken="${n}";function test(et){var o,tt,rt,nt;return isNaN(et)&&isString(et)&&((tt=(o=et.match(floatRegex))===null||o===void 0?void 0:o.length)!==null&&tt!==void 0?tt:0)+((nt=(rt=et.match(colorRegex))===null||rt===void 0?void 0:rt.length)!==null&&nt!==void 0?nt:0)>0}function analyse$1(et){typeof et=="number"&&(et=`${et}`);const o=[];let tt=0;const rt=et.match(colorRegex);rt&&(tt=rt.length,et=et.replace(colorRegex,colorToken),o.push(...rt.map(color$1.parse)));const nt=et.match(floatRegex);return nt&&(et=et.replace(floatRegex,numberToken),o.push(...nt.map(number$3.parse))),{values:o,numColors:tt,tokenised:et}}function parse$4(et){return analyse$1(et).values}function createTransformer(et){const{values:o,numColors:tt,tokenised:rt}=analyse$1(et),nt=o.length;return ot=>{let it=rt;for(let st=0;sttypeof et=="number"?0:et;function getAnimatableNone$1(et){const o=parse$4(et);return createTransformer(et)(o.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(et){let[o,tt]=et.slice(0,-1).split("(");if(o==="drop-shadow")return et;const[rt]=tt.match(floatRegex)||[];if(!rt)return et;const nt=tt.replace(rt,"");let ot=maxDefaults.has(o)?1:0;return rt!==tt&&(ot*=100),o+"("+ot+nt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:et=>{const o=et.match(functionRegex);return o?o.map(applyDefaultFilter).join(" "):et}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(et,o,tt,rt){var nt,ot=et.style,it=et.vars,st=et.transform,at=et.transformKeys,ct=et.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var mt in o){var ft=o[mt];if(isCSSVariable$1(mt)){it[mt]=ft;continue}var pt=numberValueTypes[mt],yt=getValueAsType(ft,pt);if(isTransformProp(mt)){if(lt=!0,st[mt]=yt,at.push(mt),!ht)continue;ft!==((nt=pt.default)!==null&&nt!==void 0?nt:0)&&(ht=!1)}else isTransformOriginProp(mt)?(ct[mt]=yt,dt=!0):ot[mt]=yt}lt?ot.transform=buildTransform(et,tt,ht,rt):rt?ot.transform=rt({},""):!o.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(et,o,tt){for(var rt in o)!isMotionValue(o[rt])&&!isForcedMotionValue(rt,tt)&&(et[rt]=o[rt])}function useInitialMotionValues(et,o,tt){var rt=et.transformTemplate;return reactExports.useMemo(function(){var nt=createHtmlRenderState();buildHTMLStyles(nt,o,{enableHardwareAcceleration:!tt},rt);var ot=nt.vars,it=nt.style;return __assign(__assign({},ot),it)},[o])}function useStyle(et,o,tt){var rt=et.style||{},nt={};return copyRawValuesOnly(nt,rt,et),Object.assign(nt,useInitialMotionValues(et,o,tt)),et.transformValues&&(nt=et.transformValues(nt)),nt}function useHTMLProps(et,o,tt){var rt={},nt=useStyle(et,o,tt);return et.drag&&et.dragListener!==!1&&(rt.draggable=!1,nt.userSelect=nt.WebkitUserSelect=nt.WebkitTouchCallout="none",nt.touchAction=et.drag===!0?"none":"pan-".concat(et.drag==="x"?"y":"x")),rt.style=nt,rt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(et){return validMotionProps.has(et)}var shouldForward=function(et){return!isValidMotionProp(et)};function loadExternalIsValidProp(et){et&&(shouldForward=function(o){return o.startsWith("on")?!isValidMotionProp(o):et(o)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(et,o,tt){var rt={};for(var nt in et)(shouldForward(nt)||tt===!0&&isValidMotionProp(nt)||!o&&!isValidMotionProp(nt)||et.draggable&&nt.startsWith("onDrag"))&&(rt[nt]=et[nt]);return rt}function calcOrigin$1(et,o,tt){return typeof et=="string"?et:px.transform(o+tt*et)}function calcSVGTransformOrigin(et,o,tt){var rt=calcOrigin$1(o,et.x,et.width),nt=calcOrigin$1(tt,et.y,et.height);return"".concat(rt," ").concat(nt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(et,o,tt,rt,nt){tt===void 0&&(tt=1),rt===void 0&&(rt=0),et.pathLength=1;var ot=camelKeys;et[ot.offset]=px.transform(-rt);var it=px.transform(o),st=px.transform(tt);et[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(et,o,tt,rt){var nt=o.attrX,ot=o.attrY,it=o.originX,st=o.originY,at=o.pathLength,ct=o.pathSpacing,lt=ct===void 0?1:ct,dt=o.pathOffset,ht=dt===void 0?0:dt,mt=__rest(o,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(et,mt,tt,rt),et.attrs=et.style,et.style={};var ft=et.attrs,pt=et.style,yt=et.dimensions;ft.transform&&(yt&&(pt.transform=ft.transform),delete ft.transform),yt&&(it!==void 0||st!==void 0||pt.transform)&&(pt.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),nt!==void 0&&(ft.x=nt),ot!==void 0&&(ft.y=ot),at!==void 0&&buildSVGPath(ft,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(et,o){var tt=reactExports.useMemo(function(){var nt=createSvgRenderState();return buildSVGAttrs(nt,o,{enableHardwareAcceleration:!1},et.transformTemplate),__assign(__assign({},nt.attrs),{style:__assign({},nt.style)})},[o]);if(et.style){var rt={};copyRawValuesOnly(rt,et.style,et),tt.style=__assign(__assign({},rt),tt.style)}return tt}function createUseRender(et){et===void 0&&(et=!1);var o=function(tt,rt,nt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(rt,at,st),dt=filterProps(rt,typeof tt=="string",et),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return nt&&(ht["data-projection-id"]=nt),reactExports.createElement(tt,ht)};return o}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(et){return et.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(et,o,tt,rt){var nt=o.style,ot=o.vars;Object.assign(et.style,nt,rt&&rt.getProjectionStyles(tt));for(var it in ot)et.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(et,o,tt,rt){renderHTML(et,o,void 0,rt);for(var nt in o.attrs)et.setAttribute(camelCaseAttributes.has(nt)?nt:camelToDash(nt),o.attrs[nt])}function scrapeMotionValuesFromProps$1(et){var o=et.style,tt={};for(var rt in o)(isMotionValue(o[rt])||isForcedMotionValue(rt,et))&&(tt[rt]=o[rt]);return tt}function scrapeMotionValuesFromProps(et){var o=scrapeMotionValuesFromProps$1(et);for(var tt in et)if(isMotionValue(et[tt])){var rt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;o[rt]=et[tt]}return o}function isAnimationControls(et){return typeof et=="object"&&typeof et.start=="function"}var isKeyframesTarget=function(et){return Array.isArray(et)},isCustomValue=function(et){return!!(et&&typeof et=="object"&&et.mix&&et.toValue)},resolveFinalValueInKeyframes=function(et){return isKeyframesTarget(et)?et[et.length-1]||0:et};function resolveMotionValue(et){var o=isMotionValue(et)?et.get():et;return isCustomValue(o)?o.toValue():o}function makeState(et,o,tt,rt){var nt=et.scrapeMotionValuesFromProps,ot=et.createRenderState,it=et.onMount,st={latestValues:makeLatestValues(o,tt,rt,nt),renderState:ot()};return it&&(st.mount=function(at){return it(o,at,st)}),st}var makeUseVisualState=function(et){return function(o,tt){var rt=reactExports.useContext(MotionContext),nt=reactExports.useContext(PresenceContext);return tt?makeState(et,o,rt,nt):useConstant(function(){return makeState(et,o,rt,nt)})}};function makeLatestValues(et,o,tt,rt){var nt={},ot=(tt==null?void 0:tt.initial)===!1,it=rt(et);for(var st in it)nt[st]=resolveMotionValue(it[st]);var at=et.initial,ct=et.animate,lt=checkIfControllingVariants(et),dt=checkIfVariantNode(et);o&&dt&&!lt&&et.inherit!==!1&&(at??(at=o.initial),ct??(ct=o.animate));var ht=ot||at===!1,mt=ht?ct:at;if(mt&&typeof mt!="boolean"&&!isAnimationControls(mt)){var ft=Array.isArray(mt)?mt:[mt];ft.forEach(function(pt){var yt=resolveVariantFromProps(et,pt);if(yt){var gt=yt.transitionEnd;yt.transition;var bt=__rest(yt,["transitionEnd","transition"]);for(var xt in bt){var vt=bt[xt];if(Array.isArray(vt)){var Et=ht?vt.length-1:0;vt=vt[Et]}vt!==null&&(nt[xt]=vt)}for(var xt in gt)nt[xt]=gt[xt]}})}return nt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(et,o,tt){var rt=tt.renderState,nt=tt.latestValues;try{rt.dimensions=typeof o.getBBox=="function"?o.getBBox():o.getBoundingClientRect()}catch{rt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(rt,nt,{enableHardwareAcceleration:!1},et.transformTemplate),renderSVG(o,rt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(et,o,tt,rt,nt){var ot=o.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(et)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:rt,projectionNodeConstructor:nt,Component:et})}var AnimationType;(function(et){et.Animate="animate",et.Hover="whileHover",et.Tap="whileTap",et.Drag="whileDrag",et.Focus="whileFocus",et.InView="whileInView",et.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(et,o,tt,rt){return rt===void 0&&(rt={passive:!0}),et.addEventListener(o,tt,rt),function(){return et.removeEventListener(o,tt)}}function useDomEvent(et,o,tt,rt){reactExports.useEffect(function(){var nt=et.current;if(tt&&nt)return addDomEvent(nt,o,tt,rt)},[et,o,tt,rt])}function useFocusGesture(et){var o=et.whileFocus,tt=et.visualElement,rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",o?rt:void 0),useDomEvent(tt,"blur",o?nt:void 0)}function isMouseEvent(et){return typeof PointerEvent<"u"&&et instanceof PointerEvent?et.pointerType==="mouse":et instanceof MouseEvent}function isTouchEvent(et){var o=!!et.touches;return o}function filterPrimaryPointer(et){return function(o){var tt=o instanceof MouseEvent,rt=!tt||tt&&o.button===0;rt&&et(o)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(et,o){o===void 0&&(o="page");var tt=et.touches[0]||et.changedTouches[0],rt=tt||defaultPagePoint;return{x:rt[o+"X"],y:rt[o+"Y"]}}function pointFromMouse(et,o){return o===void 0&&(o="page"),{x:et[o+"X"],y:et[o+"Y"]}}function extractEventInfo(et,o){return o===void 0&&(o="page"),{point:isTouchEvent(et)?pointFromTouch(et,o):pointFromMouse(et,o)}}var wrapHandler=function(et,o){o===void 0&&(o=!1);var tt=function(rt){return et(rt,extractEventInfo(rt))};return o?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(et){return supportsPointerEvents()?et:supportsTouchEvents()?touchEventNames[et]:supportsMouseEvents()?mouseEventNames[et]:et}function addPointerEvent(et,o,tt,rt){return addDomEvent(et,getPointerEventName(o),wrapHandler(tt,o==="pointerdown"),rt)}function usePointerEvent(et,o,tt,rt){return useDomEvent(et,getPointerEventName(o),tt&&wrapHandler(tt,o==="pointerdown"),rt)}function createLock(et){var o=null;return function(){var tt=function(){o=null};return o===null?(o=et,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(et){var o=!1;if(et==="y")o=globalVerticalLock();else if(et==="x")o=globalHorizontalLock();else{var tt=globalHorizontalLock(),rt=globalVerticalLock();tt&&rt?o=function(){tt(),rt()}:(tt&&tt(),rt&&rt())}return o}function isDragActive(){var et=getGlobalLock(!0);return et?(et(),!1):!0}function createHoverEvent(et,o,tt){return function(rt,nt){var ot;!isMouseEvent(rt)||isDragActive()||((ot=et.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,o),tt==null||tt(rt,nt))}}function useHoverGesture(et){var o=et.onHoverStart,tt=et.onHoverEnd,rt=et.whileHover,nt=et.visualElement;usePointerEvent(nt,"pointerenter",o||rt?createHoverEvent(nt,!0,o):void 0,{passive:!o}),usePointerEvent(nt,"pointerleave",tt||rt?createHoverEvent(nt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(et,o){return o?et===o?!0:isNodeOrChild(et,o.parentElement):!1};function useUnmountEffect(et){return reactExports.useEffect(function(){return function(){return et()}},[])}const clamp$1=(et,o,tt)=>Math.min(Math.max(tt,et),o),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:et=800,bounce:o=.25,velocity:tt=0,mass:rt=1}){let nt,ot,it=1-o;it=clamp$1(minDamping,maxDamping,it),et=clamp$1(minDuration,maxDuration,et/1e3),it<1?(nt=ct=>{const lt=ct*it,dt=lt*et,ht=lt-tt,mt=calcAngularFreq(ct,it),ft=Math.exp(-dt);return safeMin-ht/mt*ft},ot=ct=>{const dt=ct*it*et,ht=dt*tt+tt,mt=Math.pow(it,2)*Math.pow(ct,2)*et,ft=Math.exp(-dt),pt=calcAngularFreq(Math.pow(ct,2),it);return(-nt(ct)+safeMin>0?-1:1)*((ht-mt)*ft)/pt}):(nt=ct=>{const lt=Math.exp(-ct*et),dt=(ct-tt)*et+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*et),dt=(tt-ct)*(et*et);return lt*dt});const st=5/et,at=approximateRoot(nt,ot,st);if(et=et*1e3,isNaN(at))return{stiffness:100,damping:10,duration:et};{const ct=Math.pow(at,2)*rt;return{stiffness:ct,damping:it*2*Math.sqrt(rt*ct),duration:et}}}const rootIterations=12;function approximateRoot(et,o,tt){let rt=tt;for(let nt=1;ntet[tt]!==void 0)}function getSpringOptions(et){let o=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},et);if(!isSpringType(et,physicsKeys)&&isSpringType(et,durationKeys)){const tt=findSpring(et);o=Object.assign(Object.assign(Object.assign({},o),tt),{velocity:0,mass:1}),o.isResolvedFromDuration=!0}return o}function spring(et){var{from:o=0,to:tt=1,restSpeed:rt=2,restDelta:nt}=et,ot=__rest(et,["from","to","restSpeed","restDelta"]);const it={done:!1,value:o};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),mt=zero$1,ft=zero$1;function pt(){const yt=lt?-(lt/1e3):0,gt=tt-o,bt=at/(2*Math.sqrt(st*ct)),xt=Math.sqrt(st/ct)/1e3;if(nt===void 0&&(nt=Math.min(Math.abs(tt-o)/100,.4)),bt<1){const vt=calcAngularFreq(xt,bt);mt=Et=>{const Ct=Math.exp(-bt*xt*Et);return tt-Ct*((yt+bt*xt*gt)/vt*Math.sin(vt*Et)+gt*Math.cos(vt*Et))},ft=Et=>{const Ct=Math.exp(-bt*xt*Et);return bt*xt*Ct*(Math.sin(vt*Et)*(yt+bt*xt*gt)/vt+gt*Math.cos(vt*Et))-Ct*(Math.cos(vt*Et)*(yt+bt*xt*gt)-vt*gt*Math.sin(vt*Et))}}else if(bt===1)mt=vt=>tt-Math.exp(-xt*vt)*(gt+(yt+xt*gt)*vt);else{const vt=xt*Math.sqrt(bt*bt-1);mt=Et=>{const Ct=Math.exp(-bt*xt*Et),St=Math.min(vt*Et,300);return tt-Ct*((yt+bt*xt*gt)*Math.sinh(St)+vt*gt*Math.cosh(St))/vt}}}return pt(),{next:yt=>{const gt=mt(yt);if(ht)it.done=yt>=dt;else{const bt=ft(yt)*1e3,xt=Math.abs(bt)<=rt,vt=Math.abs(tt-gt)<=nt;it.done=xt&&vt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[o,tt]=[tt,o],pt()}}}spring.needsInterpolation=(et,o)=>typeof et=="string"||typeof o=="string";const zero$1=et=>0,progress=(et,o,tt)=>{const rt=o-et;return rt===0?1:(tt-et)/rt},mix=(et,o,tt)=>-tt*et+tt*o+et;function hueToRgb(et,o,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?et+(o-et)*6*tt:tt<1/2?o:tt<2/3?et+(o-et)*(2/3-tt)*6:et}function hslaToRgba({hue:et,saturation:o,lightness:tt,alpha:rt}){et/=360,o/=100,tt/=100;let nt=0,ot=0,it=0;if(!o)nt=ot=it=tt;else{const st=tt<.5?tt*(1+o):tt+o-tt*o,at=2*tt-st;nt=hueToRgb(at,st,et+1/3),ot=hueToRgb(at,st,et),it=hueToRgb(at,st,et-1/3)}return{red:Math.round(nt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:rt}}const mixLinearColor=(et,o,tt)=>{const rt=et*et,nt=o*o;return Math.sqrt(Math.max(0,tt*(nt-rt)+rt))},colorTypes=[hex,rgba,hsla],getColorType=et=>colorTypes.find(o=>o.test(et)),mixColor=(et,o)=>{let tt=getColorType(et),rt=getColorType(o),nt=tt.parse(et),ot=rt.parse(o);tt===hsla&&(nt=hslaToRgba(nt),tt=rgba),rt===hsla&&(ot=hslaToRgba(ot),rt=rgba);const it=Object.assign({},nt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(nt[at],ot[at],st));return it.alpha=mix(nt.alpha,ot.alpha,st),tt.transform(it)}},isNum=et=>typeof et=="number",combineFunctions=(et,o)=>tt=>o(et(tt)),pipe$1=(...et)=>et.reduce(combineFunctions);function getMixer(et,o){return isNum(et)?tt=>mix(et,o,tt):color$1.test(et)?mixColor(et,o):mixComplex(et,o)}const mixArray=(et,o)=>{const tt=[...et],rt=tt.length,nt=et.map((ot,it)=>getMixer(ot,o[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},et),o),rt={};for(const nt in tt)et[nt]!==void 0&&o[nt]!==void 0&&(rt[nt]=getMixer(et[nt],o[nt]));return nt=>{for(const ot in rt)tt[ot]=rt[ot](nt);return tt}};function analyse(et){const o=complex.parse(et),tt=o.length;let rt=0,nt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(o),rt=analyse(et),nt=analyse(o);return rt.numHSL===nt.numHSL&&rt.numRGB===nt.numRGB&&rt.numNumbers>=nt.numNumbers?pipe$1(mixArray(rt.parsed,nt.parsed),tt):it=>`${it>0?o:et}`},mixNumber=(et,o)=>tt=>mix(et,o,tt);function detectMixerFactory(et){if(typeof et=="number")return mixNumber;if(typeof et=="string")return color$1.test(et)?mixColor:mixComplex;if(Array.isArray(et))return mixArray;if(typeof et=="object")return mixObject}function createMixers(et,o,tt){const rt=[],nt=tt||detectMixerFactory(et[0]),ot=et.length-1;for(let it=0;ittt(progress(et,o,rt))}function slowInterpolate(et,o){const tt=et.length,rt=tt-1;return nt=>{let ot=0,it=!1;if(nt<=et[0]?it=!0:nt>=et[rt]&&(ot=rt-1,it=!0),!it){let at=1;for(;atnt||at===rt);at++);ot=at-1}const st=progress(et[ot],et[ot+1],nt);return o[ot](st)}}function interpolate(et,o,{clamp:tt=!0,ease:rt,mixer:nt}={}){const ot=et.length;invariant$1(ot===o.length),invariant$1(!rt||!Array.isArray(rt)||rt.length===ot-1),et[0]>et[ot-1]&&(et=[].concat(et),o=[].concat(o),et.reverse(),o.reverse());const it=createMixers(o,rt,nt),st=ot===2?fastInterpolate(et,it):slowInterpolate(et,it);return tt?at=>st(clamp$1(et[0],et[ot-1],at)):st}const reverseEasing=et=>o=>1-et(1-o),mirrorEasing=et=>o=>o<=.5?et(2*o)/2:(2-et(2*(1-o)))/2,createExpoIn=et=>o=>Math.pow(o,et),createBackIn=et=>o=>o*o*((et+1)*o-et),createAnticipate=et=>{const o=createBackIn(et);return tt=>(tt*=2)<1?.5*o(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=et=>et,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=et=>1-Math.sin(Math.acos(et)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=et=>{if(et===1||et===0)return et;const o=et*et;return etet<.5?.5*(1-bounceOut(1-et*2)):.5*bounceOut(et*2-1)+.5;function defaultEasing(et,o){return et.map(()=>o||easeInOut).splice(0,et.length-1)}function defaultOffset(et){const o=et.length;return et.map((tt,rt)=>rt!==0?rt/(o-1):0)}function convertOffsetToTimes(et,o){return et.map(tt=>tt*o)}function keyframes$1({from:et=0,to:o=1,ease:tt,offset:rt,duration:nt=300}){const ot={done:!1,value:et},it=Array.isArray(o)?o:[et,o],st=convertOffsetToTimes(rt&&rt.length===it.length?rt:defaultOffset(it),nt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=nt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:et=0,from:o=0,power:tt=.8,timeConstant:rt=350,restDelta:nt=.5,modifyTarget:ot}){const it={done:!1,value:o};let st=tt*et;const at=o+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-o),{next:lt=>{const dt=-st*Math.exp(-lt/rt);return it.done=!(dt>nt||dt<-nt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(et){if(Array.isArray(et.to))return keyframes$1;if(types$3[et.type])return types$3[et.type];const o=new Set(Object.keys(et));return o.has("ease")||o.has("duration")&&!o.has("dampingRatio")?keyframes$1:o.has("dampingRatio")||o.has("stiffness")||o.has("mass")||o.has("damping")||o.has("restSpeed")||o.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?et=>window.requestAnimationFrame(et):et=>setTimeout(()=>et(getCurrentTime()),defaultTimestep);function createRenderStep(et){let o=[],tt=[],rt=0,nt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&nt,ht=dt?o:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&nt&&(rt=o.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(nt){ot=!0;return}if(nt=!0,[o,tt]=[tt,o],tt.length=0,rt=o.length,rt)for(let ct=0;ct(et[o]=createRenderStep(()=>runNextFrame=!0),et),{}),sync=stepsOrder.reduce((et,o)=>{const tt=steps[o];return et[o]=(rt,nt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(rt,nt,ot)),et},{}),cancelSync=stepsOrder.reduce((et,o)=>(et[o]=steps[o].cancel,et),{}),flushSync=stepsOrder.reduce((et,o)=>(et[o]=()=>steps[o].process(frame),et),{}),processStep=et=>steps[et].process(frame),processFrame=et=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(et-frame.timestamp,maxElapsed),1),frame.timestamp=et,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(et,o,tt=0){return et-o-tt}function reverseElapsed(et,o,tt=0,rt=!0){return rt?loopElapsed(o+-et,o,tt):o-(et-o)+tt}function hasRepeatDelayElapsed(et,o,tt,rt){return rt?et>=o+tt:et<=-tt}const framesync=et=>{const o=({delta:tt})=>et(tt);return{start:()=>sync.update(o,!0),stop:()=>cancelSync.update(o)}};function animate$1(et){var o,tt,{from:rt,autoplay:nt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:mt,onUpdate:ft}=et,pt=__rest(et,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=pt,gt,bt=0,xt=pt.duration,vt,Et=!1,Ct=!0,St;const At=detectAnimationFromOptions(pt);!((tt=(o=At).needsInterpolation)===null||tt===void 0)&&tt.call(o,rt,yt)&&(St=interpolate([0,100],[rt,yt],{clamp:!1}),rt=0,yt=100);const kt=At(Object.assign(Object.assign({},pt),{from:rt,to:yt}));function It(){bt++,at==="reverse"?(Ct=bt%2===0,it=reverseElapsed(it,xt,ct,Ct)):(it=loopElapsed(it,xt,ct),at==="mirror"&&kt.flipTarget()),Et=!1,mt&&mt()}function Nt(){gt.stop(),ht&&ht()}function Lt(zt){if(Ct||(zt=-zt),it+=zt,!Et){const Ut=kt.next(Math.max(0,it));vt=Ut.value,St&&(vt=St(vt)),Et=Ct?Ut.done:it<=0}ft==null||ft(vt),Et&&(bt===0&&(xt??(xt=it)),bt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(et,o){return o?et*(1e3/o):0}function inertia({from:et=0,velocity:o=0,min:tt,max:rt,power:nt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:mt}){let ft;function pt(xt){return tt!==void 0&&xtrt}function yt(xt){return tt===void 0?rt:rt===void 0||Math.abs(tt-xt){var Et;dt==null||dt(vt),(Et=xt.onUpdate)===null||Et===void 0||Et.call(xt,vt)},onComplete:ht,onStop:mt}))}function bt(xt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},xt))}if(pt(et))bt({from:et,velocity:o,to:yt(et)});else{let xt=nt*o+et;typeof ct<"u"&&(xt=ct(xt));const vt=yt(xt),Et=vt===tt?-1:1;let Ct,St;const At=kt=>{Ct=St,St=kt,o=velocityPerSecond(kt-Ct,getFrameData().delta),(Et===1&&kt>vt||Et===-1&&ktft==null?void 0:ft.stop()}}const isPoint=et=>et.hasOwnProperty("x")&&et.hasOwnProperty("y"),isPoint3D=et=>isPoint(et)&&et.hasOwnProperty("z"),distance1D=(et,o)=>Math.abs(et-o);function distance(et,o){if(isNum(et)&&isNum(o))return distance1D(et,o);if(isPoint(et)&&isPoint(o)){const tt=distance1D(et.x,o.x),rt=distance1D(et.y,o.y),nt=isPoint3D(et)&&isPoint3D(o)?distance1D(et.z,o.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(rt,2)+Math.pow(nt,2))}}const a=(et,o)=>1-3*o+3*et,b$3=(et,o)=>3*o-6*et,c$2=et=>3*et,calcBezier=(et,o,tt)=>((a(o,tt)*et+b$3(o,tt))*et+c$2(o))*et,getSlope=(et,o,tt)=>3*a(o,tt)*et*et+2*b$3(o,tt)*et+c$2(o),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(et,o,tt,rt,nt){let ot,it,st=0;do it=o+(tt-o)/2,ot=calcBezier(it,rt,nt)-et,ot>0?tt=it:o=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,et,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,et,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),o,rt)}function useTapGesture(et){var o=et.onTap,tt=et.onTapStart,rt=et.onTapCancel,nt=et.whileTap,ot=et.visualElement,it=o||tt||rt||nt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||o||rt||ft)};function lt(){var pt;(pt=at.current)===null||pt===void 0||pt.call(at),at.current=null}function dt(){var pt;return lt(),st.current=!1,(pt=ot.animationState)===null||pt===void 0||pt.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(pt,yt){dt()&&(isNodeOrChild(ot.getInstance(),pt.target)?o==null||o(pt,yt):rt==null||rt(pt,yt))}function mt(pt,yt){dt()&&(rt==null||rt(pt,yt))}function ft(pt,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",mt,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(pt,yt))}usePointerEvent(ot,"pointerdown",it?ft:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce(et,o,tt){warned.has(o)||(console.warn(o),warned.add(o))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(et){var o;(o=observerCallbacks.get(et.target))===null||o===void 0||o(et)},fireAllObserverCallbacks=function(et){et.forEach(fireObserverCallback)};function initIntersectionObserver(et){var o=et.root,tt=__rest(et,["root"]),rt=o||document;observers$1.has(rt)||observers$1.set(rt,{});var nt=observers$1.get(rt),ot=JSON.stringify(tt);return nt[ot]||(nt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:o},tt))),nt[ot]}function observeIntersection(et,o,tt){var rt=initIntersectionObserver(o);return observerCallbacks.set(et,tt),rt.observe(et),function(){observerCallbacks.delete(et),rt.unobserve(et)}}function useViewport(et){var o=et.visualElement,tt=et.whileInView,rt=et.onViewportEnter,nt=et.onViewportLeave,ot=et.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||rt||nt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,o,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(et,o,tt,rt){var nt=rt.root,ot=rt.margin,it=rt.amount,st=it===void 0?"some":it,at=rt.once;reactExports.useEffect(function(){if(et){var ct={root:nt==null?void 0:nt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,mt=dt.isIntersecting;if(o.isInView!==mt&&(o.isInView=mt,!(at&&!mt&&o.hasEnteredView))){mt&&(o.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,mt);var ft=tt.getProps(),pt=mt?ft.onViewportEnter:ft.onViewportLeave;pt==null||pt(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[et,nt,ot,st])}function useMissingIntersectionObserver(et,o,tt,rt){var nt=rt.fallback,ot=nt===void 0?!0:nt;reactExports.useEffect(function(){!et||!ot||(env$1!=="production"&&warnOnce(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;o.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[et])}var makeRenderlessComponent=function(et){return function(o){return et(o),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var et=reactExports.useContext(PresenceContext);if(et===null)return[!0,null];var o=et.isPresent,tt=et.onExitComplete,rt=et.register,nt=useId$1();reactExports.useEffect(function(){return rt(nt)},[]);var ot=function(){return tt==null?void 0:tt(nt)};return!o&&tt?[!1,ot]:[!0]}function shallowCompare(et,o){if(!Array.isArray(o))return!1;var tt=o.length;if(tt!==et.length)return!1;for(var rt=0;rt-1&&et.splice(tt,1)}var SubscriptionManager$1=function(){function et(){this.subscriptions=[]}return et.prototype.add=function(o){var tt=this;return addUniqueItem(this.subscriptions,o),function(){return removeItem(tt.subscriptions,o)}},et.prototype.notify=function(o,tt,rt){var nt=this.subscriptions.length;if(nt)if(nt===1)this.subscriptions[0](o,tt,rt);else for(var ot=0;otbt&&Nt,Xt=Array.isArray(It)?It:[It],Wt=Xt.reduce(ot,{});Lt===!1&&(Wt={});var Ft=kt.prevResolvedValues,qt=Ft===void 0?{}:Ft,Pt=__assign(__assign({},qt),Wt),Yt=function(rr){Ut=!0,yt.delete(rr),kt.needsAnimating[rr]=!0};for(var Qt in Pt){var jt=Wt[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(jt!==Gt?isKeyframesTarget(jt)&&isKeyframesTarget(Gt)?!shallowCompare(jt,Gt)||zt?Yt(Qt):kt.protectedKeys[Qt]=!0:jt!==void 0?Yt(Qt):yt.add(Qt):jt!==void 0&&yt.has(Qt)?Yt(Qt):kt.protectedKeys[Qt]=!0)}kt.prevProp=It,kt.prevResolvedValues=Wt,kt.isActive&&(gt=__assign(__assign({},gt),Wt)),nt&&et.blockInitialAnimation&&(Ut=!1),Ut&&!Mt&&pt.push.apply(pt,__spreadArray([],__read(Xt.map(function(rr){return{animation:rr,options:__assign({type:At},lt)}})),!1))},vt=0;vt=3;if(!(!mt&&!ft)){var pt=ht.point,yt=getFrameData().timestamp;nt.history.push(__assign(__assign({},pt),{timestamp:yt}));var gt=nt.handlers,bt=gt.onStart,xt=gt.onMove;mt||(bt&&bt(nt.lastMoveEvent,ht),nt.startEvent=nt.lastMoveEvent),xt&&xt(nt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,mt){if(nt.lastMoveEvent=ht,nt.lastMoveEventInfo=transformPoint(mt,nt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){nt.handlePointerUp(ht,mt);return}sync.update(nt.updatePoint,!0)},this.handlePointerUp=function(ht,mt){nt.end();var ft=nt.handlers,pt=ft.onEnd,yt=ft.onSessionEnd,gt=getPanInfo(transformPoint(mt,nt.transformPagePoint),nt.history);nt.startEvent&&pt&&pt(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(o)&&o.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(o),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(o,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return et.prototype.updateHandlers=function(o){this.handlers=o},et.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},et}();function transformPoint(et,o){return o?{point:o(et.point)}:et}function subtractPoint(et,o){return{x:et.x-o.x,y:et.y-o.y}}function getPanInfo(et,o){var tt=et.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(o)),offset:subtractPoint(tt,startDevicePoint(o)),velocity:getVelocity(o,.1)}}function startDevicePoint(et){return et[0]}function lastDevicePoint(et){return et[et.length-1]}function getVelocity(et,o){if(et.length<2)return{x:0,y:0};for(var tt=et.length-1,rt=null,nt=lastDevicePoint(et);tt>=0&&(rt=et[tt],!(nt.timestamp-rt.timestamp>secondsToMilliseconds(o)));)tt--;if(!rt)return{x:0,y:0};var ot=(nt.timestamp-rt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(nt.x-rt.x)/ot,y:(nt.y-rt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(et){return et.max-et.min}function isNear(et,o,tt){return o===void 0&&(o=0),tt===void 0&&(tt=.01),distance(et,o)nt&&(et=tt?mix(nt,et,tt.max):Math.min(et,nt)),et}function calcRelativeAxisConstraints(et,o,tt){return{min:o!==void 0?et.min+o:void 0,max:tt!==void 0?et.max+tt-(et.max-et.min):void 0}}function calcRelativeConstraints(et,o){var tt=o.top,rt=o.left,nt=o.bottom,ot=o.right;return{x:calcRelativeAxisConstraints(et.x,rt,ot),y:calcRelativeAxisConstraints(et.y,tt,nt)}}function calcViewportAxisConstraints(et,o){var tt,rt=o.min-et.min,nt=o.max-et.max;return o.max-o.minrt?tt=progress(o.min,o.max-rt,et.min):rt>nt&&(tt=progress(et.min,et.max-nt,o.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(et,o){var tt={};return o.min!==void 0&&(tt.min=o.min-et.min),o.max!==void 0&&(tt.max=o.max-et.min),tt}var defaultElastic=.35;function resolveDragElastic(et){return et===void 0&&(et=defaultElastic),et===!1?et=0:et===!0&&(et=defaultElastic),{x:resolveAxisElastic(et,"left","right"),y:resolveAxisElastic(et,"top","bottom")}}function resolveAxisElastic(et,o,tt){return{min:resolvePointElastic(et,o),max:resolvePointElastic(et,tt)}}function resolvePointElastic(et,o){var tt;return typeof et=="number"?et:(tt=et[o])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(et){return[et("x"),et("y")]}function convertBoundingBoxToBox(et){var o=et.top,tt=et.left,rt=et.right,nt=et.bottom;return{x:{min:tt,max:rt},y:{min:o,max:nt}}}function convertBoxToBoundingBox(et){var o=et.x,tt=et.y;return{top:tt.min,right:o.max,bottom:tt.max,left:o.min}}function transformBoxPoints(et,o){if(!o)return et;var tt=o({x:et.left,y:et.top}),rt=o({x:et.right,y:et.bottom});return{top:tt.y,left:tt.x,bottom:rt.y,right:rt.x}}function isIdentityScale(et){return et===void 0||et===1}function hasScale(et){var o=et.scale,tt=et.scaleX,rt=et.scaleY;return!isIdentityScale(o)||!isIdentityScale(tt)||!isIdentityScale(rt)}function hasTransform(et){return hasScale(et)||hasTranslate(et.x)||hasTranslate(et.y)||et.z||et.rotate||et.rotateX||et.rotateY}function hasTranslate(et){return et&&et!=="0%"}function scalePoint(et,o,tt){var rt=et-tt,nt=o*rt;return tt+nt}function applyPointDelta(et,o,tt,rt,nt){return nt!==void 0&&(et=scalePoint(et,nt,rt)),scalePoint(et,tt,rt)+o}function applyAxisDelta(et,o,tt,rt,nt){o===void 0&&(o=0),tt===void 0&&(tt=1),et.min=applyPointDelta(et.min,o,tt,rt,nt),et.max=applyPointDelta(et.max,o,tt,rt,nt)}function applyBoxDelta(et,o){var tt=o.x,rt=o.y;applyAxisDelta(et.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(et.y,rt.translate,rt.scale,rt.originPoint)}function applyTreeDeltas(et,o,tt,rt){var nt,ot;rt===void 0&&(rt=!1);var it=tt.length;if(it){o.x=o.y=1;for(var st,at,ct=0;cto?tt="y":Math.abs(et.x)>o&&(tt="x"),tt}function useDrag(et){var o=et.dragControls,tt=et.visualElement,rt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return o&&o.subscribe(rt)},[rt,o]),reactExports.useEffect(function(){return rt.addListeners()},[rt])}function usePanGesture(et){var o=et.onPan,tt=et.onPanStart,rt=et.onPanEnd,nt=et.onPanSessionStart,ot=et.visualElement,it=o||tt||rt||nt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:nt,onStart:tt,onMove:o,onEnd:function(dt,ht){st.current=null,rt&&rt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var et=names$1.map(function(){return new SubscriptionManager$1}),o={},tt={clearAllListeners:function(){return et.forEach(function(rt){return rt.clear()})},updatePropListeners:function(rt){names$1.forEach(function(nt){var ot,it="on"+nt,st=rt[it];(ot=o[nt])===null||ot===void 0||ot.call(o),st&&(o[nt]=tt[it](st))})}};return et.forEach(function(rt,nt){tt["on"+names$1[nt]]=function(ot){return rt.add(ot)},tt["notify"+names$1[nt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(o,et,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],mt=dt[1];et.getValue(ht).set(mt)}),et.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:rt}}else return{target:o,transitionEnd:rt}};function unitConversion(et,o,tt,rt){return hasPositionalKey(o)?checkAndConvertChangedValueTypes(et,o,tt,rt):{target:o,transitionEnd:rt}}var parseDomVariant=function(et,o,tt,rt){var nt=resolveCSSVariables(et,o,rt);return o=nt.target,rt=nt.transitionEnd,unitConversion(et,o,tt,rt)};function getComputedStyle$1(et){return window.getComputedStyle(et)}var htmlConfig={treeType:"dom",readValueFromInstance:function(et,o){if(isTransformProp(o)){var tt=getDefaultValueType(o);return tt&&tt.default||0}else{var rt=getComputedStyle$1(et);return(isCSSVariable$1(o)?rt.getPropertyValue(o):rt[o])||0}},sortNodePosition:function(et,o){return et.compareDocumentPosition(o)&2?1:-1},getBaseTarget:function(et,o){var tt;return(tt=et.style)===null||tt===void 0?void 0:tt[o]},measureViewportBox:function(et,o){var tt=o.transformPagePoint;return measureViewportBox(et,tt)},resetTransform:function(et,o,tt){var rt=tt.transformTemplate;o.style.transform=rt?rt({},""):"none",et.scheduleRender()},restoreTransform:function(et,o){et.style.transform=o.style.transform},removeValueFromRenderState:function(et,o){var tt=o.vars,rt=o.style;delete tt[et],delete rt[et]},makeTargetAnimatable:function(et,o,tt,rt){var nt=tt.transformValues;rt===void 0&&(rt=!0);var ot=o.transition,it=o.transitionEnd,st=__rest(o,["transition","transitionEnd"]),at=getOrigin(st,ot||{},et);if(nt&&(it&&(it=nt(it)),st&&(st=nt(st)),at&&(at=nt(at))),rt){checkTargetForNewValues(et,st,at);var ct=parseDomVariant(et,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(et,o,tt,rt,nt){et.isVisible!==void 0&&(o.style.visibility=et.isVisible?"visible":"hidden"),buildHTMLStyles(o,tt,rt,nt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(et,o){return et[o]},readValueFromInstance:function(et,o){var tt;return isTransformProp(o)?((tt=getDefaultValueType(o))===null||tt===void 0?void 0:tt.default)||0:(o=camelCaseAttributes.has(o)?o:camelToDash(o),et.getAttribute(o))},scrapeMotionValuesFromProps,build:function(et,o,tt,rt,nt){buildSVGAttrs(o,tt,rt,nt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(et,o){return isSVGComponent(et)?svgVisualElement(o,{enableHardwareAcceleration:!1}):htmlVisualElement(o,{enableHardwareAcceleration:!0})};function pixelsToPercent(et,o){return o.max===o.min?0:et/(o.max-o.min)*100}var correctBorderRadius={correct:function(et,o){if(!o.target)return et;if(typeof et=="string")if(px.test(et))et=parseFloat(et);else return et;var tt=pixelsToPercent(et,o.target.x),rt=pixelsToPercent(et,o.target.y);return"".concat(tt,"% ").concat(rt,"%")}},varToken="_$css",correctBoxShadow={correct:function(et,o){var tt=o.treeScale,rt=o.projectionDelta,nt=et,ot=et.includes("var("),it=[];ot&&(et=et.replace(cssVariableRegex,function(pt){return it.push(pt),varToken}));var st=complex.parse(et);if(st.length>5)return nt;var at=complex.createTransformer(et),ct=typeof st[0]!="number"?1:0,lt=rt.x.scale*tt.x,dt=rt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var mt=at(st);if(ot){var ft=0;mt=mt.replace(varToken,function(){var pt=it[ft];return ft++,pt})}return mt}},MeasureLayoutWithContext=function(et){__extends(o,et);function o(){return et!==null&&et.apply(this,arguments)||this}return o.prototype.componentDidMount=function(){var tt=this,rt=this.props,nt=rt.visualElement,ot=rt.layoutGroup,it=rt.switchLayoutGroup,st=rt.layoutId,at=nt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},o.prototype.getSnapshotBeforeUpdate=function(tt){var rt=this,nt=this.props,ot=nt.layoutDependency,it=nt.visualElement,st=nt.drag,at=nt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||rt.safeToRemove()}))),null},o.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},o.prototype.componentWillUnmount=function(){var tt=this.props,rt=tt.visualElement,nt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=rt.projection;it&&(it.scheduleCheckAfterUnmount(),nt!=null&&nt.group&&nt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},o.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},o.prototype.render=function(){return null},o}(React.Component);function MeasureLayout(et){var o=__read(usePresence$1(),2),tt=o[0],rt=o[1],nt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},et,{layoutGroup:nt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:rt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(et,o,tt){tt===void 0&&(tt={});var rt=isMotionValue(et)?et:motionValue(et);return startAnimation("",rt,o,tt),{stop:function(){return rt.stop()},isAnimating:function(){return rt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(et){return typeof et=="string"?parseFloat(et):et},isPx=function(et){return typeof et=="number"||px.test(et)};function mixValues(et,o,tt,rt,nt,ot){var it,st,at,ct;nt?(et.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(rt)),et.opacityExit=mix((st=o.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(rt))):ot&&(et.opacity=mix((at=o.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,rt));for(var lt=0;lto?1:tt(progress(et,o,rt))}}function copyAxisInto(et,o){et.min=o.min,et.max=o.max}function copyBoxInto(et,o){copyAxisInto(et.x,o.x),copyAxisInto(et.y,o.y)}function removePointDelta(et,o,tt,rt,nt){return et-=o,et=scalePoint(et,1/tt,rt),nt!==void 0&&(et=scalePoint(et,1/nt,rt)),et}function removeAxisDelta(et,o,tt,rt,nt,ot,it){if(o===void 0&&(o=0),tt===void 0&&(tt=1),rt===void 0&&(rt=.5),ot===void 0&&(ot=et),it===void 0&&(it=et),percent.test(o)){o=parseFloat(o);var st=mix(it.min,it.max,o/100);o=st-it.min}if(typeof o=="number"){var at=mix(ot.min,ot.max,rt);et===ot&&(at-=o),et.min=removePointDelta(et.min,o,tt,at,nt),et.max=removePointDelta(et.max,o,tt,at,nt)}}function removeAxisTransforms(et,o,tt,rt,nt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(et,o[it],o[st],o[at],o.scale,rt,nt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(et,o,tt,rt){removeAxisTransforms(et.x,o,xKeys,tt==null?void 0:tt.x,rt==null?void 0:rt.x),removeAxisTransforms(et.y,o,yKeys,tt==null?void 0:tt.y,rt==null?void 0:rt.y)}function isAxisDeltaZero(et){return et.translate===0&&et.scale===1}function isDeltaZero(et){return isAxisDeltaZero(et.x)&&isAxisDeltaZero(et.y)}function boxEquals(et,o){return et.x.min===o.x.min&&et.x.max===o.x.max&&et.y.min===o.y.min&&et.y.max===o.y.max}var NodeStack=function(){function et(){this.members=[]}return et.prototype.add=function(o){addUniqueItem(this.members,o),o.scheduleRender()},et.prototype.remove=function(o){if(removeItem(this.members,o),o===this.prevLead&&(this.prevLead=void 0),o===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},et.prototype.relegate=function(o){var tt=this.members.findIndex(function(it){return o===it});if(tt===0)return!1;for(var rt,nt=tt;nt>=0;nt--){var ot=this.members[nt];if(ot.isPresent!==!1){rt=ot;break}}return rt?(this.promote(rt),!0):!1},et.prototype.promote=function(o,tt){var rt,nt=this.lead;if(o!==nt&&(this.prevLead=nt,this.lead=o,o.show(),nt)){nt.instance&&nt.scheduleRender(),o.scheduleRender(),o.resumeFrom=nt,tt&&(o.resumeFrom.preserveOpacity=!0),nt.snapshot&&(o.snapshot=nt.snapshot,o.snapshot.latestValues=nt.animationValues||nt.latestValues,o.snapshot.isShared=!0),!((rt=o.root)===null||rt===void 0)&&rt.isUpdating&&(o.isLayoutDirty=!0);var ot=o.options.crossfade;ot===!1&&nt.hide()}},et.prototype.exitAnimationComplete=function(){this.members.forEach(function(o){var tt,rt,nt,ot,it;(rt=(tt=o.options).onExitComplete)===null||rt===void 0||rt.call(tt),(it=(nt=o.resumingFrom)===null||nt===void 0?void 0:(ot=nt.options).onExitComplete)===null||it===void 0||it.call(ot)})},et.prototype.scheduleRender=function(){this.members.forEach(function(o){o.instance&&o.scheduleRender(!1)})},et.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},et}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(et,o,tt){var rt=et.x.translate/o.x,nt=et.y.translate/o.y,ot="translate3d(".concat(rt,"px, ").concat(nt,"px, 0) ");if(ot+="scale(".concat(1/o.x,", ").concat(1/o.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=et.x.scale*o.x,lt=et.y.scale*o.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(et,o){return et.depth-o.depth},FlatTree=function(){function et(){this.children=[],this.isDirty=!1}return et.prototype.add=function(o){addUniqueItem(this.children,o),this.isDirty=!0},et.prototype.remove=function(o){removeItem(this.children,o),this.isDirty=!0},et.prototype.forEach=function(o){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(o)},et}(),animationTarget=1e3;function createProjectionNode(et){var o=et.attachResizeListener,tt=et.defaultParent,rt=et.measureScroll,nt=et.checkIsScrollRoot,ot=et.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;rt--)if(et.path[rt].instance){tt=et.path[rt];break}var nt=tt&&tt!==et.root?tt.instance:document,ot=nt.querySelector('[data-projection-id="'.concat(o,'"]'));ot&&et.mount(ot,!0)}function roundAxis(et){et.min=Math.round(et.min),et.max=Math.round(et.max)}function roundBox(et){roundAxis(et.x),roundAxis(et.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(et,o){return addDomEvent(et,"resize",o)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(et){return{x:et.scrollLeft,y:et.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var et=new DocumentProjectionNode(0,{});et.mount(window),et.setOptions({layoutScroll:!0}),rootProjectionNode.current=et}return rootProjectionNode.current},resetTransform:function(et,o){et.style.transform=o??"none"},checkIsScrollRoot:function(et){return window.getComputedStyle(et).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(et,o){return createDomMotionConfig(et,o,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var et=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return et.current=!0,function(){et.current=!1}},[]),et}function useForceUpdate(){var et=useIsMounted$1(),o=__read(reactExports.useState(0),2),tt=o[0],rt=o[1],nt=reactExports.useCallback(function(){et.current&&rt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(nt)},[nt]);return[ot,tt]}var PresenceChild=function(et){var o=et.children,tt=et.initial,rt=et.isPresent,nt=et.onExitComplete,ot=et.custom,it=et.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:rt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var mt=__values(st.values()),ft=mt.next();!ft.done;ft=mt.next()){var pt=ft.value;if(!pt)return}}catch(yt){dt={error:yt}}finally{try{ft&&!ft.done&&(ht=mt.return)&&ht.call(mt)}finally{if(dt)throw dt.error}}nt==null||nt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[rt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[rt]),reactExports.useEffect(function(){!rt&&!st.size&&(nt==null||nt())},[rt]),reactExports.createElement(PresenceContext.Provider,{value:ct},o)};function newChildrenMap(){return new Map}var getChildKey=function(et){return et.key||""};function updateChildLookup(et,o){et.forEach(function(tt){var rt=getChildKey(tt);o.set(rt,tt)})}function onlyElements(et){var o=[];return reactExports.Children.forEach(et,function(tt){reactExports.isValidElement(tt)&&o.push(tt)}),o}var AnimatePresence=function(et){var o=et.children,tt=et.custom,rt=et.initial,nt=rt===void 0?!0:rt,ot=et.onExitComplete,it=et.exitBeforeEnter,st=et.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),mt=onlyElements(o),ft=mt,pt=new Set,yt=reactExports.useRef(ft),gt=reactExports.useRef(new Map).current,bt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){bt.current=!1,updateChildLookup(mt,gt),yt.current=ft}),useUnmountEffect(function(){bt.current=!0,gt.clear(),pt.clear()}),bt.current)return reactExports.createElement(reactExports.Fragment,null,ft.map(function(At){return reactExports.createElement(PresenceChild,{key:getChildKey(At),isPresent:!0,initial:nt?void 0:!1,presenceAffectsLayout:at},At)}));ft=__spreadArray([],__read(ft),!1);for(var xt=yt.current.map(getChildKey),vt=mt.map(getChildKey),Et=xt.length,Ct=0;Ct1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,pt.size?ft:ft.map(function(At){return reactExports.cloneElement(At)}))};function MotionConfig(et){var o=et.children,tt=et.isValidProp,rt=__rest(et,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),rt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),rt),rt.isStatic=useConstant(function(){return rt.isStatic});var nt=reactExports.useMemo(function(){return rt},[JSON.stringify(rt.transition),rt.transformPagePoint,rt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:nt},o)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** * @license React * react-is.production.min.js * @@ -4156,7 +4156,7 @@ Title: ${et.title} Description: ${et.description} Timestamp: ${new Date().getTime()} Parent Block UUID: ${et.parentBlockUUID} -Signed by: ${ht||dt}`;pt({message:gt})}catch(gt){console.error("Error in sign flow:",gt),at("Failed to initiate signing. Please try again."),it(!1)}};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>nt(!0),disabled:ct,children:ct?"Already Signed":dt?"Sign Chain":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:rt,onOpenChange:nt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Sign Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:ct?"You have already signed this chain.":"Review the block details and sign to add your signature to the chain."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("h4",{className:"font-medium",children:"Block Details"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:et.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:et.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${et.chainUUID}/${et.blockUUID}`})]}),st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>nt(!1),children:"Cancel"}),jsxRuntimeExports.jsx(Button,{onClick:yt,disabled:ot||ct,children:ot?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):ct?"Already Signed":dt?"Sign":"Connect Wallet"})]})]})})]})},ChainList=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const rt=it=>{o(it)},nt=(it,st=0)=>{const at=et.filter(dt=>dt.parentBlockUUID===it.blockUUID),ct=it.signatures.length+at.reduce((dt,ht)=>dt+ht.signatures.length,0),lt=`${window.location.origin}/buddybook/sign/${it.chainUUID??it.blockUUID}/${it.blockUUID}`;return jsxRuntimeExports.jsxs("li",{className:"mb-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start",children:[jsxRuntimeExports.jsx("div",{className:"mr-4 mt-2",children:st>0&&jsxRuntimeExports.jsx("div",{className:"w-6 h-6 border-l-2 border-b-2 border-gray-300"})}),st===0?jsxRuntimeExports.jsxs(Card,{className:"flex-grow",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:it.title})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{children:it.description}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:et,onSuccess:rt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share this Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this chain with others to collect their signatures."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:lt,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:lt}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(lt),variant:"outline",children:"Copy Link"})]})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>nt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=et.filter(it=>!it.parentBlockUUID);return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsxs(CardTitle,{children:["Existing Chains",tt&&jsxRuntimeExports.jsxs("span",{className:"ml-2 inline-flex items-center text-muted-foreground text-sm font-normal",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Loading more chains..."]})]})}),jsxRuntimeExports.jsx(CardContent,{children:ot.length===0&&!tt?jsxRuntimeExports.jsx("p",{children:"No chains found."}):jsxRuntimeExports.jsx("ul",{className:"space-y-4",children:ot.map(it=>nt(it,0))})})]})},SignerName=({address:et})=>{const{data:o}=useEnsName({address:et});return jsxRuntimeExports.jsxs("p",{className:"text-sm",children:["Signed by: ",o||`${et.slice(0,6)}...${et.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(et){const o=reactExports.useContext(DirectionContext);return et||o||"ltr"}function clamp(et,[o,tt]){return Math.min(tt,Math.max(o,et))}function useStateMachine(et,o){return reactExports.useReducer((tt,rt)=>o[tt][rt]??tt,et)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((et,o)=>{const{__scopeScrollArea:tt,type:rt="hover",dir:nt,scrollHideDelay:ot=600,...it}=et,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[mt,ft]=reactExports.useState(null),[pt,yt]=reactExports.useState(null),[gt,bt]=reactExports.useState(0),[xt,vt]=reactExports.useState(0),[Et,Ct]=reactExports.useState(!1),[St,At]=reactExports.useState(!1),kt=useComposedRefs(o,Nt=>at(Nt)),It=useDirection(nt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:rt,dir:It,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:mt,onScrollbarXChange:ft,scrollbarXEnabled:Et,onScrollbarXEnabledChange:Ct,scrollbarY:pt,onScrollbarYChange:yt,scrollbarYEnabled:St,onScrollbarYEnabledChange:At,onCornerWidthChange:bt,onCornerHeightChange:vt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:It,...it,ref:kt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":xt+"px",...et.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((et,o)=>{const{__scopeScrollArea:tt,children:rt,asChild:nt,nonce:ot,...it}=et,st=useScrollAreaContext(VIEWPORT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(o,at,st.onViewportChange);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{dangerouslySetInnerHTML:{__html:` +Signed by: ${ht||dt}`;pt({message:gt})}catch(gt){console.error("Error in sign flow:",gt),at("Failed to initiate signing. Please try again."),it(!1)}};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>nt(!0),disabled:ct,children:ct?"Already Signed":dt?"Sign Chain":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:rt,onOpenChange:nt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Sign Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:ct?"You have already signed this chain.":"Review the block details and sign to add your signature to the chain."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("h4",{className:"font-medium",children:"Block Details"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:et.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:et.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${et.chainUUID}/${et.blockUUID}`})]}),st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>nt(!1),children:"Cancel"}),jsxRuntimeExports.jsx(Button,{onClick:yt,disabled:ot||ct,children:ot?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):ct?"Already Signed":dt?"Sign":"Connect Wallet"})]})]})})]})},ChainList=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const rt=it=>{o(it)},nt=(it,st=0)=>{const at=et.filter(dt=>dt.parentBlockUUID===it.blockUUID),ct=it.signatures.length+at.reduce((dt,ht)=>dt+ht.signatures.length,0),lt=`${window.location.origin}/buddybook/sign/${it.chainUUID??it.blockUUID}/${it.blockUUID}`;return jsxRuntimeExports.jsxs("li",{className:"mb-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start",children:[jsxRuntimeExports.jsx("div",{className:"mr-4 mt-2",children:st>0&&jsxRuntimeExports.jsx("div",{className:"w-6 h-6 border-l-2 border-b-2 border-gray-300"})}),st===0?jsxRuntimeExports.jsxs(Card,{className:"flex-grow",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:it.title})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{children:it.description}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2 mt-2",children:[jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created by: ",jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address})]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:et,onSuccess:rt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share this Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this chain with others to collect their signatures."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:lt,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:lt}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(lt),variant:"outline",children:"Copy Link"})]})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>nt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=et.filter(it=>!it.parentBlockUUID);return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsxs(CardTitle,{children:["Existing Chains",tt&&jsxRuntimeExports.jsxs("span",{className:"ml-2 inline-flex items-center text-muted-foreground text-sm font-normal",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Loading more chains..."]})]})}),jsxRuntimeExports.jsx(CardContent,{children:ot.length===0&&!tt?jsxRuntimeExports.jsx("p",{children:"No chains found."}):jsxRuntimeExports.jsx("ul",{className:"space-y-4",children:ot.map(it=>nt(it,0))})})]})},SignerName=({address:et})=>{const{data:o}=useEnsName({address:et});return jsxRuntimeExports.jsxs("p",{className:"text-sm",children:["Signed by: ",o||`${et.slice(0,6)}...${et.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(et){const o=reactExports.useContext(DirectionContext);return et||o||"ltr"}function clamp(et,[o,tt]){return Math.min(tt,Math.max(o,et))}function useStateMachine(et,o){return reactExports.useReducer((tt,rt)=>o[tt][rt]??tt,et)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((et,o)=>{const{__scopeScrollArea:tt,type:rt="hover",dir:nt,scrollHideDelay:ot=600,...it}=et,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[mt,ft]=reactExports.useState(null),[pt,yt]=reactExports.useState(null),[gt,bt]=reactExports.useState(0),[xt,vt]=reactExports.useState(0),[Et,Ct]=reactExports.useState(!1),[St,At]=reactExports.useState(!1),kt=useComposedRefs(o,Nt=>at(Nt)),It=useDirection(nt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:rt,dir:It,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:mt,onScrollbarXChange:ft,scrollbarXEnabled:Et,onScrollbarXEnabledChange:Ct,scrollbarY:pt,onScrollbarYChange:yt,scrollbarYEnabled:St,onScrollbarYEnabledChange:At,onCornerWidthChange:bt,onCornerHeightChange:vt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:It,...it,ref:kt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":xt+"px",...et.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((et,o)=>{const{__scopeScrollArea:tt,children:rt,asChild:nt,nonce:ot,...it}=et,st=useScrollAreaContext(VIEWPORT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(o,at,st.onViewportChange);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{dangerouslySetInnerHTML:{__html:` [data-radix-scroll-area-viewport] { scrollbar-width: none; -ms-overflow-style: none; diff --git a/buddybook/assets/index-DY_rTz6S.js b/buddybook/assets/index-Brvd2aRO.js similarity index 98% rename from buddybook/assets/index-DY_rTz6S.js rename to buddybook/assets/index-Brvd2aRO.js index 9decd27..99c4d44 100644 --- a/buddybook/assets/index-DY_rTz6S.js +++ b/buddybook/assets/index-Brvd2aRO.js @@ -1 +1 @@ -import{e as p}from"./events-CXYVpbcl.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-DHqXLz5A.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-DbFRd9te.js b/buddybook/assets/index-CK0s9qz-.js similarity index 99% rename from buddybook/assets/index-DbFRd9te.js rename to buddybook/assets/index-CK0s9qz-.js index c5a8365..c579d6e 100644 --- a/buddybook/assets/index-DbFRd9te.js +++ b/buddybook/assets/index-CK0s9qz-.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-D4GNEarw.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-BhXuIR47.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-BJjm4ut_.js b/buddybook/assets/index-DYbq_cjT.js similarity index 98% rename from buddybook/assets/index-BJjm4ut_.js rename to buddybook/assets/index-DYbq_cjT.js index 015437a..59cc0ea 100644 --- a/buddybook/assets/index-BJjm4ut_.js +++ b/buddybook/assets/index-DYbq_cjT.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-jQUXy-RB.js","assets/index-D4GNEarw.js","assets/index-qdeI_DrH.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-D4GNEarw.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:"/buddybook/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(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 b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,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(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(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]],b(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 N=r[3](A(U));y.set(U,[r,N])}),()=>{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&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.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,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.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 be(e,t){const s=L.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}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(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}),w={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(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.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 Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.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:[]}),ke={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}=w.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(",")),w.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}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.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 k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.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=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-jQUXy-RB.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B-is0UYJ.js","assets/index-BhXuIR47.js","assets/index-qdeI_DrH.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-BhXuIR47.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:"/buddybook/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(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 b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,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(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(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]],b(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 N=r[3](A(U));y.set(U,[r,N])}),()=>{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&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.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,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.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 be(e,t){const s=L.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}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(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}),w={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(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.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 Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.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:[]}),ke={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}=w.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(",")),w.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}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.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 k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.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=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-B-is0UYJ.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w 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.es-Bushv2uZ.js b/buddybook/assets/index.es-BN4D2FYF.js similarity index 99% rename from buddybook/assets/index.es-Bushv2uZ.js rename to buddybook/assets/index.es-BN4D2FYF.js index 2a181bc..1bb56ed 100644 --- a/buddybook/assets/index.es-Bushv2uZ.js +++ b/buddybook/assets/index.es-BN4D2FYF.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BJjm4ut_.js","assets/index-D4GNEarw.js","assets/index-qdeI_DrH.css"])))=>i.map(i=>d[i]); -import{g as Cv,o as z8,p as j8,d as Dv,q as Ar,r as k8,h as Sd,_ as F8}from"./index-D4GNEarw.js";import{e as Fi,J as Id}from"./events-CXYVpbcl.js";import{r as Md,i as xh}from"./inherits_browser-Cg-Az14D.js";var xe={};/*! ***************************************************************************** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DYbq_cjT.js","assets/index-BhXuIR47.js","assets/index-qdeI_DrH.css"])))=>i.map(i=>d[i]); +import{g as Cv,o as z8,p as j8,d as Dv,q as Ar,r as k8,h as Sd,_ as F8}from"./index-BhXuIR47.js";import{e as Fi,J as Id}from"./events-DHqXLz5A.js";import{r as Md,i as xh}from"./inherits_browser-BBXdvzXT.js";var xe={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -67,4 +67,4 @@ __p += '`),Tt&&(ge+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ge+`return __p -}`;var wt=r1(function(){return Lt(U,We+"return "+ge).apply(t,J)});if(wt.source=ge,Wu(wt))throw wt;return wt}function G5(s){return qt(s).toLowerCase()}function W5(s){return qt(s).toUpperCase()}function J5(s,o,l){if(s=qt(s),s&&(l||o===t))return u0(s);if(!s||!(o=vi(o)))return s;var E=Zi(s),T=Zi(o),U=l0(E,T),J=d0(E,T)+1;return Ss(E,U,J).join("")}function Y5(s,o,l){if(s=qt(s),s&&(l||o===t))return s.slice(0,g0(s)+1);if(!s||!(o=vi(o)))return s;var E=Zi(s),T=d0(E,Zi(o))+1;return Ss(E,0,T).join("")}function Q5(s,o,l){if(s=qt(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var E=Zi(s),T=l0(E,Zi(o));return Ss(E,T).join("")}function X5(s,o){var l=le,E=L;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,E="omission"in o?vi(o.omission):E}s=qt(s);var U=s.length;if(Ta(s)){var J=Zi(s);U=J.length}if(l>=U)return s;var X=l-Ca(E);if(X<1)return E;var ie=J?Ss(J,0,X).join(""):s.slice(0,X);if(T===t)return ie+E;if(J&&(X+=ie.length-X),Ju(T)){if(s.slice(X).search(T)){var ue,de=ie;for(T.global||(T=uu(T.source,qt(bt.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ge=ue.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Pe=ie.lastIndexOf(T);Pe>-1&&(ie=ie.slice(0,Pe))}return ie+E}function Z5(s){return s=qt(s),s&&Le.test(s)?s.replace(Et,P2):s}var e8=za(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Xu=ip("toUpperCase");function t1(s,o,l){return s=qt(s),o=l?t:o,o===t?E2(s)?N2(s):p2(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)}}),t8=Xn(function(s,o){return Pi(o,function(l){l=wn(l),Yn(s,l,Vu(s[l],s))}),s});function r8(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 T=-1;++TM)return[];var l=g,E=Br(s,g);o=nt(o),s-=g;for(var T=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)},mn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),E=/^(?:head|last)$/.test(o),T=D[E?"take"+(o=="last"?"Right":""):o],U=E||/^find/.test(o);T&&(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 Tt=T.apply(D,ys([xt],X));return E&&Pe?Tt[0]:Tt};de&&l&&typeof ue=="function"&&ue.length!=1&&(ie=de=!1);var Pe=this.__chain__,We=!!this.__actions__.length,ot=U&&!Pe,wt=ie&&!We;if(!U&&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 T=arguments;if(E&&!this.__chain__){var U=this.value();return o.apply(gt(U)?U:[],T)}return this[l](function(J){return o.apply(gt(J)?J:[],T)})}}),mn(Mt.prototype,function(s,o){var l=D[o];if(l){var E=l.name+"";Ut.call(Ba,E)||(Ba[E]=[]),Ba[E].push({name:o,func:l})}}),Ba[Af(t,Q).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Z2,Mt.prototype.reverse=ey,Mt.prototype.value=ty,D.prototype.at=R3,D.prototype.chain=N3,D.prototype.commit=T3,D.prototype.next=C3,D.prototype.plant=L3,D.prototype.reverse=q3,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=B3,D.prototype.first=D.prototype.head,Oo&&(D.prototype[Oo]=D3),D},Da=T2();sr?((sr.exports=Da)._=Da,Ft._=Da):Nt._=Da}).call(rc)})(Ad,Ad.exports);var rT=Object.defineProperty,iT=Object.defineProperties,nT=Object.getOwnPropertyDescriptors,_v=Object.getOwnPropertySymbols,sT=Object.prototype.hasOwnProperty,aT=Object.prototype.propertyIsEnumerable,Av=(r,e,t)=>e in r?rT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gf=(r,e)=>{for(var t in e||(e={}))sT.call(e,t)&&Av(r,t,e[t]);if(_v)for(var t of _v(e))aT.call(e,t)&&Av(r,t,e[t]);return r},oT=(r,e)=>iT(r,nT(e));function dn(r,e,t){var i;const n=ac(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${a2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ia(r){return r.includes(":")?r.split(":")[1]:r}function o2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function cT(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 jl(r={},e={}){const t=Ev(r),i=Ev(e);return Ad.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=Jd(f)?[f]:u.chains,p=u.methods||[],y=u.events||[],A=u.rpcMap||{},R=sc(f);a[R]=oT(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 fT(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=Jd(t)?[t]:i.chains?i.chains:o2(i.accounts);e[t]={chains:u,methods:n,events:a,accounts:f}}return e}function kl(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 c2={},Bt=r=>c2[r],Fl=(r,e)=>{c2[r]=e};class hT{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}var uT=Object.defineProperty,lT=Object.defineProperties,dT=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,pT=Object.prototype.hasOwnProperty,gT=Object.prototype.propertyIsEnumerable,Iv=(r,e,t)=>e in r?uT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mv=(r,e)=>{for(var t in e||(e={}))pT.call(e,t)&&Iv(r,t,e[t]);if(Sv)for(var t of Sv(e))gT.call(e,t)&&Iv(r,t,e[t]);return r},Pv=(r,e)=>lT(r,dT(e));class vT{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("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`${tT}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class bT{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class mT{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class yT{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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||dn(`${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(gn.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||dn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new pn(new Vn(i,Bt("disableProviderPing")))}}class wT{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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 pn(new Vn(i,Bt("disableProviderPing")))}}class _T{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class AT{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class ET{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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||dn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(gn.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||dn(e,this.namespace);return typeof i>"u"?void 0:new pn(new Vn(i,Bt("disableProviderPing")))}}class xT{constructor(e){this.name=Ya,this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}var ST=Object.defineProperty,IT=Object.defineProperties,MT=Object.getOwnPropertyDescriptors,Ov=Object.getOwnPropertySymbols,PT=Object.prototype.hasOwnProperty,OT=Object.prototype.propertyIsEnumerable,Rv=(r,e,t)=>e in r?ST(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wf=(r,e)=>{for(var t in e||(e={}))PT.call(e,t)&&Rv(r,t,e[t]);if(Ov)for(var t of Ov(e))OT.call(e,t)&&Rv(r,t,e[t]);return r},Hl=(r,e)=>IT(r,MT(e));class n0{constructor(e){this.events=new Id,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 n0(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:$t("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=jl(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=jl(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==s2)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 i0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||yv,relayUrl:this.providerOpts.relayUrl||XN,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)))];Fl("client",this.client),Fl("events",this.events),Fl("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=cT(t,this.session),n=o2(i),a=jl(this.namespaces,this.optionalNamespaces),f=Hl(Wf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new vT({namespace:f});break;case"algorand":this.rpcProviders[t]=new yT({namespace:f});break;case"solana":this.rpcProviders[t]=new bT({namespace:f});break;case"cosmos":this.rpcProviders[t]=new mT({namespace:f});break;case"polkadot":this.rpcProviders[t]=new hT({namespace:f});break;case"cip34":this.rpcProviders[t]=new wT({namespace:f});break;case"elrond":this.rpcProviders[t]=new _T({namespace:f});break;case"multiversx":this.rpcProviders[t]=new AT({namespace:f});break;case"near":this.rpcProviders[t]=new ET({namespace:f});break;default:this.rpcProviders[Ya]?this.rpcProviders[Ya].updateNamespace(f):this.rpcProviders[Ya]=new xT({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(fT))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,f=sc(n),u=kl(n)!==kl(a)?`${f}:${kl(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({},$t("USER_DISCONNECTED")),{data:e.topic}))}),this.on(gn.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 RT=n0,NT="wc",TT="ethereum_provider",CT=`${NT}@2:${TT}:`,DT="https://rpc.walletconnect.org/v1/",Ed=["eth_sendTransaction","personal_sign"],LT=["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"],xd=["chainChanged","accountsChanged"],qT=["chainChanged","accountsChanged","message","disconnect","connect"];var BT=Object.defineProperty,UT=Object.defineProperties,$T=Object.getOwnPropertyDescriptors,Nv=Object.getOwnPropertySymbols,zT=Object.prototype.hasOwnProperty,jT=Object.prototype.propertyIsEnumerable,Tv=(r,e,t)=>e in r?BT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qa=(r,e)=>{for(var t in e||(e={}))zT.call(e,t)&&Tv(r,t,e[t]);if(Nv)for(var t of Nv(e))jT.call(e,t)&&Tv(r,t,e[t]);return r},Kl=(r,e)=>UT(r,$T(e));function Eh(r){return Number(r[0].split(":")[1])}function Jf(r){return`0x${r.toString(16)}`}function kT(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||Ed,events:a||xd,rpcMap:Qa({},e.length?{[Eh(e)]:u[Eh(e)]}:{})},p=a==null?void 0:a.filter(O=>!xd.includes(O)),y=i==null?void 0:i.filter(O=>!Ed.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:LT))],events:[...new Set(b.events.concat(f!=null&&f.length?f:qT))],rpcMap:u};return{required:e.length?b:void 0,optional:t.length?R:void 0}}class s0{constructor(){this.events=new Fi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CT,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 s0;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}=kT(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=C1(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=C1(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({},$t("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)||Ed:[],b=n.length?(e==null?void 0:e.events)||xd:[],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 RT.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 F8(()=>import("./index-BJjm4ut_.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])||`${DT}?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 pC=s0;export{pC as EthereumProvider,qT as OPTIONAL_EVENTS,LT as OPTIONAL_METHODS,xd as REQUIRED_EVENTS,Ed as REQUIRED_METHODS,s0 as default}; +}`;var wt=r1(function(){return Lt(U,We+"return "+ge).apply(t,J)});if(wt.source=ge,Wu(wt))throw wt;return wt}function G5(s){return qt(s).toLowerCase()}function W5(s){return qt(s).toUpperCase()}function J5(s,o,l){if(s=qt(s),s&&(l||o===t))return u0(s);if(!s||!(o=vi(o)))return s;var E=Zi(s),T=Zi(o),U=l0(E,T),J=d0(E,T)+1;return Ss(E,U,J).join("")}function Y5(s,o,l){if(s=qt(s),s&&(l||o===t))return s.slice(0,g0(s)+1);if(!s||!(o=vi(o)))return s;var E=Zi(s),T=d0(E,Zi(o))+1;return Ss(E,0,T).join("")}function Q5(s,o,l){if(s=qt(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var E=Zi(s),T=l0(E,Zi(o));return Ss(E,T).join("")}function X5(s,o){var l=le,E=L;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,E="omission"in o?vi(o.omission):E}s=qt(s);var U=s.length;if(Ta(s)){var J=Zi(s);U=J.length}if(l>=U)return s;var X=l-Ca(E);if(X<1)return E;var ie=J?Ss(J,0,X).join(""):s.slice(0,X);if(T===t)return ie+E;if(J&&(X+=ie.length-X),Ju(T)){if(s.slice(X).search(T)){var ue,de=ie;for(T.global||(T=uu(T.source,qt(bt.exec(T))+"g")),T.lastIndex=0;ue=T.exec(de);)var ge=ue.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Pe=ie.lastIndexOf(T);Pe>-1&&(ie=ie.slice(0,Pe))}return ie+E}function Z5(s){return s=qt(s),s&&Le.test(s)?s.replace(Et,P2):s}var e8=za(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),Xu=ip("toUpperCase");function t1(s,o,l){return s=qt(s),o=l?t:o,o===t?E2(s)?N2(s):p2(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)}}),t8=Xn(function(s,o){return Pi(o,function(l){l=wn(l),Yn(s,l,Vu(s[l],s))}),s});function r8(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 T=-1;++TM)return[];var l=g,E=Br(s,g);o=nt(o),s-=g;for(var T=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)},mn(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),E=/^(?:head|last)$/.test(o),T=D[E?"take"+(o=="last"?"Right":""):o],U=E||/^find/.test(o);T&&(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 Tt=T.apply(D,ys([xt],X));return E&&Pe?Tt[0]:Tt};de&&l&&typeof ue=="function"&&ue.length!=1&&(ie=de=!1);var Pe=this.__chain__,We=!!this.__actions__.length,ot=U&&!Pe,wt=ie&&!We;if(!U&&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 T=arguments;if(E&&!this.__chain__){var U=this.value();return o.apply(gt(U)?U:[],T)}return this[l](function(J){return o.apply(gt(J)?J:[],T)})}}),mn(Mt.prototype,function(s,o){var l=D[o];if(l){var E=l.name+"";Ut.call(Ba,E)||(Ba[E]=[]),Ba[E].push({name:o,func:l})}}),Ba[Af(t,Q).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Z2,Mt.prototype.reverse=ey,Mt.prototype.value=ty,D.prototype.at=R3,D.prototype.chain=N3,D.prototype.commit=T3,D.prototype.next=C3,D.prototype.plant=L3,D.prototype.reverse=q3,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=B3,D.prototype.first=D.prototype.head,Oo&&(D.prototype[Oo]=D3),D},Da=T2();sr?((sr.exports=Da)._=Da,Ft._=Da):Nt._=Da}).call(rc)})(Ad,Ad.exports);var rT=Object.defineProperty,iT=Object.defineProperties,nT=Object.getOwnPropertyDescriptors,_v=Object.getOwnPropertySymbols,sT=Object.prototype.hasOwnProperty,aT=Object.prototype.propertyIsEnumerable,Av=(r,e,t)=>e in r?rT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gf=(r,e)=>{for(var t in e||(e={}))sT.call(e,t)&&Av(r,t,e[t]);if(_v)for(var t of _v(e))aT.call(e,t)&&Av(r,t,e[t]);return r},oT=(r,e)=>iT(r,nT(e));function dn(r,e,t){var i;const n=ac(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${a2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ia(r){return r.includes(":")?r.split(":")[1]:r}function o2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function cT(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 jl(r={},e={}){const t=Ev(r),i=Ev(e);return Ad.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=Jd(f)?[f]:u.chains,p=u.methods||[],y=u.events||[],A=u.rpcMap||{},R=sc(f);a[R]=oT(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 fT(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=Jd(t)?[t]:i.chains?i.chains:o2(i.accounts);e[t]={chains:u,methods:n,events:a,accounts:f}}return e}function kl(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 c2={},Bt=r=>c2[r],Fl=(r,e)=>{c2[r]=e};class hT{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}var uT=Object.defineProperty,lT=Object.defineProperties,dT=Object.getOwnPropertyDescriptors,Sv=Object.getOwnPropertySymbols,pT=Object.prototype.hasOwnProperty,gT=Object.prototype.propertyIsEnumerable,Iv=(r,e,t)=>e in r?uT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Mv=(r,e)=>{for(var t in e||(e={}))pT.call(e,t)&&Iv(r,t,e[t]);if(Sv)for(var t of Sv(e))gT.call(e,t)&&Iv(r,t,e[t]);return r},Pv=(r,e)=>lT(r,dT(e));class vT{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("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`${tT}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class bT{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class mT{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class yT{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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||dn(`${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(gn.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||dn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new pn(new Vn(i,Bt("disableProviderPing")))}}class wT{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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 pn(new Vn(i,Bt("disableProviderPing")))}}class _T{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class AT{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}class ET{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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||dn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(gn.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||dn(e,this.namespace);return typeof i>"u"?void 0:new pn(new Vn(i,Bt("disableProviderPing")))}}class xT{constructor(e){this.name=Ya,this.namespace=e.namespace,this.events=Bt("events"),this.client=Bt("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(gn.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||dn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new pn(new Vn(i,Bt("disableProviderPing")))}}var ST=Object.defineProperty,IT=Object.defineProperties,MT=Object.getOwnPropertyDescriptors,Ov=Object.getOwnPropertySymbols,PT=Object.prototype.hasOwnProperty,OT=Object.prototype.propertyIsEnumerable,Rv=(r,e,t)=>e in r?ST(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wf=(r,e)=>{for(var t in e||(e={}))PT.call(e,t)&&Rv(r,t,e[t]);if(Ov)for(var t of Ov(e))OT.call(e,t)&&Rv(r,t,e[t]);return r},Hl=(r,e)=>IT(r,MT(e));class n0{constructor(e){this.events=new Id,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 n0(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:$t("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=jl(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=jl(this.namespaces,f),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==s2)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 i0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||yv,relayUrl:this.providerOpts.relayUrl||XN,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)))];Fl("client",this.client),Fl("events",this.events),Fl("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=cT(t,this.session),n=o2(i),a=jl(this.namespaces,this.optionalNamespaces),f=Hl(Wf({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new vT({namespace:f});break;case"algorand":this.rpcProviders[t]=new yT({namespace:f});break;case"solana":this.rpcProviders[t]=new bT({namespace:f});break;case"cosmos":this.rpcProviders[t]=new mT({namespace:f});break;case"polkadot":this.rpcProviders[t]=new hT({namespace:f});break;case"cip34":this.rpcProviders[t]=new wT({namespace:f});break;case"elrond":this.rpcProviders[t]=new _T({namespace:f});break;case"multiversx":this.rpcProviders[t]=new AT({namespace:f});break;case"near":this.rpcProviders[t]=new ET({namespace:f});break;default:this.rpcProviders[Ya]?this.rpcProviders[Ya].updateNamespace(f):this.rpcProviders[Ya]=new xT({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(fT))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,f=sc(n),u=kl(n)!==kl(a)?`${f}:${kl(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({},$t("USER_DISCONNECTED")),{data:e.topic}))}),this.on(gn.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 RT=n0,NT="wc",TT="ethereum_provider",CT=`${NT}@2:${TT}:`,DT="https://rpc.walletconnect.org/v1/",Ed=["eth_sendTransaction","personal_sign"],LT=["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"],xd=["chainChanged","accountsChanged"],qT=["chainChanged","accountsChanged","message","disconnect","connect"];var BT=Object.defineProperty,UT=Object.defineProperties,$T=Object.getOwnPropertyDescriptors,Nv=Object.getOwnPropertySymbols,zT=Object.prototype.hasOwnProperty,jT=Object.prototype.propertyIsEnumerable,Tv=(r,e,t)=>e in r?BT(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Qa=(r,e)=>{for(var t in e||(e={}))zT.call(e,t)&&Tv(r,t,e[t]);if(Nv)for(var t of Nv(e))jT.call(e,t)&&Tv(r,t,e[t]);return r},Kl=(r,e)=>UT(r,$T(e));function Eh(r){return Number(r[0].split(":")[1])}function Jf(r){return`0x${r.toString(16)}`}function kT(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||Ed,events:a||xd,rpcMap:Qa({},e.length?{[Eh(e)]:u[Eh(e)]}:{})},p=a==null?void 0:a.filter(O=>!xd.includes(O)),y=i==null?void 0:i.filter(O=>!Ed.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:LT))],events:[...new Set(b.events.concat(f!=null&&f.length?f:qT))],rpcMap:u};return{required:e.length?b:void 0,optional:t.length?R:void 0}}class s0{constructor(){this.events=new Fi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=CT,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 s0;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}=kT(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=C1(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=C1(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({},$t("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)||Ed:[],b=n.length?(e==null?void 0:e.events)||xd:[],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 RT.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 F8(()=>import("./index-DYbq_cjT.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])||`${DT}?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 pC=s0;export{pC as EthereumProvider,qT as OPTIONAL_EVENTS,LT as OPTIONAL_METHODS,xd as REQUIRED_EVENTS,Ed as REQUIRED_METHODS,s0 as default}; diff --git a/buddybook/assets/inherits_browser-Cg-Az14D.js b/buddybook/assets/inherits_browser-BBXdvzXT.js similarity index 85% rename from buddybook/assets/inherits_browser-Cg-Az14D.js rename to buddybook/assets/inherits_browser-BBXdvzXT.js index 7ed128d..3e76476 100644 --- a/buddybook/assets/inherits_browser-Cg-Az14D.js +++ b/buddybook/assets/inherits_browser-BBXdvzXT.js @@ -1 +1 @@ -import{g as n,u as s}from"./index-D4GNEarw.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-BhXuIR47.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 dd9e598..7fb24a5 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -32,7 +32,7 @@ } }(window.location)) - + diff --git a/flush-notes/404.html b/flush-notes/404.html index 44273e3..758616d 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/zP2dhn61o1ar3lvoUwTEh/_buildManifest.js b/flush-notes/_next/static/XI6MHJ3KvUZuAZMMrAC6F/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/zP2dhn61o1ar3lvoUwTEh/_buildManifest.js rename to flush-notes/_next/static/XI6MHJ3KvUZuAZMMrAC6F/_buildManifest.js diff --git a/flush-notes/_next/static/zP2dhn61o1ar3lvoUwTEh/_ssgManifest.js b/flush-notes/_next/static/XI6MHJ3KvUZuAZMMrAC6F/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/zP2dhn61o1ar3lvoUwTEh/_ssgManifest.js rename to flush-notes/_next/static/XI6MHJ3KvUZuAZMMrAC6F/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index efd1ad4..ac37de4 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 67572ce..ec0d51a 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:["zP2dhn61o1ar3lvoUwTEh",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["XI6MHJ3KvUZuAZMMrAC6F",[[["",{"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 b439c96..5d19c3a 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 be88cd3..e300d94 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:["zP2dhn61o1ar3lvoUwTEh",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["XI6MHJ3KvUZuAZMMrAC6F",[[["",{"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,[],""]