From 27e589b32f09b6f3d4c504e2cffdfff39b7bb302 Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Mon, 4 Nov 2024 16:28:38 +0000 Subject: [PATCH] Updates --- buddybook/.vite/manifest.json | 90 +++++++++---------- .../{ccip-BuPDuCWt.js => ccip-pRo4jQj5.js} | 2 +- ...{events-D77cZ0Dd.js => events-CXYVpbcl.js} | 2 +- ...e-BU4-HDYb.js => hooks.module-Dd0QlYUx.js} | 2 +- .../{index-lBZeKVJT.js => index-BJjm4ut_.js} | 4 +- .../{index-Cp1uoOsT.js => index-CT_b5y6n.js} | 2 +- .../{index-CENwOupW.js => index-D4GNEarw.js} | 46 +++++----- buddybook/assets/index-DYQzbCPl.css | 1 - .../{index-Cmis2wXV.js => index-DY_rTz6S.js} | 2 +- .../{index-C7D_Vv5-.js => index-DbFRd9te.js} | 2 +- .../{index-nTxWlJlB.js => index-DrKwSPd8.js} | 2 +- .../{index-DSPCU2Te.js => index-jQUXy-RB.js} | 2 +- buddybook/assets/index-qdeI_DrH.css | 1 + ...ex.es-Cm56O0-c.js => index.es-Bushv2uZ.js} | 6 +- ...M0a8tS.js => inherits_browser-Cg-Az14D.js} | 2 +- buddybook/index.html | 4 +- flush-notes/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 flush-notes/index.html | 2 +- flush-notes/index.txt | 2 +- flush-notes/view.html | 2 +- flush-notes/view.txt | 2 +- 23 files changed, 90 insertions(+), 90 deletions(-) rename buddybook/assets/{ccip-BuPDuCWt.js => ccip-pRo4jQj5.js} (97%) rename buddybook/assets/{events-D77cZ0Dd.js => events-CXYVpbcl.js} (98%) rename buddybook/assets/{hooks.module-BU4-HDYb.js => hooks.module-Dd0QlYUx.js} (99%) rename buddybook/assets/{index-lBZeKVJT.js => index-BJjm4ut_.js} (98%) rename buddybook/assets/{index-Cp1uoOsT.js => index-CT_b5y6n.js} (99%) rename buddybook/assets/{index-CENwOupW.js => index-D4GNEarw.js} (90%) delete mode 100644 buddybook/assets/index-DYQzbCPl.css rename buddybook/assets/{index-Cmis2wXV.js => index-DY_rTz6S.js} (98%) rename buddybook/assets/{index-C7D_Vv5-.js => index-DbFRd9te.js} (99%) rename buddybook/assets/{index-nTxWlJlB.js => index-DrKwSPd8.js} (99%) rename buddybook/assets/{index-DSPCU2Te.js => index-jQUXy-RB.js} (99%) create mode 100644 buddybook/assets/index-qdeI_DrH.css rename buddybook/assets/{index.es-Cm56O0-c.js => index.es-Bushv2uZ.js} (99%) rename buddybook/assets/{inherits_browser-BkM0a8tS.js => inherits_browser-Cg-Az14D.js} (85%) rename flush-notes/_next/static/{D7jrosl9_Zxnutu9GbIPH => D0ksWo2E2oITf_v20vm5B}/_buildManifest.js (100%) rename flush-notes/_next/static/{D7jrosl9_Zxnutu9GbIPH => D0ksWo2E2oITf_v20vm5B}/_ssgManifest.js (100%) diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json index 0af98b9..ad3fb29 100644 --- a/buddybook/.vite/manifest.json +++ b/buddybook/.vite/manifest.json @@ -1,41 +1,22 @@ { - "_events-D77cZ0Dd.js": { - "file": "assets/events-D77cZ0Dd.js", + "_events-CXYVpbcl.js": { + "file": "assets/events-CXYVpbcl.js", "name": "events", "imports": [ "index.html" ] }, - "_hooks.module-BU4-HDYb.js": { - "file": "assets/hooks.module-BU4-HDYb.js", + "_hooks.module-Dd0QlYUx.js": { + "file": "assets/hooks.module-Dd0QlYUx.js", "name": "hooks.module", "imports": [ "index.html", - "_events-D77cZ0Dd.js", - "_inherits_browser-BkM0a8tS.js" + "_events-CXYVpbcl.js", + "_inherits_browser-Cg-Az14D.js" ] }, - "_index-Cmis2wXV.js": { - "file": "assets/index-Cmis2wXV.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "_events-D77cZ0Dd.js" - ] - }, - "_index-Cp1uoOsT.js": { - "file": "assets/index-Cp1uoOsT.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "index.html", - "_inherits_browser-BkM0a8tS.js", - "_hooks.module-BU4-HDYb.js", - "_events-D77cZ0Dd.js" - ] - }, - "_index-lBZeKVJT.js": { - "file": "assets/index-lBZeKVJT.js", + "_index-BJjm4ut_.js": { + "file": "assets/index-BJjm4ut_.js", "name": "index", "isDynamicEntry": true, "imports": [ @@ -45,41 +26,60 @@ "node_modules/@walletconnect/modal-ui/dist/index.js" ] }, - "_index-nTxWlJlB.js": { - "file": "assets/index-nTxWlJlB.js", + "_index-CT_b5y6n.js": { + "file": "assets/index-CT_b5y6n.js", "name": "index", "isDynamicEntry": true, "imports": [ "index.html", - "_hooks.module-BU4-HDYb.js" + "_inherits_browser-Cg-Az14D.js", + "_hooks.module-Dd0QlYUx.js", + "_events-CXYVpbcl.js" ] }, - "_inherits_browser-BkM0a8tS.js": { - "file": "assets/inherits_browser-BkM0a8tS.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", "name": "inherits_browser", "imports": [ "index.html" ] }, "index.html": { - "file": "assets/index-CENwOupW.js", + "file": "assets/index-D4GNEarw.js", "name": "index", "src": "index.html", "isEntry": true, "dynamicImports": [ "node_modules/viem/_esm/utils/ccip.js", - "_index-nTxWlJlB.js", - "_index-Cp1uoOsT.js", + "_index-DrKwSPd8.js", + "_index-CT_b5y6n.js", "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", - "_index-Cmis2wXV.js", + "_index-DY_rTz6S.js", "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" ], "css": [ - "assets/index-DYQzbCPl.css" + "assets/index-qdeI_DrH.css" ] }, "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js": { - "file": "assets/index-C7D_Vv5-.js", + "file": "assets/index-DbFRd9te.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-Cm56O0-c.js", + "file": "assets/index.es-Bushv2uZ.js", "name": "index.es", "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", "isDynamicEntry": true, "imports": [ "index.html", - "_events-D77cZ0Dd.js", - "_inherits_browser-BkM0a8tS.js" + "_events-CXYVpbcl.js", + "_inherits_browser-Cg-Az14D.js" ], "dynamicImports": [ - "_index-lBZeKVJT.js" + "_index-BJjm4ut_.js" ] }, "node_modules/@walletconnect/modal-ui/dist/index.js": { - "file": "assets/index-DSPCU2Te.js", + "file": "assets/index-jQUXy-RB.js", "name": "index", "src": "node_modules/@walletconnect/modal-ui/dist/index.js", "isDynamicEntry": true, "imports": [ - "_index-lBZeKVJT.js", + "_index-BJjm4ut_.js", "index.html" ] }, "node_modules/viem/_esm/utils/ccip.js": { - "file": "assets/ccip-BuPDuCWt.js", + "file": "assets/ccip-pRo4jQj5.js", "name": "ccip", "src": "node_modules/viem/_esm/utils/ccip.js", "isDynamicEntry": true, diff --git a/buddybook/assets/ccip-BuPDuCWt.js b/buddybook/assets/ccip-pRo4jQj5.js similarity index 97% rename from buddybook/assets/ccip-BuPDuCWt.js rename to buddybook/assets/ccip-pRo4jQj5.js index 48c65ec..68f96dd 100644 --- a/buddybook/assets/ccip-BuPDuCWt.js +++ b/buddybook/assets/ccip-pRo4jQj5.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-CENwOupW.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-D4GNEarw.js";import{e as ei}from"./events-CXYVpbcl.js";import{r as ti,i as Z}from"./inherits_browser-Cg-Az14D.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-lBZeKVJT.js b/buddybook/assets/index-BJjm4ut_.js similarity index 98% rename from buddybook/assets/index-lBZeKVJT.js rename to buddybook/assets/index-BJjm4ut_.js index 7b02297..015437a 100644 --- a/buddybook/assets/index-lBZeKVJT.js +++ b/buddybook/assets/index-BJjm4ut_.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DSPCU2Te.js","assets/index-CENwOupW.js","assets/index-DYQzbCPl.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-CENwOupW.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-DSPCU2Te.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-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}; diff --git a/buddybook/assets/index-Cp1uoOsT.js b/buddybook/assets/index-CT_b5y6n.js similarity index 99% rename from buddybook/assets/index-Cp1uoOsT.js rename to buddybook/assets/index-CT_b5y6n.js index 1e91ed9..e45757a 100644 --- a/buddybook/assets/index-Cp1uoOsT.js +++ b/buddybook/assets/index-CT_b5y6n.js @@ -1,4 +1,4 @@ -import{d as T,g as Hs,j as Tc,l as xc,h as Pc}from"./index-CENwOupW.js";import{r as $c}from"./inherits_browser-BkM0a8tS.js";import{s as Oc,r as Ke,a as an,j as Bc,b as Dc}from"./hooks.module-BU4-HDYb.js";import{e as ta}from"./events-D77cZ0Dd.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-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 `:"",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-CENwOupW.js b/buddybook/assets/index-D4GNEarw.js similarity index 90% rename from buddybook/assets/index-CENwOupW.js rename to buddybook/assets/index-D4GNEarw.js index 20d350c..20d8968 100644 --- a/buddybook/assets/index-CENwOupW.js +++ b/buddybook/assets/index-D4GNEarw.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-nTxWlJlB.js","assets/hooks.module-BU4-HDYb.js","assets/events-D77cZ0Dd.js","assets/inherits_browser-BkM0a8tS.js","assets/index-Cp1uoOsT.js","assets/index-Cmis2wXV.js","assets/index.es-Cm56O0-c.js"])))=>i.map(i=>d[i]); +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]); 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 @@ -43,7 +43,7 @@ var cu=Object.defineProperty;var Us=et=>{throw TypeError(et)};var lu=(et,o,tt)=> `+nt[it].replace(" at new "," at ");return et.displayName&&at.includes("")&&(at=at.replace("",et.displayName)),at}while(1<=it&&0<=st);break}}}finally{Na=!1,Error.prepareStackTrace=tt}return(et=et?et.displayName||et.name:"")?Ma(et):""}function Pa(et){switch(et.tag){case 5:return Ma(et.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return et=Oa(et.type,!1),et;case 11:return et=Oa(et.type.render,!1),et;case 1:return et=Oa(et.type,!0),et;default:return""}}function Qa(et){if(et==null)return null;if(typeof et=="function")return et.displayName||et.name||null;if(typeof et=="string")return et;switch(et){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof et=="object")switch(et.$$typeof){case Ca:return(et.displayName||"Context")+".Consumer";case Ba:return(et._context.displayName||"Context")+".Provider";case Da:var o=et.render;return et=et.displayName,et||(et=o.displayName||o.name||"",et=et!==""?"ForwardRef("+et+")":"ForwardRef"),et;case Ga:return o=et.displayName||null,o!==null?o:Qa(et.type)||"Memo";case Ha:o=et._payload,et=et._init;try{return Qa(et(o))}catch{}}return null}function Ra(et){var o=et.type;switch(et.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return et=o.render,et=et.displayName||et.name||"",o.displayName||(et!==""?"ForwardRef("+et+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(o);case 8:return o===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Sa(et){switch(typeof et){case"boolean":case"number":case"string":case"undefined":return et;case"object":return et;default:return""}}function Ta(et){var o=et.type;return(et=et.nodeName)&&et.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Ua(et){var o=Ta(et)?"checked":"value",tt=Object.getOwnPropertyDescriptor(et.constructor.prototype,o),rt=""+et[o];if(!et.hasOwnProperty(o)&&typeof tt<"u"&&typeof tt.get=="function"&&typeof tt.set=="function"){var nt=tt.get,ot=tt.set;return Object.defineProperty(et,o,{configurable:!0,get:function(){return nt.call(this)},set:function(it){rt=""+it,ot.call(this,it)}}),Object.defineProperty(et,o,{enumerable:tt.enumerable}),{getValue:function(){return rt},setValue:function(it){rt=""+it},stopTracking:function(){et._valueTracker=null,delete et[o]}}}}function Va(et){et._valueTracker||(et._valueTracker=Ua(et))}function Wa(et){if(!et)return!1;var o=et._valueTracker;if(!o)return!0;var tt=o.getValue(),rt="";return et&&(rt=Ta(et)?et.checked?"true":"false":et.value),et=rt,et!==tt?(o.setValue(et),!0):!1}function Xa(et){if(et=et||(typeof document<"u"?document:void 0),typeof et>"u")return null;try{return et.activeElement||et.body}catch{return et.body}}function Ya(et,o){var tt=o.checked;return A$1({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:tt??et._wrapperState.initialChecked})}function Za(et,o){var tt=o.defaultValue==null?"":o.defaultValue,rt=o.checked!=null?o.checked:o.defaultChecked;tt=Sa(o.value!=null?o.value:tt),et._wrapperState={initialChecked:rt,initialValue:tt,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ab(et,o){o=o.checked,o!=null&&ta(et,"checked",o,!1)}function bb(et,o){ab(et,o);var tt=Sa(o.value),rt=o.type;if(tt!=null)rt==="number"?(tt===0&&et.value===""||et.value!=tt)&&(et.value=""+tt):et.value!==""+tt&&(et.value=""+tt);else if(rt==="submit"||rt==="reset"){et.removeAttribute("value");return}o.hasOwnProperty("value")?cb$1(et,o.type,tt):o.hasOwnProperty("defaultValue")&&cb$1(et,o.type,Sa(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(et.defaultChecked=!!o.defaultChecked)}function db(et,o,tt){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var rt=o.type;if(!(rt!=="submit"&&rt!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+et._wrapperState.initialValue,tt||o===et.value||(et.value=o),et.defaultValue=o}tt=et.name,tt!==""&&(et.name=""),et.defaultChecked=!!et._wrapperState.initialChecked,tt!==""&&(et.name=tt)}function cb$1(et,o,tt){(o!=="number"||Xa(et.ownerDocument)!==et)&&(tt==null?et.defaultValue=""+et._wrapperState.initialValue:et.defaultValue!==""+tt&&(et.defaultValue=""+tt))}var eb=Array.isArray;function fb(et,o,tt,rt){if(et=et.options,o){o={};for(var nt=0;nt"+o.valueOf().toString()+"",o=mb.firstChild;et.firstChild;)et.removeChild(et.firstChild);for(;o.firstChild;)et.appendChild(o.firstChild)}});function ob(et,o){if(o){var tt=et.firstChild;if(tt&&tt===et.lastChild&&tt.nodeType===3){tt.nodeValue=o;return}}et.textContent=o}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(et){qb.forEach(function(o){o=o+et.charAt(0).toUpperCase()+et.substring(1),pb[o]=pb[et]})});function rb(et,o,tt){return o==null||typeof o=="boolean"||o===""?"":tt||typeof o!="number"||o===0||pb.hasOwnProperty(et)&&pb[et]?(""+o).trim():o+"px"}function sb(et,o){et=et.style;for(var tt in o)if(o.hasOwnProperty(tt)){var rt=tt.indexOf("--")===0,nt=rb(tt,o[tt],rt);tt==="float"&&(tt="cssFloat"),rt?et.setProperty(tt,nt):et[tt]=nt}}var tb=A$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(et,o){if(o){if(tb[et]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(p$4(137,et));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(p$4(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(p$4(61))}if(o.style!=null&&typeof o.style!="object")throw Error(p$4(62))}}function vb(et,o){if(et.indexOf("-")===-1)return typeof o.is=="string";switch(et){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(et){return et=et.target||et.srcElement||window,et.correspondingUseElement&&(et=et.correspondingUseElement),et.nodeType===3?et.parentNode:et}var yb=null,zb=null,Ab=null;function Bb(et){if(et=Cb(et)){if(typeof yb!="function")throw Error(p$4(280));var o=et.stateNode;o&&(o=Db(o),yb(et.stateNode,et.type,o))}}function Eb(et){zb?Ab?Ab.push(et):Ab=[et]:zb=et}function Fb(){if(zb){var et=zb,o=Ab;if(Ab=zb=null,Bb(et),o)for(et=0;et>>=0,et===0?32:31-(pc(et)/qc|0)|0}var rc=64,sc=4194304;function tc(et){switch(et&-et){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return et&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return et&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return et}}function uc(et,o){var tt=et.pendingLanes;if(tt===0)return 0;var rt=0,nt=et.suspendedLanes,ot=et.pingedLanes,it=tt&268435455;if(it!==0){var st=it&~nt;st!==0?rt=tc(st):(ot&=it,ot!==0&&(rt=tc(ot)))}else it=tt&~nt,it!==0?rt=tc(it):ot!==0&&(rt=tc(ot));if(rt===0)return 0;if(o!==0&&o!==rt&&!(o&nt)&&(nt=rt&-rt,ot=o&-o,nt>=ot||nt===16&&(ot&4194240)!==0))return o;if(rt&4&&(rt|=tt&16),o=et.entangledLanes,o!==0)for(et=et.entanglements,o&=rt;0tt;tt++)o.push(et);return o}function Ac(et,o,tt){et.pendingLanes|=o,o!==536870912&&(et.suspendedLanes=0,et.pingedLanes=0),et=et.eventTimes,o=31-oc(o),et[o]=tt}function Bc(et,o){var tt=et.pendingLanes&~o;et.pendingLanes=o,et.suspendedLanes=0,et.pingedLanes=0,et.expiredLanes&=o,et.mutableReadLanes&=o,et.entangledLanes&=o,o=et.entanglements;var rt=et.eventTimes;for(et=et.expirationTimes;0=be$1),ee$1=" ",fe$1=!1;function ge$1(et,o){switch(et){case"keyup":return $d.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$1(et){return et=et.detail,typeof et=="object"&&"data"in et?et.data:null}var ie$1=!1;function je$1(et,o){switch(et){case"compositionend":return he$1(o);case"keypress":return o.which!==32?null:(fe$1=!0,ee$1);case"textInput":return et=o.data,et===ee$1&&fe$1?null:et;default:return null}}function ke$1(et,o){if(ie$1)return et==="compositionend"||!ae$1&&ge$1(et,o)?(et=nd(),md=ld=kd=null,ie$1=!1,et):null;switch(et){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:tt,offset:o-et};et=rt}e:{for(;tt;){if(tt.nextSibling){tt=tt.nextSibling;break e}tt=tt.parentNode}tt=void 0}tt=Je(tt)}}function Le$1(et,o){return et&&o?et===o?!0:et&&et.nodeType===3?!1:o&&o.nodeType===3?Le$1(et,o.parentNode):"contains"in et?et.contains(o):et.compareDocumentPosition?!!(et.compareDocumentPosition(o)&16):!1:!1}function Me$1(){for(var et=window,o=Xa();o instanceof et.HTMLIFrameElement;){try{var tt=typeof o.contentWindow.location.href=="string"}catch{tt=!1}if(tt)et=o.contentWindow;else break;o=Xa(et.document)}return o}function Ne$1(et){var o=et&&et.nodeName&&et.nodeName.toLowerCase();return o&&(o==="input"&&(et.type==="text"||et.type==="search"||et.type==="tel"||et.type==="url"||et.type==="password")||o==="textarea"||et.contentEditable==="true")}function Oe$1(et){var o=Me$1(),tt=et.focusedElem,rt=et.selectionRange;if(o!==tt&&tt&&tt.ownerDocument&&Le$1(tt.ownerDocument.documentElement,tt)){if(rt!==null&&Ne$1(tt)){if(o=rt.start,et=rt.end,et===void 0&&(et=o),"selectionStart"in tt)tt.selectionStart=o,tt.selectionEnd=Math.min(et,tt.value.length);else if(et=(o=tt.ownerDocument||document)&&o.defaultView||window,et.getSelection){et=et.getSelection();var nt=tt.textContent.length,ot=Math.min(rt.start,nt);rt=rt.end===void 0?ot:Math.min(rt.end,nt),!et.extend&&ot>rt&&(nt=rt,rt=ot,ot=nt),nt=Ke(tt,ot);var it=Ke(tt,rt);nt&&it&&(et.rangeCount!==1||et.anchorNode!==nt.node||et.anchorOffset!==nt.offset||et.focusNode!==it.node||et.focusOffset!==it.offset)&&(o=o.createRange(),o.setStart(nt.node,nt.offset),et.removeAllRanges(),ot>rt?(et.addRange(o),et.extend(it.node,it.offset)):(o.setEnd(it.node,it.offset),et.addRange(o)))}}for(o=[],et=tt;et=et.parentNode;)et.nodeType===1&&o.push({element:et,left:et.scrollLeft,top:et.scrollTop});for(typeof tt.focus=="function"&&tt.focus(),tt=0;tt=document.documentMode,Qe=null,Re$1=null,Se$1=null,Te$1=!1;function Ue(et,o,tt){var rt=tt.window===tt?tt.document:tt.nodeType===9?tt:tt.ownerDocument;Te$1||Qe==null||Qe!==Xa(rt)||(rt=Qe,"selectionStart"in rt&&Ne$1(rt)?rt={start:rt.selectionStart,end:rt.selectionEnd}:(rt=(rt.ownerDocument&&rt.ownerDocument.defaultView||window).getSelection(),rt={anchorNode:rt.anchorNode,anchorOffset:rt.anchorOffset,focusNode:rt.focusNode,focusOffset:rt.focusOffset}),Se$1&&Ie(Se$1,rt)||(Se$1=rt,rt=oe$1(Re$1,"onSelect"),0Tf||(et.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(et,o){Tf++,Sf[Tf]=et.current,et.current=o}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(et,o){var tt=et.type.contextTypes;if(!tt)return Vf;var rt=et.stateNode;if(rt&&rt.__reactInternalMemoizedUnmaskedChildContext===o)return rt.__reactInternalMemoizedMaskedChildContext;var nt={},ot;for(ot in tt)nt[ot]=o[ot];return rt&&(et=et.stateNode,et.__reactInternalMemoizedUnmaskedChildContext=o,et.__reactInternalMemoizedMaskedChildContext=nt),nt}function Zf(et){return et=et.childContextTypes,et!=null}function $f(){E$1(Wf),E$1(H$1)}function ag(et,o,tt){if(H$1.current!==Vf)throw Error(p$4(168));G$1(H$1,o),G$1(Wf,tt)}function bg(et,o,tt){var rt=et.stateNode;if(o=o.childContextTypes,typeof rt.getChildContext!="function")return tt;rt=rt.getChildContext();for(var nt in rt)if(!(nt in o))throw Error(p$4(108,Ra(et)||"Unknown",nt));return A$1({},tt,rt)}function cg(et){return et=(et=et.stateNode)&&et.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G$1(H$1,et),G$1(Wf,Wf.current),!0}function dg(et,o,tt){var rt=et.stateNode;if(!rt)throw Error(p$4(169));tt?(et=bg(et,o,Xf),rt.__reactInternalMemoizedMergedChildContext=et,E$1(Wf),E$1(H$1),G$1(H$1,et)):E$1(Wf),G$1(Wf,tt)}var eg=null,fg=!1,gg=!1;function hg(et){eg===null?eg=[et]:eg.push(et)}function ig(et){fg=!0,hg(et)}function jg(){if(!gg&&eg!==null){gg=!0;var et=0,o=C$1;try{var tt=eg;for(C$1=1;et>=it,nt-=it,rg=1<<32-oc(o)+nt|tt<At?(kt=St,St=null):kt=St.sibling;var It=ht(gt,St,xt[At],vt);if(It===null){St===null&&(St=kt);break}et&&St&&It.alternate===null&&o(gt,St),bt=ot(It,bt,At),Ct===null?Et=It:Ct.sibling=It,Ct=It,St=kt}if(At===xt.length)return tt(gt,St),I$1&&tg(gt,At),Et;if(St===null){for(;AtAt?(kt=St,St=null):kt=St.sibling;var Nt=ht(gt,St,It.value,vt);if(Nt===null){St===null&&(St=kt);break}et&&St&&Nt.alternate===null&&o(gt,St),bt=ot(Nt,bt,At),Ct===null?Et=Nt:Ct.sibling=Nt,Ct=Nt,St=kt}if(It.done)return tt(gt,St),I$1&&tg(gt,At),Et;if(St===null){for(;!It.done;At++,It=xt.next())It=dt(gt,It.value,vt),It!==null&&(bt=ot(It,bt,At),Ct===null?Et=It:Ct.sibling=It,Ct=It);return I$1&&tg(gt,At),Et}for(St=rt(gt,St);!It.done;At++,It=xt.next())It=mt(St,gt,At,It.value,vt),It!==null&&(et&&It.alternate!==null&&St.delete(It.key===null?At:It.key),bt=ot(It,bt,At),Ct===null?Et=It:Ct.sibling=It,Ct=It);return et&&St.forEach(function(Lt){return o(gt,Lt)}),I$1&&tg(gt,At),Et}function yt(gt,bt,xt,vt){if(typeof xt=="object"&&xt!==null&&xt.type===ya&&xt.key===null&&(xt=xt.props.children),typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case va:e:{for(var Et=xt.key,Ct=bt;Ct!==null;){if(Ct.key===Et){if(Et=xt.type,Et===ya){if(Ct.tag===7){tt(gt,Ct.sibling),bt=nt(Ct,xt.props.children),bt.return=gt,gt=bt;break e}}else if(Ct.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===Ha&&Ng(Et)===Ct.type){tt(gt,Ct.sibling),bt=nt(Ct,xt.props),bt.ref=Lg(gt,Ct,xt),bt.return=gt,gt=bt;break e}tt(gt,Ct);break}else o(gt,Ct);Ct=Ct.sibling}xt.type===ya?(bt=Tg(xt.props.children,gt.mode,vt,xt.key),bt.return=gt,gt=bt):(vt=Rg(xt.type,xt.key,xt.props,null,gt.mode,vt),vt.ref=Lg(gt,bt,xt),vt.return=gt,gt=vt)}return it(gt);case wa:e:{for(Ct=xt.key;bt!==null;){if(bt.key===Ct)if(bt.tag===4&&bt.stateNode.containerInfo===xt.containerInfo&&bt.stateNode.implementation===xt.implementation){tt(gt,bt.sibling),bt=nt(bt,xt.children||[]),bt.return=gt,gt=bt;break e}else{tt(gt,bt);break}else o(gt,bt);bt=bt.sibling}bt=Sg(xt,gt.mode,vt),bt.return=gt,gt=bt}return it(gt);case Ha:return Ct=xt._init,yt(gt,bt,Ct(xt._payload),vt)}if(eb(xt))return ft(gt,bt,xt,vt);if(Ka(xt))return pt(gt,bt,xt,vt);Mg(gt,xt)}return typeof xt=="string"&&xt!==""||typeof xt=="number"?(xt=""+xt,bt!==null&&bt.tag===6?(tt(gt,bt.sibling),bt=nt(bt,xt),bt.return=gt,gt=bt):(tt(gt,bt),bt=Qg(xt,gt.mode,vt),bt.return=gt,gt=bt),it(gt)):tt(gt,bt)}return yt}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(et){var o=Wg.current;E$1(Wg),et._currentValue=o}function bh(et,o,tt){for(;et!==null;){var rt=et.alternate;if((et.childLanes&o)!==o?(et.childLanes|=o,rt!==null&&(rt.childLanes|=o)):rt!==null&&(rt.childLanes&o)!==o&&(rt.childLanes|=o),et===tt)break;et=et.return}}function ch(et,o){Xg=et,Zg=Yg=null,et=et.dependencies,et!==null&&et.firstContext!==null&&(et.lanes&o&&(dh=!0),et.firstContext=null)}function eh(et){var o=et._currentValue;if(Zg!==et)if(et={context:et,memoizedValue:o,next:null},Yg===null){if(Xg===null)throw Error(p$4(308));Yg=et,Xg.dependencies={lanes:0,firstContext:et}}else Yg=Yg.next=et;return o}var fh=null;function gh(et){fh===null?fh=[et]:fh.push(et)}function hh(et,o,tt,rt){var nt=o.interleaved;return nt===null?(tt.next=tt,gh(o)):(tt.next=nt.next,nt.next=tt),o.interleaved=tt,ih(et,rt)}function ih(et,o){et.lanes|=o;var tt=et.alternate;for(tt!==null&&(tt.lanes|=o),tt=et,et=et.return;et!==null;)et.childLanes|=o,tt=et.alternate,tt!==null&&(tt.childLanes|=o),tt=et,et=et.return;return tt.tag===3?tt.stateNode:null}var jh=!1;function kh(et){et.updateQueue={baseState:et.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(et,o){et=et.updateQueue,o.updateQueue===et&&(o.updateQueue={baseState:et.baseState,firstBaseUpdate:et.firstBaseUpdate,lastBaseUpdate:et.lastBaseUpdate,shared:et.shared,effects:et.effects})}function mh(et,o){return{eventTime:et,lane:o,tag:0,payload:null,callback:null,next:null}}function nh(et,o,tt){var rt=et.updateQueue;if(rt===null)return null;if(rt=rt.shared,K$1&2){var nt=rt.pending;return nt===null?o.next=o:(o.next=nt.next,nt.next=o),rt.pending=o,ih(et,tt)}return nt=rt.interleaved,nt===null?(o.next=o,gh(rt)):(o.next=nt.next,nt.next=o),rt.interleaved=o,ih(et,tt)}function oh(et,o,tt){if(o=o.updateQueue,o!==null&&(o=o.shared,(tt&4194240)!==0)){var rt=o.lanes;rt&=et.pendingLanes,tt|=rt,o.lanes=tt,Cc(et,tt)}}function ph(et,o){var tt=et.updateQueue,rt=et.alternate;if(rt!==null&&(rt=rt.updateQueue,tt===rt)){var nt=null,ot=null;if(tt=tt.firstBaseUpdate,tt!==null){do{var it={eventTime:tt.eventTime,lane:tt.lane,tag:tt.tag,payload:tt.payload,callback:tt.callback,next:null};ot===null?nt=ot=it:ot=ot.next=it,tt=tt.next}while(tt!==null);ot===null?nt=ot=o:ot=ot.next=o}else nt=ot=o;tt={baseState:rt.baseState,firstBaseUpdate:nt,lastBaseUpdate:ot,shared:rt.shared,effects:rt.effects},et.updateQueue=tt;return}et=tt.lastBaseUpdate,et===null?tt.firstBaseUpdate=o:et.next=o,tt.lastBaseUpdate=o}function qh(et,o,tt,rt){var nt=et.updateQueue;jh=!1;var ot=nt.firstBaseUpdate,it=nt.lastBaseUpdate,st=nt.shared.pending;if(st!==null){nt.shared.pending=null;var at=st,ct=at.next;at.next=null,it===null?ot=ct:it.next=ct,it=at;var lt=et.alternate;lt!==null&&(lt=lt.updateQueue,st=lt.lastBaseUpdate,st!==it&&(st===null?lt.firstBaseUpdate=ct:st.next=ct,lt.lastBaseUpdate=at))}if(ot!==null){var dt=nt.baseState;it=0,lt=ct=at=null,st=ot;do{var ht=st.lane,mt=st.eventTime;if((rt&ht)===ht){lt!==null&&(lt=lt.next={eventTime:mt,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var ft=et,pt=st;switch(ht=o,mt=tt,pt.tag){case 1:if(ft=pt.payload,typeof ft=="function"){dt=ft.call(mt,dt,ht);break e}dt=ft;break e;case 3:ft.flags=ft.flags&-65537|128;case 0:if(ft=pt.payload,ht=typeof ft=="function"?ft.call(mt,dt,ht):ft,ht==null)break e;dt=A$1({},dt,ht);break e;case 2:jh=!0}}st.callback!==null&&st.lane!==0&&(et.flags|=64,ht=nt.effects,ht===null?nt.effects=[st]:ht.push(st))}else mt={eventTime:mt,lane:ht,tag:st.tag,payload:st.payload,callback:st.callback,next:null},lt===null?(ct=lt=mt,at=dt):lt=lt.next=mt,it|=ht;if(st=st.next,st===null){if(st=nt.shared.pending,st===null)break;ht=st,st=ht.next,ht.next=null,nt.lastBaseUpdate=ht,nt.shared.pending=null}}while(!0);if(lt===null&&(at=dt),nt.baseState=at,nt.firstBaseUpdate=ct,nt.lastBaseUpdate=lt,o=nt.shared.interleaved,o!==null){nt=o;do it|=nt.lane,nt=nt.next;while(nt!==o)}else ot===null&&(nt.shared.lanes=0);rh|=it,et.lanes=it,et.memoizedState=dt}}function sh(et,o,tt){if(et=o.effects,o.effects=null,et!==null)for(o=0;ott?tt:4,et(!0);var rt=Gh.transition;Gh.transition={};try{et(!1),o()}finally{C$1=tt,Gh.transition=rt}}function wi(){return Uh().memoizedState}function xi(et,o,tt){var rt=yi(et);if(tt={lane:rt,action:tt,hasEagerState:!1,eagerState:null,next:null},zi(et))Ai(o,tt);else if(tt=hh(et,o,tt,rt),tt!==null){var nt=R();gi(tt,et,rt,nt),Bi(tt,o,rt)}}function ii(et,o,tt){var rt=yi(et),nt={lane:rt,action:tt,hasEagerState:!1,eagerState:null,next:null};if(zi(et))Ai(o,nt);else{var ot=et.alternate;if(et.lanes===0&&(ot===null||ot.lanes===0)&&(ot=o.lastRenderedReducer,ot!==null))try{var it=o.lastRenderedState,st=ot(it,tt);if(nt.hasEagerState=!0,nt.eagerState=st,He(st,it)){var at=o.interleaved;at===null?(nt.next=nt,gh(o)):(nt.next=at.next,at.next=nt),o.interleaved=nt;return}}catch{}finally{}tt=hh(et,o,nt,rt),tt!==null&&(nt=R(),gi(tt,et,rt,nt),Bi(tt,o,rt))}}function zi(et){var o=et.alternate;return et===M$1||o!==null&&o===M$1}function Ai(et,o){Jh=Ih=!0;var tt=et.pending;tt===null?o.next=o:(o.next=tt.next,tt.next=o),et.pending=o}function Bi(et,o,tt){if(tt&4194240){var rt=o.lanes;rt&=et.pendingLanes,tt|=rt,o.lanes=tt,Cc(et,tt)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(et,o){return Th().memoizedState=[et,o===void 0?null:o],et},useContext:eh,useEffect:mi,useImperativeHandle:function(et,o,tt){return tt=tt!=null?tt.concat([et]):null,ki(4194308,4,pi.bind(null,o,et),tt)},useLayoutEffect:function(et,o){return ki(4194308,4,et,o)},useInsertionEffect:function(et,o){return ki(4,2,et,o)},useMemo:function(et,o){var tt=Th();return o=o===void 0?null:o,et=et(),tt.memoizedState=[et,o],et},useReducer:function(et,o,tt){var rt=Th();return o=tt!==void 0?tt(o):o,rt.memoizedState=rt.baseState=o,et={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:et,lastRenderedState:o},rt.queue=et,et=et.dispatch=xi.bind(null,M$1,et),[rt.memoizedState,et]},useRef:function(et){var o=Th();return et={current:et},o.memoizedState=et},useState:hi,useDebugValue:ri,useDeferredValue:function(et){return Th().memoizedState=et},useTransition:function(){var et=hi(!1),o=et[0];return et=vi.bind(null,et[1]),Th().memoizedState=et,[o,et]},useMutableSource:function(){},useSyncExternalStore:function(et,o,tt){var rt=M$1,nt=Th();if(I$1){if(tt===void 0)throw Error(p$4(407));tt=tt()}else{if(tt=o(),Q$1===null)throw Error(p$4(349));Hh&30||di(rt,o,tt)}nt.memoizedState=tt;var ot={value:tt,getSnapshot:o};return nt.queue=ot,mi(ai.bind(null,rt,ot,et),[et]),rt.flags|=2048,bi(9,ci.bind(null,rt,ot,tt,o),void 0,null),tt},useId:function(){var et=Th(),o=Q$1.identifierPrefix;if(I$1){var tt=sg,rt=rg;tt=(rt&~(1<<32-oc(rt)-1)).toString(32)+tt,o=":"+o+"R"+tt,tt=Kh++,0<\/script>",et=et.removeChild(et.firstChild)):typeof rt.is=="string"?et=it.createElement(tt,{is:rt.is}):(et=it.createElement(tt),tt==="select"&&(it=et,rt.multiple?it.multiple=!0:rt.size&&(it.size=rt.size))):et=it.createElementNS(et,tt),et[Of]=o,et[Pf]=rt,zj(et,o,!1,!1),o.stateNode=et;e:{switch(it=vb(tt,rt),tt){case"dialog":D$1("cancel",et),D$1("close",et),nt=rt;break;case"iframe":case"object":case"embed":D$1("load",et),nt=rt;break;case"video":case"audio":for(nt=0;ntGj&&(o.flags|=128,rt=!0,Dj(ot,!1),o.lanes=4194304)}else{if(!rt)if(et=Ch(it),et!==null){if(o.flags|=128,rt=!0,tt=et.updateQueue,tt!==null&&(o.updateQueue=tt,o.flags|=4),Dj(ot,!0),ot.tail===null&&ot.tailMode==="hidden"&&!it.alternate&&!I$1)return S$1(o),null}else 2*B$1()-ot.renderingStartTime>Gj&&tt!==1073741824&&(o.flags|=128,rt=!0,Dj(ot,!1),o.lanes=4194304);ot.isBackwards?(it.sibling=o.child,o.child=it):(tt=ot.last,tt!==null?tt.sibling=it:o.child=it,ot.last=it)}return ot.tail!==null?(o=ot.tail,ot.rendering=o,ot.tail=o.sibling,ot.renderingStartTime=B$1(),o.sibling=null,tt=L$1.current,G$1(L$1,rt?tt&1|2:tt&1),o):(S$1(o),null);case 22:case 23:return Hj(),rt=o.memoizedState!==null,et!==null&&et.memoizedState!==null!==rt&&(o.flags|=8192),rt&&o.mode&1?fj&1073741824&&(S$1(o),o.subtreeFlags&6&&(o.flags|=8192)):S$1(o),null;case 24:return null;case 25:return null}throw Error(p$4(156,o.tag))}function Ij(et,o){switch(wg(o),o.tag){case 1:return Zf(o.type)&&$f(),et=o.flags,et&65536?(o.flags=et&-65537|128,o):null;case 3:return zh(),E$1(Wf),E$1(H$1),Eh(),et=o.flags,et&65536&&!(et&128)?(o.flags=et&-65537|128,o):null;case 5:return Bh(o),null;case 13:if(E$1(L$1),et=o.memoizedState,et!==null&&et.dehydrated!==null){if(o.alternate===null)throw Error(p$4(340));Ig()}return et=o.flags,et&65536?(o.flags=et&-65537|128,o):null;case 19:return E$1(L$1),null;case 4:return zh(),null;case 10:return ah(o.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U$1=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V$2=null;function Lj(et,o){var tt=et.ref;if(tt!==null)if(typeof tt=="function")try{tt(null)}catch(rt){W$1(et,o,rt)}else tt.current=null}function Mj(et,o,tt){try{tt()}catch(rt){W$1(et,o,rt)}}var Nj=!1;function Oj(et,o){if(Cf=dd,et=Me$1(),Ne$1(et)){if("selectionStart"in et)var tt={start:et.selectionStart,end:et.selectionEnd};else e:{tt=(tt=et.ownerDocument)&&tt.defaultView||window;var rt=tt.getSelection&&tt.getSelection();if(rt&&rt.rangeCount!==0){tt=rt.anchorNode;var nt=rt.anchorOffset,ot=rt.focusNode;rt=rt.focusOffset;try{tt.nodeType,ot.nodeType}catch{tt=null;break e}var it=0,st=-1,at=-1,ct=0,lt=0,dt=et,ht=null;t:for(;;){for(var mt;dt!==tt||nt!==0&&dt.nodeType!==3||(st=it+nt),dt!==ot||rt!==0&&dt.nodeType!==3||(at=it+rt),dt.nodeType===3&&(it+=dt.nodeValue.length),(mt=dt.firstChild)!==null;)ht=dt,dt=mt;for(;;){if(dt===et)break t;if(ht===tt&&++ct===nt&&(st=it),ht===ot&&++lt===rt&&(at=it),(mt=dt.nextSibling)!==null)break;dt=ht,ht=dt.parentNode}dt=mt}tt=st===-1||at===-1?null:{start:st,end:at}}else tt=null}tt=tt||{start:0,end:0}}else tt=null;for(Df={focusedElem:et,selectionRange:tt},dd=!1,V$2=o;V$2!==null;)if(o=V$2,et=o.child,(o.subtreeFlags&1028)!==0&&et!==null)et.return=o,V$2=et;else for(;V$2!==null;){o=V$2;try{var ft=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ft!==null){var pt=ft.memoizedProps,yt=ft.memoizedState,gt=o.stateNode,bt=gt.getSnapshotBeforeUpdate(o.elementType===o.type?pt:Ci(o.type,pt),yt);gt.__reactInternalSnapshotBeforeUpdate=bt}break;case 3:var xt=o.stateNode.containerInfo;xt.nodeType===1?xt.textContent="":xt.nodeType===9&&xt.documentElement&&xt.removeChild(xt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$4(163))}}catch(vt){W$1(o,o.return,vt)}if(et=o.sibling,et!==null){et.return=o.return,V$2=et;break}V$2=o.return}return ft=Nj,Nj=!1,ft}function Pj(et,o,tt){var rt=o.updateQueue;if(rt=rt!==null?rt.lastEffect:null,rt!==null){var nt=rt=rt.next;do{if((nt.tag&et)===et){var ot=nt.destroy;nt.destroy=void 0,ot!==void 0&&Mj(o,tt,ot)}nt=nt.next}while(nt!==rt)}}function Qj(et,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var tt=o=o.next;do{if((tt.tag&et)===et){var rt=tt.create;tt.destroy=rt()}tt=tt.next}while(tt!==o)}}function Rj(et){var o=et.ref;if(o!==null){var tt=et.stateNode;switch(et.tag){case 5:et=tt;break;default:et=tt}typeof o=="function"?o(et):o.current=et}}function Sj(et){var o=et.alternate;o!==null&&(et.alternate=null,Sj(o)),et.child=null,et.deletions=null,et.sibling=null,et.tag===5&&(o=et.stateNode,o!==null&&(delete o[Of],delete o[Pf],delete o[of],delete o[Qf],delete o[Rf])),et.stateNode=null,et.return=null,et.dependencies=null,et.memoizedProps=null,et.memoizedState=null,et.pendingProps=null,et.stateNode=null,et.updateQueue=null}function Tj(et){return et.tag===5||et.tag===3||et.tag===4}function Uj(et){e:for(;;){for(;et.sibling===null;){if(et.return===null||Tj(et.return))return null;et=et.return}for(et.sibling.return=et.return,et=et.sibling;et.tag!==5&&et.tag!==6&&et.tag!==18;){if(et.flags&2||et.child===null||et.tag===4)continue e;et.child.return=et,et=et.child}if(!(et.flags&2))return et.stateNode}}function Vj(et,o,tt){var rt=et.tag;if(rt===5||rt===6)et=et.stateNode,o?tt.nodeType===8?tt.parentNode.insertBefore(et,o):tt.insertBefore(et,o):(tt.nodeType===8?(o=tt.parentNode,o.insertBefore(et,tt)):(o=tt,o.appendChild(et)),tt=tt._reactRootContainer,tt!=null||o.onclick!==null||(o.onclick=Bf));else if(rt!==4&&(et=et.child,et!==null))for(Vj(et,o,tt),et=et.sibling;et!==null;)Vj(et,o,tt),et=et.sibling}function Wj(et,o,tt){var rt=et.tag;if(rt===5||rt===6)et=et.stateNode,o?tt.insertBefore(et,o):tt.appendChild(et);else if(rt!==4&&(et=et.child,et!==null))for(Wj(et,o,tt),et=et.sibling;et!==null;)Wj(et,o,tt),et=et.sibling}var X$1=null,Xj=!1;function Yj(et,o,tt){for(tt=tt.child;tt!==null;)Zj(et,o,tt),tt=tt.sibling}function Zj(et,o,tt){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,tt)}catch{}switch(tt.tag){case 5:U$1||Lj(tt,o);case 6:var rt=X$1,nt=Xj;X$1=null,Yj(et,o,tt),X$1=rt,Xj=nt,X$1!==null&&(Xj?(et=X$1,tt=tt.stateNode,et.nodeType===8?et.parentNode.removeChild(tt):et.removeChild(tt)):X$1.removeChild(tt.stateNode));break;case 18:X$1!==null&&(Xj?(et=X$1,tt=tt.stateNode,et.nodeType===8?Kf(et.parentNode,tt):et.nodeType===1&&Kf(et,tt),bd(et)):Kf(X$1,tt.stateNode));break;case 4:rt=X$1,nt=Xj,X$1=tt.stateNode.containerInfo,Xj=!0,Yj(et,o,tt),X$1=rt,Xj=nt;break;case 0:case 11:case 14:case 15:if(!U$1&&(rt=tt.updateQueue,rt!==null&&(rt=rt.lastEffect,rt!==null))){nt=rt=rt.next;do{var ot=nt,it=ot.destroy;ot=ot.tag,it!==void 0&&(ot&2||ot&4)&&Mj(tt,o,it),nt=nt.next}while(nt!==rt)}Yj(et,o,tt);break;case 1:if(!U$1&&(Lj(tt,o),rt=tt.stateNode,typeof rt.componentWillUnmount=="function"))try{rt.props=tt.memoizedProps,rt.state=tt.memoizedState,rt.componentWillUnmount()}catch(st){W$1(tt,o,st)}Yj(et,o,tt);break;case 21:Yj(et,o,tt);break;case 22:tt.mode&1?(U$1=(rt=U$1)||tt.memoizedState!==null,Yj(et,o,tt),U$1=rt):Yj(et,o,tt);break;default:Yj(et,o,tt)}}function ak(et){var o=et.updateQueue;if(o!==null){et.updateQueue=null;var tt=et.stateNode;tt===null&&(tt=et.stateNode=new Kj),o.forEach(function(rt){var nt=bk.bind(null,et,rt);tt.has(rt)||(tt.add(rt),rt.then(nt,nt))})}}function ck(et,o){var tt=o.deletions;if(tt!==null)for(var rt=0;rtnt&&(nt=it),rt&=~ot}if(rt=nt,rt=B$1()-rt,rt=(120>rt?120:480>rt?480:1080>rt?1080:1920>rt?1920:3e3>rt?3e3:4320>rt?4320:1960*lk(rt/1960))-rt,10et?16:et,wk===null)var rt=!1;else{if(et=wk,wk=null,xk=0,K$1&6)throw Error(p$4(331));var nt=K$1;for(K$1|=4,V$2=et.current;V$2!==null;){var ot=V$2,it=ot.child;if(V$2.flags&16){var st=ot.deletions;if(st!==null){for(var at=0;atB$1()-fk?Kk(et,0):rk|=tt),Dk(et,o)}function Yk(et,o){o===0&&(et.mode&1?(o=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):o=1);var tt=R();et=ih(et,o),et!==null&&(Ac(et,o,tt),Dk(et,tt))}function uj(et){var o=et.memoizedState,tt=0;o!==null&&(tt=o.retryLane),Yk(et,tt)}function bk(et,o){var tt=0;switch(et.tag){case 13:var rt=et.stateNode,nt=et.memoizedState;nt!==null&&(tt=nt.retryLane);break;case 19:rt=et.stateNode;break;default:throw Error(p$4(314))}rt!==null&&rt.delete(o),Yk(et,tt)}var Vk;Vk=function(et,o,tt){if(et!==null)if(et.memoizedProps!==o.pendingProps||Wf.current)dh=!0;else{if(!(et.lanes&tt)&&!(o.flags&128))return dh=!1,yj(et,o,tt);dh=!!(et.flags&131072)}else dh=!1,I$1&&o.flags&1048576&&ug(o,ng,o.index);switch(o.lanes=0,o.tag){case 2:var rt=o.type;ij(et,o),et=o.pendingProps;var nt=Yf(o,H$1.current);ch(o,tt),nt=Nh(null,o,rt,et,nt,tt);var ot=Sh();return o.flags|=1,typeof nt=="object"&&nt!==null&&typeof nt.render=="function"&&nt.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Zf(rt)?(ot=!0,cg(o)):ot=!1,o.memoizedState=nt.state!==null&&nt.state!==void 0?nt.state:null,kh(o),nt.updater=Ei,o.stateNode=nt,nt._reactInternals=o,Ii(o,rt,et,tt),o=jj(null,o,rt,!0,ot,tt)):(o.tag=0,I$1&&ot&&vg(o),Xi(null,o,nt,tt),o=o.child),o;case 16:rt=o.elementType;e:{switch(ij(et,o),et=o.pendingProps,nt=rt._init,rt=nt(rt._payload),o.type=rt,nt=o.tag=Zk(rt),et=Ci(rt,et),nt){case 0:o=cj(null,o,rt,et,tt);break e;case 1:o=hj(null,o,rt,et,tt);break e;case 11:o=Yi(null,o,rt,et,tt);break e;case 14:o=$i(null,o,rt,Ci(rt.type,et),tt);break e}throw Error(p$4(306,rt,""))}return o;case 0:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),cj(et,o,rt,nt,tt);case 1:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),hj(et,o,rt,nt,tt);case 3:e:{if(kj(o),et===null)throw Error(p$4(387));rt=o.pendingProps,ot=o.memoizedState,nt=ot.element,lh(et,o),qh(o,rt,null,tt);var it=o.memoizedState;if(rt=it.element,ot.isDehydrated)if(ot={element:rt,isDehydrated:!1,cache:it.cache,pendingSuspenseBoundaries:it.pendingSuspenseBoundaries,transitions:it.transitions},o.updateQueue.baseState=ot,o.memoizedState=ot,o.flags&256){nt=Ji(Error(p$4(423)),o),o=lj(et,o,rt,tt,nt);break e}else if(rt!==nt){nt=Ji(Error(p$4(424)),o),o=lj(et,o,rt,tt,nt);break e}else for(yg=Lf(o.stateNode.containerInfo.firstChild),xg=o,I$1=!0,zg=null,tt=Vg(o,null,rt,tt),o.child=tt;tt;)tt.flags=tt.flags&-3|4096,tt=tt.sibling;else{if(Ig(),rt===nt){o=Zi(et,o,tt);break e}Xi(et,o,rt,tt)}o=o.child}return o;case 5:return Ah(o),et===null&&Eg(o),rt=o.type,nt=o.pendingProps,ot=et!==null?et.memoizedProps:null,it=nt.children,Ef(rt,nt)?it=null:ot!==null&&Ef(rt,ot)&&(o.flags|=32),gj(et,o),Xi(et,o,it,tt),o.child;case 6:return et===null&&Eg(o),null;case 13:return oj(et,o,tt);case 4:return yh(o,o.stateNode.containerInfo),rt=o.pendingProps,et===null?o.child=Ug(o,null,rt,tt):Xi(et,o,rt,tt),o.child;case 11:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),Yi(et,o,rt,nt,tt);case 7:return Xi(et,o,o.pendingProps,tt),o.child;case 8:return Xi(et,o,o.pendingProps.children,tt),o.child;case 12:return Xi(et,o,o.pendingProps.children,tt),o.child;case 10:e:{if(rt=o.type._context,nt=o.pendingProps,ot=o.memoizedProps,it=nt.value,G$1(Wg,rt._currentValue),rt._currentValue=it,ot!==null)if(He(ot.value,it)){if(ot.children===nt.children&&!Wf.current){o=Zi(et,o,tt);break e}}else for(ot=o.child,ot!==null&&(ot.return=o);ot!==null;){var st=ot.dependencies;if(st!==null){it=ot.child;for(var at=st.firstContext;at!==null;){if(at.context===rt){if(ot.tag===1){at=mh(-1,tt&-tt),at.tag=2;var ct=ot.updateQueue;if(ct!==null){ct=ct.shared;var lt=ct.pending;lt===null?at.next=at:(at.next=lt.next,lt.next=at),ct.pending=at}}ot.lanes|=tt,at=ot.alternate,at!==null&&(at.lanes|=tt),bh(ot.return,tt,o),st.lanes|=tt;break}at=at.next}}else if(ot.tag===10)it=ot.type===o.type?null:ot.child;else if(ot.tag===18){if(it=ot.return,it===null)throw Error(p$4(341));it.lanes|=tt,st=it.alternate,st!==null&&(st.lanes|=tt),bh(it,tt,o),it=ot.sibling}else it=ot.child;if(it!==null)it.return=ot;else for(it=ot;it!==null;){if(it===o){it=null;break}if(ot=it.sibling,ot!==null){ot.return=it.return,it=ot;break}it=it.return}ot=it}Xi(et,o,nt.children,tt),o=o.child}return o;case 9:return nt=o.type,rt=o.pendingProps.children,ch(o,tt),nt=eh(nt),rt=rt(nt),o.flags|=1,Xi(et,o,rt,tt),o.child;case 14:return rt=o.type,nt=Ci(rt,o.pendingProps),nt=Ci(rt.type,nt),$i(et,o,rt,nt,tt);case 15:return bj(et,o,o.type,o.pendingProps,tt);case 17:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),ij(et,o),o.tag=1,Zf(rt)?(et=!0,cg(o)):et=!1,ch(o,tt),Gi(o,rt,nt),Ii(o,rt,nt,tt),jj(null,o,rt,!0,et,tt);case 19:return xj(et,o,tt);case 22:return dj(et,o,tt)}throw Error(p$4(156,o.tag))};function Fk(et,o){return ac(et,o)}function $k(et,o,tt,rt){this.tag=et,this.key=tt,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=rt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(et,o,tt,rt){return new $k(et,o,tt,rt)}function aj(et){return et=et.prototype,!(!et||!et.isReactComponent)}function Zk(et){if(typeof et=="function")return aj(et)?1:0;if(et!=null){if(et=et.$$typeof,et===Da)return 11;if(et===Ga)return 14}return 2}function Pg(et,o){var tt=et.alternate;return tt===null?(tt=Bg(et.tag,o,et.key,et.mode),tt.elementType=et.elementType,tt.type=et.type,tt.stateNode=et.stateNode,tt.alternate=et,et.alternate=tt):(tt.pendingProps=o,tt.type=et.type,tt.flags=0,tt.subtreeFlags=0,tt.deletions=null),tt.flags=et.flags&14680064,tt.childLanes=et.childLanes,tt.lanes=et.lanes,tt.child=et.child,tt.memoizedProps=et.memoizedProps,tt.memoizedState=et.memoizedState,tt.updateQueue=et.updateQueue,o=et.dependencies,tt.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},tt.sibling=et.sibling,tt.index=et.index,tt.ref=et.ref,tt}function Rg(et,o,tt,rt,nt,ot){var it=2;if(rt=et,typeof et=="function")aj(et)&&(it=1);else if(typeof et=="string")it=5;else e:switch(et){case ya:return Tg(tt.children,nt,ot,o);case za:it=8,nt|=8;break;case Aa:return et=Bg(12,tt,o,nt|2),et.elementType=Aa,et.lanes=ot,et;case Ea:return et=Bg(13,tt,o,nt),et.elementType=Ea,et.lanes=ot,et;case Fa:return et=Bg(19,tt,o,nt),et.elementType=Fa,et.lanes=ot,et;case Ia:return pj(tt,nt,ot,o);default:if(typeof et=="object"&&et!==null)switch(et.$$typeof){case Ba:it=10;break e;case Ca:it=9;break e;case Da:it=11;break e;case Ga:it=14;break e;case Ha:it=16,rt=null;break e}throw Error(p$4(130,et==null?et:typeof et,""))}return o=Bg(it,tt,o,nt),o.elementType=et,o.type=rt,o.lanes=ot,o}function Tg(et,o,tt,rt){return et=Bg(7,et,rt,o),et.lanes=tt,et}function pj(et,o,tt,rt){return et=Bg(22,et,rt,o),et.elementType=Ia,et.lanes=tt,et.stateNode={isHidden:!1},et}function Qg(et,o,tt){return et=Bg(6,et,null,o),et.lanes=tt,et}function Sg(et,o,tt){return o=Bg(4,et.children!==null?et.children:[],et.key,o),o.lanes=tt,o.stateNode={containerInfo:et.containerInfo,pendingChildren:null,implementation:et.implementation},o}function al(et,o,tt,rt,nt){this.tag=o,this.containerInfo=et,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=rt,this.onRecoverableError=nt,this.mutableSourceEagerHydrationData=null}function bl(et,o,tt,rt,nt,ot,it,st,at){return et=new al(et,o,tt,st,at),o===1?(o=1,ot===!0&&(o|=8)):o=0,ot=Bg(3,null,null,o),et.current=ot,ot.stateNode=et,ot.memoizedState={element:rt,isDehydrated:tt,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(ot),et}function cl(et,o,tt){var rt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(et){console.error(et)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports;const ReactDOM=getDefaultExportFromCjs(reactDomExports);var createRoot,m$5=reactDomExports;createRoot=m$5.createRoot,m$5.hydrateRoot;const version$8="2.21.28";let errorConfig={getDocsUrl:({docsBaseUrl:et,docsPath:o="",docsSlug:tt})=>o?`${et??"https://viem.sh"}${o}${tt?`#${tt}`:""}`:void 0,version:version$8},BaseError$3=class ks extends Error{constructor(o,tt={}){var st;const rt=(()=>{var at;return tt.cause instanceof ks?tt.cause.details:(at=tt.cause)!=null&&at.message?tt.cause.message:tt.details})(),nt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=(st=errorConfig.getDocsUrl)==null?void 0:st.call(errorConfig,{...tt,docsPath:nt}),it=[o||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...ot?[`Docs: ${ot}`]:[],...rt?[`Details: ${rt}`]:[],`Version: ${errorConfig.version}`].join(` +`+ot.stack}return{value:et,source:o,stack:nt,digest:null}}function Ki(et,o,tt){return{value:et,source:null,stack:tt??null,digest:o??null}}function Li(et,o){try{console.error(o.value)}catch(tt){setTimeout(function(){throw tt})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(et,o,tt){tt=mh(-1,tt),tt.tag=3,tt.payload={element:null};var rt=o.value;return tt.callback=function(){Oi||(Oi=!0,Pi=rt),Li(et,o)},tt}function Qi(et,o,tt){tt=mh(-1,tt),tt.tag=3;var rt=et.type.getDerivedStateFromError;if(typeof rt=="function"){var nt=o.value;tt.payload=function(){return rt(nt)},tt.callback=function(){Li(et,o)}}var ot=et.stateNode;return ot!==null&&typeof ot.componentDidCatch=="function"&&(tt.callback=function(){Li(et,o),typeof rt!="function"&&(Ri===null?Ri=new Set([this]):Ri.add(this));var it=o.stack;this.componentDidCatch(o.value,{componentStack:it!==null?it:""})}),tt}function Si(et,o,tt){var rt=et.pingCache;if(rt===null){rt=et.pingCache=new Mi;var nt=new Set;rt.set(o,nt)}else nt=rt.get(o),nt===void 0&&(nt=new Set,rt.set(o,nt));nt.has(tt)||(nt.add(tt),et=Ti.bind(null,et,o,tt),o.then(et,et))}function Ui(et){do{var o;if((o=et.tag===13)&&(o=et.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return et;et=et.return}while(et!==null);return null}function Vi(et,o,tt,rt,nt){return et.mode&1?(et.flags|=65536,et.lanes=nt,et):(et===o?et.flags|=65536:(et.flags|=128,tt.flags|=131072,tt.flags&=-52805,tt.tag===1&&(tt.alternate===null?tt.tag=17:(o=mh(-1,1),o.tag=2,nh(tt,o,1))),tt.lanes|=1),et)}var Wi=ua.ReactCurrentOwner,dh=!1;function Xi(et,o,tt,rt){o.child=et===null?Vg(o,null,tt,rt):Ug(o,et.child,tt,rt)}function Yi(et,o,tt,rt,nt){tt=tt.render;var ot=o.ref;return ch(o,nt),rt=Nh(et,o,tt,rt,ot,nt),tt=Sh(),et!==null&&!dh?(o.updateQueue=et.updateQueue,o.flags&=-2053,et.lanes&=~nt,Zi(et,o,nt)):(I$1&&tt&&vg(o),o.flags|=1,Xi(et,o,rt,nt),o.child)}function $i(et,o,tt,rt,nt){if(et===null){var ot=tt.type;return typeof ot=="function"&&!aj(ot)&&ot.defaultProps===void 0&&tt.compare===null&&tt.defaultProps===void 0?(o.tag=15,o.type=ot,bj(et,o,ot,rt,nt)):(et=Rg(tt.type,null,rt,o,o.mode,nt),et.ref=o.ref,et.return=o,o.child=et)}if(ot=et.child,!(et.lanes&nt)){var it=ot.memoizedProps;if(tt=tt.compare,tt=tt!==null?tt:Ie,tt(it,rt)&&et.ref===o.ref)return Zi(et,o,nt)}return o.flags|=1,et=Pg(ot,rt),et.ref=o.ref,et.return=o,o.child=et}function bj(et,o,tt,rt,nt){if(et!==null){var ot=et.memoizedProps;if(Ie(ot,rt)&&et.ref===o.ref)if(dh=!1,o.pendingProps=rt=ot,(et.lanes&nt)!==0)et.flags&131072&&(dh=!0);else return o.lanes=et.lanes,Zi(et,o,nt)}return cj(et,o,tt,rt,nt)}function dj(et,o,tt){var rt=o.pendingProps,nt=rt.children,ot=et!==null?et.memoizedState:null;if(rt.mode==="hidden")if(!(o.mode&1))o.memoizedState={baseLanes:0,cachePool:null,transitions:null},G$1(ej,fj),fj|=tt;else{if(!(tt&1073741824))return et=ot!==null?ot.baseLanes|tt:tt,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:et,cachePool:null,transitions:null},o.updateQueue=null,G$1(ej,fj),fj|=et,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},rt=ot!==null?ot.baseLanes:tt,G$1(ej,fj),fj|=rt}else ot!==null?(rt=ot.baseLanes|tt,o.memoizedState=null):rt=tt,G$1(ej,fj),fj|=rt;return Xi(et,o,nt,tt),o.child}function gj(et,o){var tt=o.ref;(et===null&&tt!==null||et!==null&&et.ref!==tt)&&(o.flags|=512,o.flags|=2097152)}function cj(et,o,tt,rt,nt){var ot=Zf(tt)?Xf:H$1.current;return ot=Yf(o,ot),ch(o,nt),tt=Nh(et,o,tt,rt,ot,nt),rt=Sh(),et!==null&&!dh?(o.updateQueue=et.updateQueue,o.flags&=-2053,et.lanes&=~nt,Zi(et,o,nt)):(I$1&&rt&&vg(o),o.flags|=1,Xi(et,o,tt,nt),o.child)}function hj(et,o,tt,rt,nt){if(Zf(tt)){var ot=!0;cg(o)}else ot=!1;if(ch(o,nt),o.stateNode===null)ij(et,o),Gi(o,tt,rt),Ii(o,tt,rt,nt),rt=!0;else if(et===null){var it=o.stateNode,st=o.memoizedProps;it.props=st;var at=it.context,ct=tt.contextType;typeof ct=="object"&&ct!==null?ct=eh(ct):(ct=Zf(tt)?Xf:H$1.current,ct=Yf(o,ct));var lt=tt.getDerivedStateFromProps,dt=typeof lt=="function"||typeof it.getSnapshotBeforeUpdate=="function";dt||typeof it.UNSAFE_componentWillReceiveProps!="function"&&typeof it.componentWillReceiveProps!="function"||(st!==rt||at!==ct)&&Hi(o,it,rt,ct),jh=!1;var ht=o.memoizedState;it.state=ht,qh(o,rt,it,nt),at=o.memoizedState,st!==rt||ht!==at||Wf.current||jh?(typeof lt=="function"&&(Di(o,tt,lt,rt),at=o.memoizedState),(st=jh||Fi(o,tt,st,rt,ht,at,ct))?(dt||typeof it.UNSAFE_componentWillMount!="function"&&typeof it.componentWillMount!="function"||(typeof it.componentWillMount=="function"&&it.componentWillMount(),typeof it.UNSAFE_componentWillMount=="function"&&it.UNSAFE_componentWillMount()),typeof it.componentDidMount=="function"&&(o.flags|=4194308)):(typeof it.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=rt,o.memoizedState=at),it.props=rt,it.state=at,it.context=ct,rt=st):(typeof it.componentDidMount=="function"&&(o.flags|=4194308),rt=!1)}else{it=o.stateNode,lh(et,o),st=o.memoizedProps,ct=o.type===o.elementType?st:Ci(o.type,st),it.props=ct,dt=o.pendingProps,ht=it.context,at=tt.contextType,typeof at=="object"&&at!==null?at=eh(at):(at=Zf(tt)?Xf:H$1.current,at=Yf(o,at));var mt=tt.getDerivedStateFromProps;(lt=typeof mt=="function"||typeof it.getSnapshotBeforeUpdate=="function")||typeof it.UNSAFE_componentWillReceiveProps!="function"&&typeof it.componentWillReceiveProps!="function"||(st!==dt||ht!==at)&&Hi(o,it,rt,at),jh=!1,ht=o.memoizedState,it.state=ht,qh(o,rt,it,nt);var ft=o.memoizedState;st!==dt||ht!==ft||Wf.current||jh?(typeof mt=="function"&&(Di(o,tt,mt,rt),ft=o.memoizedState),(ct=jh||Fi(o,tt,ct,rt,ht,ft,at)||!1)?(lt||typeof it.UNSAFE_componentWillUpdate!="function"&&typeof it.componentWillUpdate!="function"||(typeof it.componentWillUpdate=="function"&&it.componentWillUpdate(rt,ft,at),typeof it.UNSAFE_componentWillUpdate=="function"&&it.UNSAFE_componentWillUpdate(rt,ft,at)),typeof it.componentDidUpdate=="function"&&(o.flags|=4),typeof it.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof it.componentDidUpdate!="function"||st===et.memoizedProps&&ht===et.memoizedState||(o.flags|=4),typeof it.getSnapshotBeforeUpdate!="function"||st===et.memoizedProps&&ht===et.memoizedState||(o.flags|=1024),o.memoizedProps=rt,o.memoizedState=ft),it.props=rt,it.state=ft,it.context=at,rt=ct):(typeof it.componentDidUpdate!="function"||st===et.memoizedProps&&ht===et.memoizedState||(o.flags|=4),typeof it.getSnapshotBeforeUpdate!="function"||st===et.memoizedProps&&ht===et.memoizedState||(o.flags|=1024),rt=!1)}return jj(et,o,tt,rt,ot,nt)}function jj(et,o,tt,rt,nt,ot){gj(et,o);var it=(o.flags&128)!==0;if(!rt&&!it)return nt&&dg(o,tt,!1),Zi(et,o,ot);rt=o.stateNode,Wi.current=o;var st=it&&typeof tt.getDerivedStateFromError!="function"?null:rt.render();return o.flags|=1,et!==null&&it?(o.child=Ug(o,et.child,null,ot),o.child=Ug(o,null,st,ot)):Xi(et,o,st,ot),o.memoizedState=rt.state,nt&&dg(o,tt,!0),o.child}function kj(et){var o=et.stateNode;o.pendingContext?ag(et,o.pendingContext,o.pendingContext!==o.context):o.context&&ag(et,o.context,!1),yh(et,o.containerInfo)}function lj(et,o,tt,rt,nt){return Ig(),Jg(nt),o.flags|=256,Xi(et,o,tt,rt),o.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(et){return{baseLanes:et,cachePool:null,transitions:null}}function oj(et,o,tt){var rt=o.pendingProps,nt=L$1.current,ot=!1,it=(o.flags&128)!==0,st;if((st=it)||(st=et!==null&&et.memoizedState===null?!1:(nt&2)!==0),st?(ot=!0,o.flags&=-129):(et===null||et.memoizedState!==null)&&(nt|=1),G$1(L$1,nt&1),et===null)return Eg(o),et=o.memoizedState,et!==null&&(et=et.dehydrated,et!==null)?(o.mode&1?et.data==="$!"?o.lanes=8:o.lanes=1073741824:o.lanes=1,null):(it=rt.children,et=rt.fallback,ot?(rt=o.mode,ot=o.child,it={mode:"hidden",children:it},!(rt&1)&&ot!==null?(ot.childLanes=0,ot.pendingProps=it):ot=pj(it,rt,0,null),et=Tg(et,rt,tt,null),ot.return=o,et.return=o,ot.sibling=et,o.child=ot,o.child.memoizedState=nj(tt),o.memoizedState=mj,et):qj(o,it));if(nt=et.memoizedState,nt!==null&&(st=nt.dehydrated,st!==null))return rj(et,o,it,rt,st,nt,tt);if(ot){ot=rt.fallback,it=o.mode,nt=et.child,st=nt.sibling;var at={mode:"hidden",children:rt.children};return!(it&1)&&o.child!==nt?(rt=o.child,rt.childLanes=0,rt.pendingProps=at,o.deletions=null):(rt=Pg(nt,at),rt.subtreeFlags=nt.subtreeFlags&14680064),st!==null?ot=Pg(st,ot):(ot=Tg(ot,it,tt,null),ot.flags|=2),ot.return=o,rt.return=o,rt.sibling=ot,o.child=rt,rt=ot,ot=o.child,it=et.child.memoizedState,it=it===null?nj(tt):{baseLanes:it.baseLanes|tt,cachePool:null,transitions:it.transitions},ot.memoizedState=it,ot.childLanes=et.childLanes&~tt,o.memoizedState=mj,rt}return ot=et.child,et=ot.sibling,rt=Pg(ot,{mode:"visible",children:rt.children}),!(o.mode&1)&&(rt.lanes=tt),rt.return=o,rt.sibling=null,et!==null&&(tt=o.deletions,tt===null?(o.deletions=[et],o.flags|=16):tt.push(et)),o.child=rt,o.memoizedState=null,rt}function qj(et,o){return o=pj({mode:"visible",children:o},et.mode,0,null),o.return=et,et.child=o}function sj(et,o,tt,rt){return rt!==null&&Jg(rt),Ug(o,et.child,null,tt),et=qj(o,o.pendingProps.children),et.flags|=2,o.memoizedState=null,et}function rj(et,o,tt,rt,nt,ot,it){if(tt)return o.flags&256?(o.flags&=-257,rt=Ki(Error(p$4(422))),sj(et,o,it,rt)):o.memoizedState!==null?(o.child=et.child,o.flags|=128,null):(ot=rt.fallback,nt=o.mode,rt=pj({mode:"visible",children:rt.children},nt,0,null),ot=Tg(ot,nt,it,null),ot.flags|=2,rt.return=o,ot.return=o,rt.sibling=ot,o.child=rt,o.mode&1&&Ug(o,et.child,null,it),o.child.memoizedState=nj(it),o.memoizedState=mj,ot);if(!(o.mode&1))return sj(et,o,it,null);if(nt.data==="$!"){if(rt=nt.nextSibling&&nt.nextSibling.dataset,rt)var st=rt.dgst;return rt=st,ot=Error(p$4(419)),rt=Ki(ot,rt,void 0),sj(et,o,it,rt)}if(st=(it&et.childLanes)!==0,dh||st){if(rt=Q$1,rt!==null){switch(it&-it){case 4:nt=2;break;case 16:nt=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:nt=32;break;case 536870912:nt=268435456;break;default:nt=0}nt=nt&(rt.suspendedLanes|it)?0:nt,nt!==0&&nt!==ot.retryLane&&(ot.retryLane=nt,ih(et,nt),gi(rt,et,nt,-1))}return tj(),rt=Ki(Error(p$4(421))),sj(et,o,it,rt)}return nt.data==="$?"?(o.flags|=128,o.child=et.child,o=uj.bind(null,et),nt._reactRetry=o,null):(et=ot.treeContext,yg=Lf(nt.nextSibling),xg=o,I$1=!0,zg=null,et!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=et.id,sg=et.overflow,qg=o),o=qj(o,rt.children),o.flags|=4096,o)}function vj(et,o,tt){et.lanes|=o;var rt=et.alternate;rt!==null&&(rt.lanes|=o),bh(et.return,o,tt)}function wj(et,o,tt,rt,nt){var ot=et.memoizedState;ot===null?et.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:rt,tail:tt,tailMode:nt}:(ot.isBackwards=o,ot.rendering=null,ot.renderingStartTime=0,ot.last=rt,ot.tail=tt,ot.tailMode=nt)}function xj(et,o,tt){var rt=o.pendingProps,nt=rt.revealOrder,ot=rt.tail;if(Xi(et,o,rt.children,tt),rt=L$1.current,rt&2)rt=rt&1|2,o.flags|=128;else{if(et!==null&&et.flags&128)e:for(et=o.child;et!==null;){if(et.tag===13)et.memoizedState!==null&&vj(et,tt,o);else if(et.tag===19)vj(et,tt,o);else if(et.child!==null){et.child.return=et,et=et.child;continue}if(et===o)break e;for(;et.sibling===null;){if(et.return===null||et.return===o)break e;et=et.return}et.sibling.return=et.return,et=et.sibling}rt&=1}if(G$1(L$1,rt),!(o.mode&1))o.memoizedState=null;else switch(nt){case"forwards":for(tt=o.child,nt=null;tt!==null;)et=tt.alternate,et!==null&&Ch(et)===null&&(nt=tt),tt=tt.sibling;tt=nt,tt===null?(nt=o.child,o.child=null):(nt=tt.sibling,tt.sibling=null),wj(o,!1,nt,tt,ot);break;case"backwards":for(tt=null,nt=o.child,o.child=null;nt!==null;){if(et=nt.alternate,et!==null&&Ch(et)===null){o.child=nt;break}et=nt.sibling,nt.sibling=tt,tt=nt,nt=et}wj(o,!0,tt,null,ot);break;case"together":wj(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function ij(et,o){!(o.mode&1)&&et!==null&&(et.alternate=null,o.alternate=null,o.flags|=2)}function Zi(et,o,tt){if(et!==null&&(o.dependencies=et.dependencies),rh|=o.lanes,!(tt&o.childLanes))return null;if(et!==null&&o.child!==et.child)throw Error(p$4(153));if(o.child!==null){for(et=o.child,tt=Pg(et,et.pendingProps),o.child=tt,tt.return=o;et.sibling!==null;)et=et.sibling,tt=tt.sibling=Pg(et,et.pendingProps),tt.return=o;tt.sibling=null}return o.child}function yj(et,o,tt){switch(o.tag){case 3:kj(o),Ig();break;case 5:Ah(o);break;case 1:Zf(o.type)&&cg(o);break;case 4:yh(o,o.stateNode.containerInfo);break;case 10:var rt=o.type._context,nt=o.memoizedProps.value;G$1(Wg,rt._currentValue),rt._currentValue=nt;break;case 13:if(rt=o.memoizedState,rt!==null)return rt.dehydrated!==null?(G$1(L$1,L$1.current&1),o.flags|=128,null):tt&o.child.childLanes?oj(et,o,tt):(G$1(L$1,L$1.current&1),et=Zi(et,o,tt),et!==null?et.sibling:null);G$1(L$1,L$1.current&1);break;case 19:if(rt=(tt&o.childLanes)!==0,et.flags&128){if(rt)return xj(et,o,tt);o.flags|=128}if(nt=o.memoizedState,nt!==null&&(nt.rendering=null,nt.tail=null,nt.lastEffect=null),G$1(L$1,L$1.current),rt)break;return null;case 22:case 23:return o.lanes=0,dj(et,o,tt)}return Zi(et,o,tt)}var zj,Aj,Bj,Cj;zj=function(et,o){for(var tt=o.child;tt!==null;){if(tt.tag===5||tt.tag===6)et.appendChild(tt.stateNode);else if(tt.tag!==4&&tt.child!==null){tt.child.return=tt,tt=tt.child;continue}if(tt===o)break;for(;tt.sibling===null;){if(tt.return===null||tt.return===o)return;tt=tt.return}tt.sibling.return=tt.return,tt=tt.sibling}};Aj=function(){};Bj=function(et,o,tt,rt){var nt=et.memoizedProps;if(nt!==rt){et=o.stateNode,xh(uh.current);var ot=null;switch(tt){case"input":nt=Ya(et,nt),rt=Ya(et,rt),ot=[];break;case"select":nt=A$1({},nt,{value:void 0}),rt=A$1({},rt,{value:void 0}),ot=[];break;case"textarea":nt=gb(et,nt),rt=gb(et,rt),ot=[];break;default:typeof nt.onClick!="function"&&typeof rt.onClick=="function"&&(et.onclick=Bf)}ub(tt,rt);var it;tt=null;for(ct in nt)if(!rt.hasOwnProperty(ct)&&nt.hasOwnProperty(ct)&&nt[ct]!=null)if(ct==="style"){var st=nt[ct];for(it in st)st.hasOwnProperty(it)&&(tt||(tt={}),tt[it]="")}else ct!=="dangerouslySetInnerHTML"&&ct!=="children"&&ct!=="suppressContentEditableWarning"&&ct!=="suppressHydrationWarning"&&ct!=="autoFocus"&&(ea.hasOwnProperty(ct)?ot||(ot=[]):(ot=ot||[]).push(ct,null));for(ct in rt){var at=rt[ct];if(st=nt!=null?nt[ct]:void 0,rt.hasOwnProperty(ct)&&at!==st&&(at!=null||st!=null))if(ct==="style")if(st){for(it in st)!st.hasOwnProperty(it)||at&&at.hasOwnProperty(it)||(tt||(tt={}),tt[it]="");for(it in at)at.hasOwnProperty(it)&&st[it]!==at[it]&&(tt||(tt={}),tt[it]=at[it])}else tt||(ot||(ot=[]),ot.push(ct,tt)),tt=at;else ct==="dangerouslySetInnerHTML"?(at=at?at.__html:void 0,st=st?st.__html:void 0,at!=null&&st!==at&&(ot=ot||[]).push(ct,at)):ct==="children"?typeof at!="string"&&typeof at!="number"||(ot=ot||[]).push(ct,""+at):ct!=="suppressContentEditableWarning"&&ct!=="suppressHydrationWarning"&&(ea.hasOwnProperty(ct)?(at!=null&&ct==="onScroll"&&D$1("scroll",et),ot||st===at||(ot=[])):(ot=ot||[]).push(ct,at))}tt&&(ot=ot||[]).push("style",tt);var ct=ot;(o.updateQueue=ct)&&(o.flags|=4)}};Cj=function(et,o,tt,rt){tt!==rt&&(o.flags|=4)};function Dj(et,o){if(!I$1)switch(et.tailMode){case"hidden":o=et.tail;for(var tt=null;o!==null;)o.alternate!==null&&(tt=o),o=o.sibling;tt===null?et.tail=null:tt.sibling=null;break;case"collapsed":tt=et.tail;for(var rt=null;tt!==null;)tt.alternate!==null&&(rt=tt),tt=tt.sibling;rt===null?o||et.tail===null?et.tail=null:et.tail.sibling=null:rt.sibling=null}}function S$1(et){var o=et.alternate!==null&&et.alternate.child===et.child,tt=0,rt=0;if(o)for(var nt=et.child;nt!==null;)tt|=nt.lanes|nt.childLanes,rt|=nt.subtreeFlags&14680064,rt|=nt.flags&14680064,nt.return=et,nt=nt.sibling;else for(nt=et.child;nt!==null;)tt|=nt.lanes|nt.childLanes,rt|=nt.subtreeFlags,rt|=nt.flags,nt.return=et,nt=nt.sibling;return et.subtreeFlags|=rt,et.childLanes=tt,o}function Ej(et,o,tt){var rt=o.pendingProps;switch(wg(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S$1(o),null;case 1:return Zf(o.type)&&$f(),S$1(o),null;case 3:return rt=o.stateNode,zh(),E$1(Wf),E$1(H$1),Eh(),rt.pendingContext&&(rt.context=rt.pendingContext,rt.pendingContext=null),(et===null||et.child===null)&&(Gg(o)?o.flags|=4:et===null||et.memoizedState.isDehydrated&&!(o.flags&256)||(o.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(et,o),S$1(o),null;case 5:Bh(o);var nt=xh(wh.current);if(tt=o.type,et!==null&&o.stateNode!=null)Bj(et,o,tt,rt,nt),et.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!rt){if(o.stateNode===null)throw Error(p$4(166));return S$1(o),null}if(et=xh(uh.current),Gg(o)){rt=o.stateNode,tt=o.type;var ot=o.memoizedProps;switch(rt[Of]=o,rt[Pf]=ot,et=(o.mode&1)!==0,tt){case"dialog":D$1("cancel",rt),D$1("close",rt);break;case"iframe":case"object":case"embed":D$1("load",rt);break;case"video":case"audio":for(nt=0;nt<\/script>",et=et.removeChild(et.firstChild)):typeof rt.is=="string"?et=it.createElement(tt,{is:rt.is}):(et=it.createElement(tt),tt==="select"&&(it=et,rt.multiple?it.multiple=!0:rt.size&&(it.size=rt.size))):et=it.createElementNS(et,tt),et[Of]=o,et[Pf]=rt,zj(et,o,!1,!1),o.stateNode=et;e:{switch(it=vb(tt,rt),tt){case"dialog":D$1("cancel",et),D$1("close",et),nt=rt;break;case"iframe":case"object":case"embed":D$1("load",et),nt=rt;break;case"video":case"audio":for(nt=0;ntGj&&(o.flags|=128,rt=!0,Dj(ot,!1),o.lanes=4194304)}else{if(!rt)if(et=Ch(it),et!==null){if(o.flags|=128,rt=!0,tt=et.updateQueue,tt!==null&&(o.updateQueue=tt,o.flags|=4),Dj(ot,!0),ot.tail===null&&ot.tailMode==="hidden"&&!it.alternate&&!I$1)return S$1(o),null}else 2*B$1()-ot.renderingStartTime>Gj&&tt!==1073741824&&(o.flags|=128,rt=!0,Dj(ot,!1),o.lanes=4194304);ot.isBackwards?(it.sibling=o.child,o.child=it):(tt=ot.last,tt!==null?tt.sibling=it:o.child=it,ot.last=it)}return ot.tail!==null?(o=ot.tail,ot.rendering=o,ot.tail=o.sibling,ot.renderingStartTime=B$1(),o.sibling=null,tt=L$1.current,G$1(L$1,rt?tt&1|2:tt&1),o):(S$1(o),null);case 22:case 23:return Hj(),rt=o.memoizedState!==null,et!==null&&et.memoizedState!==null!==rt&&(o.flags|=8192),rt&&o.mode&1?fj&1073741824&&(S$1(o),o.subtreeFlags&6&&(o.flags|=8192)):S$1(o),null;case 24:return null;case 25:return null}throw Error(p$4(156,o.tag))}function Ij(et,o){switch(wg(o),o.tag){case 1:return Zf(o.type)&&$f(),et=o.flags,et&65536?(o.flags=et&-65537|128,o):null;case 3:return zh(),E$1(Wf),E$1(H$1),Eh(),et=o.flags,et&65536&&!(et&128)?(o.flags=et&-65537|128,o):null;case 5:return Bh(o),null;case 13:if(E$1(L$1),et=o.memoizedState,et!==null&&et.dehydrated!==null){if(o.alternate===null)throw Error(p$4(340));Ig()}return et=o.flags,et&65536?(o.flags=et&-65537|128,o):null;case 19:return E$1(L$1),null;case 4:return zh(),null;case 10:return ah(o.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U$1=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V$2=null;function Lj(et,o){var tt=et.ref;if(tt!==null)if(typeof tt=="function")try{tt(null)}catch(rt){W$1(et,o,rt)}else tt.current=null}function Mj(et,o,tt){try{tt()}catch(rt){W$1(et,o,rt)}}var Nj=!1;function Oj(et,o){if(Cf=dd,et=Me$1(),Ne$1(et)){if("selectionStart"in et)var tt={start:et.selectionStart,end:et.selectionEnd};else e:{tt=(tt=et.ownerDocument)&&tt.defaultView||window;var rt=tt.getSelection&&tt.getSelection();if(rt&&rt.rangeCount!==0){tt=rt.anchorNode;var nt=rt.anchorOffset,ot=rt.focusNode;rt=rt.focusOffset;try{tt.nodeType,ot.nodeType}catch{tt=null;break e}var it=0,st=-1,at=-1,ct=0,lt=0,dt=et,ht=null;t:for(;;){for(var mt;dt!==tt||nt!==0&&dt.nodeType!==3||(st=it+nt),dt!==ot||rt!==0&&dt.nodeType!==3||(at=it+rt),dt.nodeType===3&&(it+=dt.nodeValue.length),(mt=dt.firstChild)!==null;)ht=dt,dt=mt;for(;;){if(dt===et)break t;if(ht===tt&&++ct===nt&&(st=it),ht===ot&&++lt===rt&&(at=it),(mt=dt.nextSibling)!==null)break;dt=ht,ht=dt.parentNode}dt=mt}tt=st===-1||at===-1?null:{start:st,end:at}}else tt=null}tt=tt||{start:0,end:0}}else tt=null;for(Df={focusedElem:et,selectionRange:tt},dd=!1,V$2=o;V$2!==null;)if(o=V$2,et=o.child,(o.subtreeFlags&1028)!==0&&et!==null)et.return=o,V$2=et;else for(;V$2!==null;){o=V$2;try{var ft=o.alternate;if(o.flags&1024)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ft!==null){var pt=ft.memoizedProps,yt=ft.memoizedState,gt=o.stateNode,bt=gt.getSnapshotBeforeUpdate(o.elementType===o.type?pt:Ci(o.type,pt),yt);gt.__reactInternalSnapshotBeforeUpdate=bt}break;case 3:var xt=o.stateNode.containerInfo;xt.nodeType===1?xt.textContent="":xt.nodeType===9&&xt.documentElement&&xt.removeChild(xt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$4(163))}}catch(vt){W$1(o,o.return,vt)}if(et=o.sibling,et!==null){et.return=o.return,V$2=et;break}V$2=o.return}return ft=Nj,Nj=!1,ft}function Pj(et,o,tt){var rt=o.updateQueue;if(rt=rt!==null?rt.lastEffect:null,rt!==null){var nt=rt=rt.next;do{if((nt.tag&et)===et){var ot=nt.destroy;nt.destroy=void 0,ot!==void 0&&Mj(o,tt,ot)}nt=nt.next}while(nt!==rt)}}function Qj(et,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var tt=o=o.next;do{if((tt.tag&et)===et){var rt=tt.create;tt.destroy=rt()}tt=tt.next}while(tt!==o)}}function Rj(et){var o=et.ref;if(o!==null){var tt=et.stateNode;switch(et.tag){case 5:et=tt;break;default:et=tt}typeof o=="function"?o(et):o.current=et}}function Sj(et){var o=et.alternate;o!==null&&(et.alternate=null,Sj(o)),et.child=null,et.deletions=null,et.sibling=null,et.tag===5&&(o=et.stateNode,o!==null&&(delete o[Of],delete o[Pf],delete o[of],delete o[Qf],delete o[Rf])),et.stateNode=null,et.return=null,et.dependencies=null,et.memoizedProps=null,et.memoizedState=null,et.pendingProps=null,et.stateNode=null,et.updateQueue=null}function Tj(et){return et.tag===5||et.tag===3||et.tag===4}function Uj(et){e:for(;;){for(;et.sibling===null;){if(et.return===null||Tj(et.return))return null;et=et.return}for(et.sibling.return=et.return,et=et.sibling;et.tag!==5&&et.tag!==6&&et.tag!==18;){if(et.flags&2||et.child===null||et.tag===4)continue e;et.child.return=et,et=et.child}if(!(et.flags&2))return et.stateNode}}function Vj(et,o,tt){var rt=et.tag;if(rt===5||rt===6)et=et.stateNode,o?tt.nodeType===8?tt.parentNode.insertBefore(et,o):tt.insertBefore(et,o):(tt.nodeType===8?(o=tt.parentNode,o.insertBefore(et,tt)):(o=tt,o.appendChild(et)),tt=tt._reactRootContainer,tt!=null||o.onclick!==null||(o.onclick=Bf));else if(rt!==4&&(et=et.child,et!==null))for(Vj(et,o,tt),et=et.sibling;et!==null;)Vj(et,o,tt),et=et.sibling}function Wj(et,o,tt){var rt=et.tag;if(rt===5||rt===6)et=et.stateNode,o?tt.insertBefore(et,o):tt.appendChild(et);else if(rt!==4&&(et=et.child,et!==null))for(Wj(et,o,tt),et=et.sibling;et!==null;)Wj(et,o,tt),et=et.sibling}var X$1=null,Xj=!1;function Yj(et,o,tt){for(tt=tt.child;tt!==null;)Zj(et,o,tt),tt=tt.sibling}function Zj(et,o,tt){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,tt)}catch{}switch(tt.tag){case 5:U$1||Lj(tt,o);case 6:var rt=X$1,nt=Xj;X$1=null,Yj(et,o,tt),X$1=rt,Xj=nt,X$1!==null&&(Xj?(et=X$1,tt=tt.stateNode,et.nodeType===8?et.parentNode.removeChild(tt):et.removeChild(tt)):X$1.removeChild(tt.stateNode));break;case 18:X$1!==null&&(Xj?(et=X$1,tt=tt.stateNode,et.nodeType===8?Kf(et.parentNode,tt):et.nodeType===1&&Kf(et,tt),bd(et)):Kf(X$1,tt.stateNode));break;case 4:rt=X$1,nt=Xj,X$1=tt.stateNode.containerInfo,Xj=!0,Yj(et,o,tt),X$1=rt,Xj=nt;break;case 0:case 11:case 14:case 15:if(!U$1&&(rt=tt.updateQueue,rt!==null&&(rt=rt.lastEffect,rt!==null))){nt=rt=rt.next;do{var ot=nt,it=ot.destroy;ot=ot.tag,it!==void 0&&(ot&2||ot&4)&&Mj(tt,o,it),nt=nt.next}while(nt!==rt)}Yj(et,o,tt);break;case 1:if(!U$1&&(Lj(tt,o),rt=tt.stateNode,typeof rt.componentWillUnmount=="function"))try{rt.props=tt.memoizedProps,rt.state=tt.memoizedState,rt.componentWillUnmount()}catch(st){W$1(tt,o,st)}Yj(et,o,tt);break;case 21:Yj(et,o,tt);break;case 22:tt.mode&1?(U$1=(rt=U$1)||tt.memoizedState!==null,Yj(et,o,tt),U$1=rt):Yj(et,o,tt);break;default:Yj(et,o,tt)}}function ak(et){var o=et.updateQueue;if(o!==null){et.updateQueue=null;var tt=et.stateNode;tt===null&&(tt=et.stateNode=new Kj),o.forEach(function(rt){var nt=bk.bind(null,et,rt);tt.has(rt)||(tt.add(rt),rt.then(nt,nt))})}}function ck(et,o){var tt=o.deletions;if(tt!==null)for(var rt=0;rtnt&&(nt=it),rt&=~ot}if(rt=nt,rt=B$1()-rt,rt=(120>rt?120:480>rt?480:1080>rt?1080:1920>rt?1920:3e3>rt?3e3:4320>rt?4320:1960*lk(rt/1960))-rt,10et?16:et,wk===null)var rt=!1;else{if(et=wk,wk=null,xk=0,K$1&6)throw Error(p$4(331));var nt=K$1;for(K$1|=4,V$2=et.current;V$2!==null;){var ot=V$2,it=ot.child;if(V$2.flags&16){var st=ot.deletions;if(st!==null){for(var at=0;atB$1()-fk?Kk(et,0):rk|=tt),Dk(et,o)}function Yk(et,o){o===0&&(et.mode&1?(o=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):o=1);var tt=R();et=ih(et,o),et!==null&&(Ac(et,o,tt),Dk(et,tt))}function uj(et){var o=et.memoizedState,tt=0;o!==null&&(tt=o.retryLane),Yk(et,tt)}function bk(et,o){var tt=0;switch(et.tag){case 13:var rt=et.stateNode,nt=et.memoizedState;nt!==null&&(tt=nt.retryLane);break;case 19:rt=et.stateNode;break;default:throw Error(p$4(314))}rt!==null&&rt.delete(o),Yk(et,tt)}var Vk;Vk=function(et,o,tt){if(et!==null)if(et.memoizedProps!==o.pendingProps||Wf.current)dh=!0;else{if(!(et.lanes&tt)&&!(o.flags&128))return dh=!1,yj(et,o,tt);dh=!!(et.flags&131072)}else dh=!1,I$1&&o.flags&1048576&&ug(o,ng,o.index);switch(o.lanes=0,o.tag){case 2:var rt=o.type;ij(et,o),et=o.pendingProps;var nt=Yf(o,H$1.current);ch(o,tt),nt=Nh(null,o,rt,et,nt,tt);var ot=Sh();return o.flags|=1,typeof nt=="object"&&nt!==null&&typeof nt.render=="function"&&nt.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Zf(rt)?(ot=!0,cg(o)):ot=!1,o.memoizedState=nt.state!==null&&nt.state!==void 0?nt.state:null,kh(o),nt.updater=Ei,o.stateNode=nt,nt._reactInternals=o,Ii(o,rt,et,tt),o=jj(null,o,rt,!0,ot,tt)):(o.tag=0,I$1&&ot&&vg(o),Xi(null,o,nt,tt),o=o.child),o;case 16:rt=o.elementType;e:{switch(ij(et,o),et=o.pendingProps,nt=rt._init,rt=nt(rt._payload),o.type=rt,nt=o.tag=Zk(rt),et=Ci(rt,et),nt){case 0:o=cj(null,o,rt,et,tt);break e;case 1:o=hj(null,o,rt,et,tt);break e;case 11:o=Yi(null,o,rt,et,tt);break e;case 14:o=$i(null,o,rt,Ci(rt.type,et),tt);break e}throw Error(p$4(306,rt,""))}return o;case 0:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),cj(et,o,rt,nt,tt);case 1:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),hj(et,o,rt,nt,tt);case 3:e:{if(kj(o),et===null)throw Error(p$4(387));rt=o.pendingProps,ot=o.memoizedState,nt=ot.element,lh(et,o),qh(o,rt,null,tt);var it=o.memoizedState;if(rt=it.element,ot.isDehydrated)if(ot={element:rt,isDehydrated:!1,cache:it.cache,pendingSuspenseBoundaries:it.pendingSuspenseBoundaries,transitions:it.transitions},o.updateQueue.baseState=ot,o.memoizedState=ot,o.flags&256){nt=Ji(Error(p$4(423)),o),o=lj(et,o,rt,tt,nt);break e}else if(rt!==nt){nt=Ji(Error(p$4(424)),o),o=lj(et,o,rt,tt,nt);break e}else for(yg=Lf(o.stateNode.containerInfo.firstChild),xg=o,I$1=!0,zg=null,tt=Vg(o,null,rt,tt),o.child=tt;tt;)tt.flags=tt.flags&-3|4096,tt=tt.sibling;else{if(Ig(),rt===nt){o=Zi(et,o,tt);break e}Xi(et,o,rt,tt)}o=o.child}return o;case 5:return Ah(o),et===null&&Eg(o),rt=o.type,nt=o.pendingProps,ot=et!==null?et.memoizedProps:null,it=nt.children,Ef(rt,nt)?it=null:ot!==null&&Ef(rt,ot)&&(o.flags|=32),gj(et,o),Xi(et,o,it,tt),o.child;case 6:return et===null&&Eg(o),null;case 13:return oj(et,o,tt);case 4:return yh(o,o.stateNode.containerInfo),rt=o.pendingProps,et===null?o.child=Ug(o,null,rt,tt):Xi(et,o,rt,tt),o.child;case 11:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),Yi(et,o,rt,nt,tt);case 7:return Xi(et,o,o.pendingProps,tt),o.child;case 8:return Xi(et,o,o.pendingProps.children,tt),o.child;case 12:return Xi(et,o,o.pendingProps.children,tt),o.child;case 10:e:{if(rt=o.type._context,nt=o.pendingProps,ot=o.memoizedProps,it=nt.value,G$1(Wg,rt._currentValue),rt._currentValue=it,ot!==null)if(He(ot.value,it)){if(ot.children===nt.children&&!Wf.current){o=Zi(et,o,tt);break e}}else for(ot=o.child,ot!==null&&(ot.return=o);ot!==null;){var st=ot.dependencies;if(st!==null){it=ot.child;for(var at=st.firstContext;at!==null;){if(at.context===rt){if(ot.tag===1){at=mh(-1,tt&-tt),at.tag=2;var ct=ot.updateQueue;if(ct!==null){ct=ct.shared;var lt=ct.pending;lt===null?at.next=at:(at.next=lt.next,lt.next=at),ct.pending=at}}ot.lanes|=tt,at=ot.alternate,at!==null&&(at.lanes|=tt),bh(ot.return,tt,o),st.lanes|=tt;break}at=at.next}}else if(ot.tag===10)it=ot.type===o.type?null:ot.child;else if(ot.tag===18){if(it=ot.return,it===null)throw Error(p$4(341));it.lanes|=tt,st=it.alternate,st!==null&&(st.lanes|=tt),bh(it,tt,o),it=ot.sibling}else it=ot.child;if(it!==null)it.return=ot;else for(it=ot;it!==null;){if(it===o){it=null;break}if(ot=it.sibling,ot!==null){ot.return=it.return,it=ot;break}it=it.return}ot=it}Xi(et,o,nt.children,tt),o=o.child}return o;case 9:return nt=o.type,rt=o.pendingProps.children,ch(o,tt),nt=eh(nt),rt=rt(nt),o.flags|=1,Xi(et,o,rt,tt),o.child;case 14:return rt=o.type,nt=Ci(rt,o.pendingProps),nt=Ci(rt.type,nt),$i(et,o,rt,nt,tt);case 15:return bj(et,o,o.type,o.pendingProps,tt);case 17:return rt=o.type,nt=o.pendingProps,nt=o.elementType===rt?nt:Ci(rt,nt),ij(et,o),o.tag=1,Zf(rt)?(et=!0,cg(o)):et=!1,ch(o,tt),Gi(o,rt,nt),Ii(o,rt,nt,tt),jj(null,o,rt,!0,et,tt);case 19:return xj(et,o,tt);case 22:return dj(et,o,tt)}throw Error(p$4(156,o.tag))};function Fk(et,o){return ac(et,o)}function $k(et,o,tt,rt){this.tag=et,this.key=tt,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=rt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(et,o,tt,rt){return new $k(et,o,tt,rt)}function aj(et){return et=et.prototype,!(!et||!et.isReactComponent)}function Zk(et){if(typeof et=="function")return aj(et)?1:0;if(et!=null){if(et=et.$$typeof,et===Da)return 11;if(et===Ga)return 14}return 2}function Pg(et,o){var tt=et.alternate;return tt===null?(tt=Bg(et.tag,o,et.key,et.mode),tt.elementType=et.elementType,tt.type=et.type,tt.stateNode=et.stateNode,tt.alternate=et,et.alternate=tt):(tt.pendingProps=o,tt.type=et.type,tt.flags=0,tt.subtreeFlags=0,tt.deletions=null),tt.flags=et.flags&14680064,tt.childLanes=et.childLanes,tt.lanes=et.lanes,tt.child=et.child,tt.memoizedProps=et.memoizedProps,tt.memoizedState=et.memoizedState,tt.updateQueue=et.updateQueue,o=et.dependencies,tt.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},tt.sibling=et.sibling,tt.index=et.index,tt.ref=et.ref,tt}function Rg(et,o,tt,rt,nt,ot){var it=2;if(rt=et,typeof et=="function")aj(et)&&(it=1);else if(typeof et=="string")it=5;else e:switch(et){case ya:return Tg(tt.children,nt,ot,o);case za:it=8,nt|=8;break;case Aa:return et=Bg(12,tt,o,nt|2),et.elementType=Aa,et.lanes=ot,et;case Ea:return et=Bg(13,tt,o,nt),et.elementType=Ea,et.lanes=ot,et;case Fa:return et=Bg(19,tt,o,nt),et.elementType=Fa,et.lanes=ot,et;case Ia:return pj(tt,nt,ot,o);default:if(typeof et=="object"&&et!==null)switch(et.$$typeof){case Ba:it=10;break e;case Ca:it=9;break e;case Da:it=11;break e;case Ga:it=14;break e;case Ha:it=16,rt=null;break e}throw Error(p$4(130,et==null?et:typeof et,""))}return o=Bg(it,tt,o,nt),o.elementType=et,o.type=rt,o.lanes=ot,o}function Tg(et,o,tt,rt){return et=Bg(7,et,rt,o),et.lanes=tt,et}function pj(et,o,tt,rt){return et=Bg(22,et,rt,o),et.elementType=Ia,et.lanes=tt,et.stateNode={isHidden:!1},et}function Qg(et,o,tt){return et=Bg(6,et,null,o),et.lanes=tt,et}function Sg(et,o,tt){return o=Bg(4,et.children!==null?et.children:[],et.key,o),o.lanes=tt,o.stateNode={containerInfo:et.containerInfo,pendingChildren:null,implementation:et.implementation},o}function al(et,o,tt,rt,nt){this.tag=o,this.containerInfo=et,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=rt,this.onRecoverableError=nt,this.mutableSourceEagerHydrationData=null}function bl(et,o,tt,rt,nt,ot,it,st,at){return et=new al(et,o,tt,st,at),o===1?(o=1,ot===!0&&(o|=8)):o=0,ot=Bg(3,null,null,o),et.current=ot,ot.stateNode=et,ot.memoizedState={element:rt,isDehydrated:tt,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(ot),et}function cl(et,o,tt){var rt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(et){console.error(et)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports,createRoot,m$5=reactDomExports;createRoot=m$5.createRoot,m$5.hydrateRoot;const version$8="2.21.28";let errorConfig={getDocsUrl:({docsBaseUrl:et,docsPath:o="",docsSlug:tt})=>o?`${et??"https://viem.sh"}${o}${tt?`#${tt}`:""}`:void 0,version:version$8},BaseError$3=class ks extends Error{constructor(o,tt={}){var st;const rt=(()=>{var at;return tt.cause instanceof ks?tt.cause.details:(at=tt.cause)!=null&&at.message?tt.cause.message:tt.details})(),nt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=(st=errorConfig.getDocsUrl)==null?void 0:st.call(errorConfig,{...tt,docsPath:nt}),it=[o||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...ot?[`Docs: ${ot}`]:[],...rt?[`Details: ${rt}`]:[],`Version: ${errorConfig.version}`].join(` `);super(it,tt.cause?{cause:tt.cause}:void 0),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,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=rt,this.docsPath=nt,this.metaMessages=tt.metaMessages,this.name=tt.name??this.name,this.shortMessage=o,this.version=version$8}walk(o){return walk(this,o)}};function walk(et,o){return o!=null&&o(et)?et:et&&typeof et=="object"&&"cause"in et?walk(et.cause,o):o?null:et}class IntegerOutOfRangeError extends BaseError$3{constructor({max:o,min:tt,signed:rt,size:nt,value:ot}){super(`Number "${ot}" is not in safe ${nt?`${nt*8}-bit ${rt?"signed":"unsigned"} `:""}integer range ${o?`(${tt} to ${o})`:`(above ${tt})`}`,{name:"IntegerOutOfRangeError"})}}class InvalidBytesBooleanError extends BaseError$3{constructor(o){super(`Bytes value "${o}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class SizeOverflowError extends BaseError$3{constructor({givenSize:o,maxSize:tt}){super(`Size cannot exceed ${tt} bytes. Given size: ${o} bytes.`,{name:"SizeOverflowError"})}}class SliceOffsetOutOfBoundsError extends BaseError$3{constructor({offset:o,position:tt,size:rt}){super(`Slice ${tt==="start"?"starting":"ending"} at offset "${o}" is out-of-bounds (size: ${rt}).`,{name:"SliceOffsetOutOfBoundsError"})}}class SizeExceedsPaddingSizeError extends BaseError$3{constructor({size:o,targetSize:tt,type:rt}){super(`${rt.charAt(0).toUpperCase()}${rt.slice(1).toLowerCase()} size (${o}) exceeds padding size (${tt}).`,{name:"SizeExceedsPaddingSizeError"})}}class InvalidBytesLengthError extends BaseError$3{constructor({size:o,targetSize:tt,type:rt}){super(`${rt.charAt(0).toUpperCase()}${rt.slice(1).toLowerCase()} is expected to be ${tt} ${rt} long, but is ${o} ${rt} long.`,{name:"InvalidBytesLengthError"})}}function pad(et,{dir:o,size:tt=32}={}){return typeof et=="string"?padHex(et,{dir:o,size:tt}):padBytes(et,{dir:o,size:tt})}function padHex(et,{dir:o,size:tt=32}={}){if(tt===null)return et;const rt=et.replace("0x","");if(rt.length>tt*2)throw new SizeExceedsPaddingSizeError({size:Math.ceil(rt.length/2),targetSize:tt,type:"hex"});return`0x${rt[o==="right"?"padEnd":"padStart"](tt*2,"0")}`}function padBytes(et,{dir:o,size:tt=32}={}){if(tt===null)return et;if(et.length>tt)throw new SizeExceedsPaddingSizeError({size:et.length,targetSize:tt,type:"bytes"});const rt=new Uint8Array(tt);for(let nt=0;nt=charCodeMap.zero&&et<=charCodeMap.nine)return et-charCodeMap.zero;if(et>=charCodeMap.A&&et<=charCodeMap.F)return et-(charCodeMap.A-10);if(et>=charCodeMap.a&&et<=charCodeMap.f)return et-(charCodeMap.a-10)}function hexToBytes$3(et,o={}){let tt=et;o.size&&(assertSize(tt,{size:o.size}),tt=pad(tt,{dir:"right",size:o.size}));let rt=tt.slice(2);rt.length%2&&(rt=`0${rt}`);const nt=rt.length/2,ot=new Uint8Array(nt);for(let it=0,st=0;ito)throw new SizeOverflowError({givenSize:size$2(et),maxSize:o})}function hexToBigInt(et,o={}){const{signed:tt}=o;o.size&&assertSize(et,{size:o.size});const rt=BigInt(et);if(!tt)return rt;const nt=(et.length-2)/2,ot=(1n<o.toString(16).padStart(2,"0"));function toHex(et,o={}){return typeof et=="number"||typeof et=="bigint"?numberToHex(et,o):typeof et=="string"?stringToHex(et,o):typeof et=="boolean"?boolToHex(et,o):bytesToHex$3(et,o)}function boolToHex(et,o={}){const tt=`0x${Number(et)}`;return typeof o.size=="number"?(assertSize(tt,{size:o.size}),pad(tt,{size:o.size})):tt}function bytesToHex$3(et,o={}){let tt="";for(let nt=0;ntot||ntformatAbiParam(tt,{includeName:o})).join(o?", ":","):""}function formatAbiParam(et,{includeName:o}){return et.type.startsWith("tuple")?`(${formatAbiParams(et.components,{includeName:o})})${et.type.slice(5)}`:et.type+(o&&et.name?` ${et.name}`:"")}class AbiConstructorNotFoundError extends BaseError$3{constructor({docsPath:o}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` `),{docsPath:o,name:"AbiConstructorNotFoundError"})}}class AbiConstructorParamsNotFoundError extends BaseError$3{constructor({docsPath:o}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` `),{docsPath:o,name:"AbiConstructorParamsNotFoundError"})}}class AbiDecodingDataSizeTooSmallError extends BaseError$3{constructor({data:o,params:tt,size:rt}){super([`Data size of ${rt} bytes is too small for given parameters.`].join(` @@ -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-BuPDuCWt.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-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(` `),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-nTxWlJlB.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-Cp1uoOsT.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-C7D_Vv5-.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-Cmis2wXV.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-Cm56O0-c.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-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={};/** * @license React * react-is.production.min.js * @@ -244,7 +244,7 @@ Minimum version required to store current data is: `+ot+`. button:focus-visible { outline: 2px solid var(--ck-focus-color); } -`,Portal$2=et=>{et={selector:"__CONNECTKIT__",...et};const{selector:o,children:tt}=et,rt=reactExports.useRef(null),[nt,ot]=reactExports.useState(!1);return reactExports.useEffect(()=>{const it="#"+o.replace(/^#/,"");if(rt.current=document.querySelector(it),!rt.current){const st=document.createElement("div");st.setAttribute("id",o),st.setAttribute("data-connectkit",`${CONNECTKIT_VERSION}`),document.body.appendChild(st),rt.current=st}ot(!0)},[o]),rt.current&&nt?reactDomExports.createPortal(tt,rt.current):null};var defaultTheme={mobileWidth:560};const ErrorMessage=styled(motion.div)` +`,Portal=et=>{et={selector:"__CONNECTKIT__",...et};const{selector:o,children:tt}=et,rt=reactExports.useRef(null),[nt,ot]=reactExports.useState(!1);return reactExports.useEffect(()=>{const it="#"+o.replace(/^#/,"");if(rt.current=document.querySelector(it),!rt.current){const st=document.createElement("div");st.setAttribute("id",o),st.setAttribute("data-connectkit",`${CONNECTKIT_VERSION}`),document.body.appendChild(st),rt.current=st}ot(!0)},[o]),rt.current&&nt?reactDomExports.createPortal(tt,rt.current):null};var defaultTheme={mobileWidth:560};const ErrorMessage=styled(motion.div)` z-index: -1; pointer-events: auto; position: absolute; @@ -933,7 +933,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C là chủ sở hữu của ví.`,signInWithEthereumScreen_signedOut_p:`Vui lòng ký tin nhắn yêu cầu trên ví của bạn để tiếp tục.`,signInWithEthereumScreen_signedOut_button:"Đăng nhập",signInWithEthereumScreen_signedIn_heading:"Đăng nhập qua Ethereum",signInWithEthereumScreen_signedIn_h1:"Bạn đã xác nhận thành công.",signInWithEthereumScreen_signedIn_p:`Sau khi Đăng xuất bạn sẽ cần xác nhận lại trong làn tiếp theo.`,signInWithEthereumScreen_signedIn_button:"Đăng xuất"},getLocale=et=>{switch(et){case"ee-EE":return eeEE;case"ar-AE":return arAE;case"es-ES":return esES;case"fa-IR":return faIR;case"fr-FR":return frFR;case"ja-JP":return jaJP;case"pt-BR":return ptBR;case"ru-RU":return ruRU;case"zh-CN":return zhCN;case"ca-AD":return caAD;case"tr-TR":return trTR;case"vi-VN":return viVN;default:return enUS}};function useLocales(et){var o,tt;const nt=(tt=(o=useContext().options)===null||o===void 0?void 0:o.language)!==null&&tt!==void 0?tt:"en-US",ot=reactExports.useMemo(()=>getLocale(nt),[nt]);if(!ot)return console.error(`Missing translations for: ${nt}`),`Missing translations for: ${nt}`;const it={};return Object.keys(ot).map(st=>{const at=ot[st];return it[st]=localize(at,et)}),it}const localize=(et,o)=>{let tt=et;return o&&Object.keys(o).forEach(rt=>{tt=tt.replace(new RegExp(`({{ ${rt} }})`,"g"),o[rt])}),replaceMarkdown(tt)},replaceMarkdown=et=>{let o=et;return o=o.split(` -`),o=o.map((tt,rt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),rtet.split(/(\*\*[^\*]*\*\*)/g).map((rt,nt)=>/(\*\*.*\*\*)/g.test(rt)?jsxRuntimeExports.jsx("strong",{children:rt.replace(/\*\*/g,"")},nt):`${rt}`).map(rt=>typeof rt=="string"?rt.split(/(\[WALLETCONNECTLOGO\])/g).map(nt=>nt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},nt):nt):rt),LOG_LEVEL={debug:10,info:20,warn:30,error:40,none:100},useIsoLayoutEffect=typeof window<"u"&&window.document&&window.document.createElement!==void 0?reactExports.useLayoutEffect:reactExports.useEffect,useFitText=({logLevel:et="info",maxFontSize:o=100,minFontSize:tt=20,onFinish:rt,onStart:nt,resolution:ot=5}={})=>{const it=LOG_LEVEL[et],st=reactExports.useCallback(()=>({calcKey:0,fontSize:o,fontSizePrev:tt,fontSizeMax:o,fontSizeMin:tt}),[o,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:mt,fontSize:ft,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt}=dt;let bt=null;const[xt]=reactExports.useState(()=>new index$1(()=>{bt=window.requestAnimationFrame(()=>{lt.current||(nt&&nt(),lt.current=!0,ht({...st(),calcKey:mt+1}))})}));reactExports.useEffect(()=>(at.current&&xt.observe(at.current),()=>{bt&&window.cancelAnimationFrame(bt),xt.disconnect()}),[bt,xt]);const vt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{mt===0||lt.current||(vt!==ct.current&&(nt&&nt(),ht({...st(),calcKey:mt+1})),ct.current=vt)},[mt,st,vt,nt]),useIsoLayoutEffect(()=>{if(mt===0)return;const Et=Math.abs(ft-gt)<=ot,Ct=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),St=Ct&&ft===gt,At=ft>gt;if(Et){St?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):Ct?ht({fontSize:At?gt:yt,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt,calcKey:mt}):(lt.current=!1,rt&&rt(ft));return}let kt,It=pt,Nt=yt;Ct?(kt=At?gt-ft:yt-ft,It=Math.min(pt,ft)):(kt=At?pt-ft:gt-ft,Nt=Math.max(yt,ft)),ht({calcKey:mt,fontSize:ft+kt/2,fontSizeMax:It,fontSizeMin:Nt,fontSizePrev:ft})},[mt,ft,pt,yt,gt,rt,at,ot]),{fontSize:ft,ref:at}},FitText=({children:et})=>{const[o,tt]=React.useState(!1),{fontSize:rt,ref:nt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:nt,style:{visibility:o?"visible":"hidden",fontSize:`${rt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:et})};FitText.displayName="FitText";function useConnectors(){const et=useConnectors$1();return et??[]}function useConnector(et,o){const tt=useConnectors();return et==="injected"&&o?tt.find(rt=>rt.id===et&&rt.name===o):et==="injected"?tt.find(rt=>rt.id===et&&rt.name.includes("Injected")):tt.find(rt=>rt.id===et)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=et=>{const tt=useWallets().find(rt=>rt.id===et);return tt||null},useWallets=()=>{const et=useConnectors(),o=useContext();return et.map(rt=>{var nt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(rt.id)!==-1),st={id:rt.id,name:(ot=(nt=rt.name)!==null&&nt!==void 0?nt:rt.id)!==null&&ot!==void 0?ot:rt.type,icon:jsxRuntimeExports.jsx("img",{src:rt.icon,alt:rt.name,width:"100%",height:"100%"}),connector:rt,iconShape:"squircle",isInstalled:rt.type==="mock"||rt.type==="injected"&&rt.id!=="metaMask"||isCoinbaseWalletConnector(rt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:rt.icon?jsxRuntimeExports.jsx("img",{src:rt.icon,alt:rt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((rt,nt,ot)=>ot.findIndex(it=>it.id===rt.id)===nt).map(rt=>{var nt,ot;return rt.id==="walletConnect"?{...rt,name:((nt=o.options)===null||nt===void 0?void 0:nt.walletConnectName)||rt.name,shortName:((ot=o.options)===null||ot===void 0?void 0:ot.walletConnectName)||rt.shortName}:rt}).filter((rt,nt,ot)=>!(rt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((rt,nt,ot)=>!((rt.id==="metaMaskSDK"||rt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((rt,nt)=>{const ot=rt.isInstalled&&isInjectedConnector(rt.connector.type),it=nt.isInstalled&&isInjectedConnector(nt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((rt,nt)=>rt.id==="walletConnect"?1:nt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:et})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[et?jsxRuntimeExports.jsx(AuthIcon,{style:{bottom:-1,right:-1}}):jsxRuntimeExports.jsx("div",{style:{zIndex:2,position:"absolute",top:-2,right:-2,background:"#1A88F8",borderRadius:8,boxShadow:"0 0 0 2px var(--ck-body-background)",width:8,height:8}}),jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M16.5 16.775C14.8618 15.0649 12.5552 14 10 14C7.44477 14 5.13825 15.0649 3.5 16.775",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("circle",{cx:"10",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"2"})]})]}),InfoIcon=({...et})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 11C20 15.9706 15.9706 20 11 20C6.02944 20 2 15.9706 2 11C2 6.02944 6.02944 2 11 2C15.9706 2 20 6.02944 20 11ZM22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11ZM11.6445 12.7051C11.6445 13.1348 11.3223 13.4678 10.7744 13.4678C10.2266 13.4678 9.92578 13.1885 9.92578 12.6191V12.4795C9.92578 11.4268 10.4951 10.8574 11.2686 10.3203C12.2031 9.67578 12.665 9.32129 12.665 8.59082C12.665 7.76367 12.0205 7.21582 11.043 7.21582C10.3232 7.21582 9.80762 7.57031 9.45312 8.16113C9.38282 8.24242 9.32286 8.32101 9.2667 8.39461C9.04826 8.68087 8.88747 8.8916 8.40039 8.8916C8.0459 8.8916 7.66992 8.62305 7.66992 8.15039C7.66992 7.96777 7.70215 7.7959 7.75586 7.61328C8.05664 6.625 9.27051 5.75488 11.1182 5.75488C12.9336 5.75488 14.5234 6.71094 14.5234 8.50488C14.5234 9.7832 13.7822 10.417 12.7402 11.1045C11.999 11.5986 11.6445 11.9746 11.6445 12.5762V12.7051ZM11.9131 15.5625C11.9131 16.1855 11.376 16.6797 10.7529 16.6797C10.1299 16.6797 9.59277 16.1748 9.59277 15.5625C9.59277 14.9395 10.1191 14.4453 10.7529 14.4453C11.3867 14.4453 11.9131 14.9287 11.9131 15.5625Z",fill:"currentColor"})}),CloseIcon=({...et})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...et})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{d:"M8 1L1 8L8 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),contentTransitionDuration=.22,contentVariants$2={initial:{zIndex:2,opacity:0},animate:{opacity:1,scale:1,transition:{duration:contentTransitionDuration*.75,delay:contentTransitionDuration*.25,ease:[.26,.08,.25,1]}},exit:{zIndex:1,opacity:0,pointerEvents:"none",position:"absolute",left:["50%","50%"],x:["-50%","-50%"],transition:{duration:contentTransitionDuration,ease:[.26,.08,.25,1]}}},Modal=({open:et,pages:o,pageId:tt,positionInside:rt,inline:nt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,mt,ft,pt,yt,gt,bt,xt,vt;const Et=useContext(),Ct=useThemeContext(),St=isMobile(),{isSignedIn:At,reset:kt}=useSIWE(),It=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),Nt={name:It==null?void 0:It.name,shortName:(lt=It==null?void 0:It.shortName)!==null&<!==void 0?lt:It==null?void 0:It.name,icon:(dt=It==null?void 0:It.iconConnector)!==null&&dt!==void 0?dt:It==null?void 0:It.icon,iconShape:(ht=It==null?void 0:It.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:It==null?void 0:It.iconShouldShrink},Lt=useLocales({CONNECTORNAME:Nt==null?void 0:Nt.name}),[Mt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ut=!(Mt==="exited"||Mt==="unmounted"),Xt=Mt==="preEnter"||Mt!=="exiting",Wt=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ft=usePrevious(Wt,Wt);rt||useLockBodyScroll(Ut),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(et),et&&Qt(void 0)},[et]);const[qt,Pt]=reactExports.useState({width:void 0,height:void 0}),[Yt,Qt]=reactExports.useState(void 0),jt=Vt=>{const er={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Pt({width:`${er==null?void 0:er.width}px`,height:`${er==null?void 0:er.height}px`})};let Gt;const rr=reactExports.useCallback(Vt=>{Vt&&(Zt.current=Vt,Qt(Yt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),jt(Vt))},[et,Yt]),{chain:Ht}=useAccount(),{switchChain:dr}=useSwitchChain(),Zt=reactExports.useRef(null);reactExports.useEffect(()=>{Zt.current&&jt(Zt.current)},[Ht,dr,St,At,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ut){Pt({width:void 0,height:void 0});return}const Vt=er=>{er.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ut,it]);const Jt={"--height":qt.height,"--width":qt.width};function tr(){return It?!(!It.getWalletConnectDeeplink||It.isInstalled):!1}function _t(){var Vt;switch(Et.route){case routes.ABOUT:return Lt.aboutScreen_heading;case routes.CONNECT:return tr()?isWalletConnectConnector((Vt=It==null?void 0:It.connector)===null||Vt===void 0?void 0:Vt.id)?Lt.scanScreen_heading:Lt.scanScreen_heading_withConnector:Nt==null?void 0:Nt.name;case routes.CONNECTORS:return Lt.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Lt.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Lt.downloadAppScreen_heading;case routes.ONBOARDING:return Lt.onboardingScreen_heading;case routes.PROFILE:return Lt.profileScreen_heading;case routes.SWITCHNETWORKS:return Lt.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return At?Lt.signInWithEthereumScreen_signedIn_heading:Lt.signInWithEthereumScreen_signedOut_heading;default:return""}}const Bt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(mt=ot==null?void 0:ot.theme)!==null&&mt!==void 0?mt:Ct.theme,$useMode:(ft=ot==null?void 0:ot.mode)!==null&&ft!==void 0?ft:Ct.mode,$customTheme:(pt=ot==null?void 0:ot.customTheme)!==null&&pt!==void 0?pt:Ct.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Xt?"auto":"none",position:rt?"absolute":void 0},children:[!nt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Xt,onClick:it,$blur:(yt=Et.options)===null||yt===void 0?void 0:yt.overlayBlur}),jsxRuntimeExports.jsxs(Container$7,{style:Jt,initial:!1,children:[jsxRuntimeExports.jsx("div",{style:{pointerEvents:Yt?"all":"none",position:"absolute",top:0,bottom:0,left:"50%",transform:"translateX(-50%)",width:"var(--width)",zIndex:9,transition:"width 200ms ease"}}),jsxRuntimeExports.jsxs(BoxContainer,{className:`${Xt&&"active"}`,children:[jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:((gt=Et.options)===null||gt===void 0?void 0:gt.disclaimer)&&Et.route===routes.CONNECTORS&&jsxRuntimeExports.jsx(DisclaimerBackground,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{delay:0,duration:.2,ease:[.25,.1,.25,1]},children:jsxRuntimeExports.jsx(Disclaimer,{children:jsxRuntimeExports.jsx("div",{children:(bt=Et.options)===null||bt===void 0?void 0:bt.disclaimer})})})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:Et.errorMessage&&jsxRuntimeExports.jsxs(ErrorMessage,{initial:{y:"10%",x:"-50%"},animate:{y:"-100%"},exit:{y:"100%"},transition:{duration:.2,ease:"easeInOut"},children:[jsxRuntimeExports.jsx("span",{children:Et.errorMessage}),jsxRuntimeExports.jsx("div",{onClick:()=>Et.displayError(null),style:{position:"absolute",right:24,top:24,cursor:"pointer"},children:jsxRuntimeExports.jsx(CloseIcon,{})})]})}),jsxRuntimeExports.jsxs(ControllerContainer,{children:[it&&jsxRuntimeExports.jsx(CloseButton,{"aria-label":flattenChildren(Lt.close).toString(),onClick:it,children:jsxRuntimeExports.jsx(CloseIcon,{})}),jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:23,left:20,width:32,height:32},children:jsxRuntimeExports.jsx(AnimatePresence,{children:st?jsxRuntimeExports.jsx(BackButton,{disabled:Yt,"aria-label":flattenChildren(Lt.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!At&&!(!((xt=Et.options)===null||xt===void 0)&&xt.hideTooltips)&&jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",inset:0,pointerEvents:"none"},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.5,duration:.2}},exit:{opacity:0,scale:.6,transition:{delay:0,duration:St?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Lt.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Yt,"aria-label":Lt.signInWithEthereumScreen_signedOut_heading,onClick:()=>{kt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:At})},"siweButton")]}):at&&!(!((vt=Et.options)===null||vt===void 0)&&vt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Yt,"aria-label":flattenChildren(Lt.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(InfoIcon,{})},"infoButton")})})]}),jsxRuntimeExports.jsx(ModalHeading,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",top:0,bottom:0,left:52,right:52,display:"flex",justifyContent:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.17,delay:St?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:_t()})},`${Et.route}-${At?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(o).map(Vt=>{const er=o[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!rt&&Mt!=="entered",enterAnim:Vt===tt?Wt>Ft?"active-scale-up":"active":"",exitAnim:Vt!==tt?Wt{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:o,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(o)},[o]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:et}):null},OrDivider=({children:et})=>{const o=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:et??o.or})})},Graphic=styled(motion.div)` +`),o=o.map((tt,rt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),rtet.split(/(\*\*[^\*]*\*\*)/g).map((rt,nt)=>/(\*\*.*\*\*)/g.test(rt)?jsxRuntimeExports.jsx("strong",{children:rt.replace(/\*\*/g,"")},nt):`${rt}`).map(rt=>typeof rt=="string"?rt.split(/(\[WALLETCONNECTLOGO\])/g).map(nt=>nt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},nt):nt):rt),LOG_LEVEL={debug:10,info:20,warn:30,error:40,none:100},useIsoLayoutEffect=typeof window<"u"&&window.document&&window.document.createElement!==void 0?reactExports.useLayoutEffect:reactExports.useEffect,useFitText=({logLevel:et="info",maxFontSize:o=100,minFontSize:tt=20,onFinish:rt,onStart:nt,resolution:ot=5}={})=>{const it=LOG_LEVEL[et],st=reactExports.useCallback(()=>({calcKey:0,fontSize:o,fontSizePrev:tt,fontSizeMax:o,fontSizeMin:tt}),[o,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:mt,fontSize:ft,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt}=dt;let bt=null;const[xt]=reactExports.useState(()=>new index$1(()=>{bt=window.requestAnimationFrame(()=>{lt.current||(nt&&nt(),lt.current=!0,ht({...st(),calcKey:mt+1}))})}));reactExports.useEffect(()=>(at.current&&xt.observe(at.current),()=>{bt&&window.cancelAnimationFrame(bt),xt.disconnect()}),[bt,xt]);const vt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{mt===0||lt.current||(vt!==ct.current&&(nt&&nt(),ht({...st(),calcKey:mt+1})),ct.current=vt)},[mt,st,vt,nt]),useIsoLayoutEffect(()=>{if(mt===0)return;const Et=Math.abs(ft-gt)<=ot,Ct=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),St=Ct&&ft===gt,At=ft>gt;if(Et){St?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):Ct?ht({fontSize:At?gt:yt,fontSizeMax:pt,fontSizeMin:yt,fontSizePrev:gt,calcKey:mt}):(lt.current=!1,rt&&rt(ft));return}let kt,It=pt,Nt=yt;Ct?(kt=At?gt-ft:yt-ft,It=Math.min(pt,ft)):(kt=At?pt-ft:gt-ft,Nt=Math.max(yt,ft)),ht({calcKey:mt,fontSize:ft+kt/2,fontSizeMax:It,fontSizeMin:Nt,fontSizePrev:ft})},[mt,ft,pt,yt,gt,rt,at,ot]),{fontSize:ft,ref:at}},FitText=({children:et})=>{const[o,tt]=React.useState(!1),{fontSize:rt,ref:nt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:nt,style:{visibility:o?"visible":"hidden",fontSize:`${rt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:et})};FitText.displayName="FitText";function useConnectors(){const et=useConnectors$1();return et??[]}function useConnector(et,o){const tt=useConnectors();return et==="injected"&&o?tt.find(rt=>rt.id===et&&rt.name===o):et==="injected"?tt.find(rt=>rt.id===et&&rt.name.includes("Injected")):tt.find(rt=>rt.id===et)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=et=>{const tt=useWallets().find(rt=>rt.id===et);return tt||null},useWallets=()=>{const et=useConnectors(),o=useContext();return et.map(rt=>{var nt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(rt.id)!==-1),st={id:rt.id,name:(ot=(nt=rt.name)!==null&&nt!==void 0?nt:rt.id)!==null&&ot!==void 0?ot:rt.type,icon:jsxRuntimeExports.jsx("img",{src:rt.icon,alt:rt.name,width:"100%",height:"100%"}),connector:rt,iconShape:"squircle",isInstalled:rt.type==="mock"||rt.type==="injected"&&rt.id!=="metaMask"||isCoinbaseWalletConnector(rt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:rt.icon?jsxRuntimeExports.jsx("img",{src:rt.icon,alt:rt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((rt,nt,ot)=>ot.findIndex(it=>it.id===rt.id)===nt).map(rt=>{var nt,ot;return rt.id==="walletConnect"?{...rt,name:((nt=o.options)===null||nt===void 0?void 0:nt.walletConnectName)||rt.name,shortName:((ot=o.options)===null||ot===void 0?void 0:ot.walletConnectName)||rt.shortName}:rt}).filter((rt,nt,ot)=>!(rt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((rt,nt,ot)=>!((rt.id==="metaMaskSDK"||rt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((rt,nt)=>{const ot=rt.isInstalled&&isInjectedConnector(rt.connector.type),it=nt.isInstalled&&isInjectedConnector(nt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((rt,nt)=>rt.id==="walletConnect"?1:nt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:et})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[et?jsxRuntimeExports.jsx(AuthIcon,{style:{bottom:-1,right:-1}}):jsxRuntimeExports.jsx("div",{style:{zIndex:2,position:"absolute",top:-2,right:-2,background:"#1A88F8",borderRadius:8,boxShadow:"0 0 0 2px var(--ck-body-background)",width:8,height:8}}),jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M16.5 16.775C14.8618 15.0649 12.5552 14 10 14C7.44477 14 5.13825 15.0649 3.5 16.775",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("circle",{cx:"10",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"2"})]})]}),InfoIcon=({...et})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 11C20 15.9706 15.9706 20 11 20C6.02944 20 2 15.9706 2 11C2 6.02944 6.02944 2 11 2C15.9706 2 20 6.02944 20 11ZM22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11ZM11.6445 12.7051C11.6445 13.1348 11.3223 13.4678 10.7744 13.4678C10.2266 13.4678 9.92578 13.1885 9.92578 12.6191V12.4795C9.92578 11.4268 10.4951 10.8574 11.2686 10.3203C12.2031 9.67578 12.665 9.32129 12.665 8.59082C12.665 7.76367 12.0205 7.21582 11.043 7.21582C10.3232 7.21582 9.80762 7.57031 9.45312 8.16113C9.38282 8.24242 9.32286 8.32101 9.2667 8.39461C9.04826 8.68087 8.88747 8.8916 8.40039 8.8916C8.0459 8.8916 7.66992 8.62305 7.66992 8.15039C7.66992 7.96777 7.70215 7.7959 7.75586 7.61328C8.05664 6.625 9.27051 5.75488 11.1182 5.75488C12.9336 5.75488 14.5234 6.71094 14.5234 8.50488C14.5234 9.7832 13.7822 10.417 12.7402 11.1045C11.999 11.5986 11.6445 11.9746 11.6445 12.5762V12.7051ZM11.9131 15.5625C11.9131 16.1855 11.376 16.6797 10.7529 16.6797C10.1299 16.6797 9.59277 16.1748 9.59277 15.5625C9.59277 14.9395 10.1191 14.4453 10.7529 14.4453C11.3867 14.4453 11.9131 14.9287 11.9131 15.5625Z",fill:"currentColor"})}),CloseIcon=({...et})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...et})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...et,children:jsxRuntimeExports.jsx("path",{d:"M8 1L1 8L8 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),contentTransitionDuration=.22,contentVariants$2={initial:{zIndex:2,opacity:0},animate:{opacity:1,scale:1,transition:{duration:contentTransitionDuration*.75,delay:contentTransitionDuration*.25,ease:[.26,.08,.25,1]}},exit:{zIndex:1,opacity:0,pointerEvents:"none",position:"absolute",left:["50%","50%"],x:["-50%","-50%"],transition:{duration:contentTransitionDuration,ease:[.26,.08,.25,1]}}},Modal=({open:et,pages:o,pageId:tt,positionInside:rt,inline:nt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,mt,ft,pt,yt,gt,bt,xt,vt;const Et=useContext(),Ct=useThemeContext(),St=isMobile(),{isSignedIn:At,reset:kt}=useSIWE(),It=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),Nt={name:It==null?void 0:It.name,shortName:(lt=It==null?void 0:It.shortName)!==null&<!==void 0?lt:It==null?void 0:It.name,icon:(dt=It==null?void 0:It.iconConnector)!==null&&dt!==void 0?dt:It==null?void 0:It.icon,iconShape:(ht=It==null?void 0:It.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:It==null?void 0:It.iconShouldShrink},Lt=useLocales({CONNECTORNAME:Nt==null?void 0:Nt.name}),[Mt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ut=!(Mt==="exited"||Mt==="unmounted"),Xt=Mt==="preEnter"||Mt!=="exiting",Wt=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ft=usePrevious(Wt,Wt);rt||useLockBodyScroll(Ut),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(et),et&&Qt(void 0)},[et]);const[qt,Pt]=reactExports.useState({width:void 0,height:void 0}),[Yt,Qt]=reactExports.useState(void 0),jt=Vt=>{const er={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Pt({width:`${er==null?void 0:er.width}px`,height:`${er==null?void 0:er.height}px`})};let Gt;const rr=reactExports.useCallback(Vt=>{Vt&&(Zt.current=Vt,Qt(Yt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),jt(Vt))},[et,Yt]),{chain:Ht}=useAccount(),{switchChain:dr}=useSwitchChain(),Zt=reactExports.useRef(null);reactExports.useEffect(()=>{Zt.current&&jt(Zt.current)},[Ht,dr,St,At,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ut){Pt({width:void 0,height:void 0});return}const Vt=er=>{er.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ut,it]);const Jt={"--height":qt.height,"--width":qt.width};function tr(){return It?!(!It.getWalletConnectDeeplink||It.isInstalled):!1}function _t(){var Vt;switch(Et.route){case routes.ABOUT:return Lt.aboutScreen_heading;case routes.CONNECT:return tr()?isWalletConnectConnector((Vt=It==null?void 0:It.connector)===null||Vt===void 0?void 0:Vt.id)?Lt.scanScreen_heading:Lt.scanScreen_heading_withConnector:Nt==null?void 0:Nt.name;case routes.CONNECTORS:return Lt.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Lt.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Lt.downloadAppScreen_heading;case routes.ONBOARDING:return Lt.onboardingScreen_heading;case routes.PROFILE:return Lt.profileScreen_heading;case routes.SWITCHNETWORKS:return Lt.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return At?Lt.signInWithEthereumScreen_signedIn_heading:Lt.signInWithEthereumScreen_signedOut_heading;default:return""}}const Bt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(mt=ot==null?void 0:ot.theme)!==null&&mt!==void 0?mt:Ct.theme,$useMode:(ft=ot==null?void 0:ot.mode)!==null&&ft!==void 0?ft:Ct.mode,$customTheme:(pt=ot==null?void 0:ot.customTheme)!==null&&pt!==void 0?pt:Ct.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Xt?"auto":"none",position:rt?"absolute":void 0},children:[!nt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Xt,onClick:it,$blur:(yt=Et.options)===null||yt===void 0?void 0:yt.overlayBlur}),jsxRuntimeExports.jsxs(Container$7,{style:Jt,initial:!1,children:[jsxRuntimeExports.jsx("div",{style:{pointerEvents:Yt?"all":"none",position:"absolute",top:0,bottom:0,left:"50%",transform:"translateX(-50%)",width:"var(--width)",zIndex:9,transition:"width 200ms ease"}}),jsxRuntimeExports.jsxs(BoxContainer,{className:`${Xt&&"active"}`,children:[jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:((gt=Et.options)===null||gt===void 0?void 0:gt.disclaimer)&&Et.route===routes.CONNECTORS&&jsxRuntimeExports.jsx(DisclaimerBackground,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{delay:0,duration:.2,ease:[.25,.1,.25,1]},children:jsxRuntimeExports.jsx(Disclaimer,{children:jsxRuntimeExports.jsx("div",{children:(bt=Et.options)===null||bt===void 0?void 0:bt.disclaimer})})})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:Et.errorMessage&&jsxRuntimeExports.jsxs(ErrorMessage,{initial:{y:"10%",x:"-50%"},animate:{y:"-100%"},exit:{y:"100%"},transition:{duration:.2,ease:"easeInOut"},children:[jsxRuntimeExports.jsx("span",{children:Et.errorMessage}),jsxRuntimeExports.jsx("div",{onClick:()=>Et.displayError(null),style:{position:"absolute",right:24,top:24,cursor:"pointer"},children:jsxRuntimeExports.jsx(CloseIcon,{})})]})}),jsxRuntimeExports.jsxs(ControllerContainer,{children:[it&&jsxRuntimeExports.jsx(CloseButton,{"aria-label":flattenChildren(Lt.close).toString(),onClick:it,children:jsxRuntimeExports.jsx(CloseIcon,{})}),jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:23,left:20,width:32,height:32},children:jsxRuntimeExports.jsx(AnimatePresence,{children:st?jsxRuntimeExports.jsx(BackButton,{disabled:Yt,"aria-label":flattenChildren(Lt.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!At&&!(!((xt=Et.options)===null||xt===void 0)&&xt.hideTooltips)&&jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",inset:0,pointerEvents:"none"},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.5,duration:.2}},exit:{opacity:0,scale:.6,transition:{delay:0,duration:St?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Lt.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Yt,"aria-label":Lt.signInWithEthereumScreen_signedOut_heading,onClick:()=>{kt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:At})},"siweButton")]}):at&&!(!((vt=Et.options)===null||vt===void 0)&&vt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Yt,"aria-label":flattenChildren(Lt.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.1,delay:St?.01:0},children:jsxRuntimeExports.jsx(InfoIcon,{})},"infoButton")})})]}),jsxRuntimeExports.jsx(ModalHeading,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",top:0,bottom:0,left:52,right:52,display:"flex",justifyContent:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:St?0:.17,delay:St?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:_t()})},`${Et.route}-${At?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(o).map(Vt=>{const er=o[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!rt&&Mt!=="entered",enterAnim:Vt===tt?Wt>Ft?"active-scale-up":"active":"",exitAnim:Vt!==tt?Wt{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:o,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(o)},[o]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:et}):null},OrDivider=({children:et})=>{const o=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:et??o.or})})},Graphic=styled(motion.div)` position: relative; margin: 16px auto 20px; height: 190px; @@ -2568,7 +2568,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C background: var(--ck-tooltip-background); border-radius: ${et=>et.$size==="small"?2:3}px 0 0 0; } -`,Tooltip=({children:et,message:o,open:tt,xOffset:rt=0,yOffset:nt=0,delay:ot})=>{var it;const st=useContext(),at=useThemeContext();if(!((it=st.options)===null||it===void 0)&&it.hideTooltips)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:et});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[mt,ft]=reactExports.useState("small"),[pt,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),bt=reactExports.useRef(null),[xt,vt]=useMeasure({debounce:pt?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let At=!1;const kt=rt+vt.left+vt.width,It=nt+vt.top+vt.height*.5;return(kt>window.innerWidth||kt<0||It>window.innerHeight||It<0)&&(At=!0),At};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!bt.current||vt.top+vt.bottom+vt.left+vt.right+vt.height+vt.width===0)return;const At=rt+vt.left+vt.width,kt=nt+vt.top+vt.height*.5;!pt&&At!==0&&kt!==0&&yt(!0),bt.current.style.left=`${At}px`,bt.current.style.top=`${kt}px`,ft(bt.current.offsetHeight<=40?"small":"large"),ht(Et())},[vt,tt,ct]),reactExports.useEffect(()=>{st.open||lt(!1)},[st.open]),reactExports.useEffect(()=>{lt(!!tt)},[tt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(motion.div,{ref:xt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:et}),jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:gt===st.route&&!dt&&ct&&jsxRuntimeExports.jsx(ResetContainer,{$useTheme:at.theme,$useMode:at.mode,$customTheme:at.customTheme,children:jsxRuntimeExports.jsx(TooltipWindow,{children:jsxRuntimeExports.jsxs(TooltipContainer,{role:"tooltip",$size:mt,ref:bt,initial:"collapsed",animate:pt?"open":{},exit:"collapsed",variants:{collapsed:{transformOrigin:"20px 50%",opacity:0,scale:.9,z:.01,y:"-50%",x:20,transition:{duration:.1}},open:{willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:"-50%",x:20,transition:{ease:[.76,0,.24,1],duration:.15,delay:ot||.5}}},children:[o,jsxRuntimeExports.jsx(TooltipTail,{$size:mt})]})})})})})]})},LogoContainer$4=styled(motion.div)` +`,Tooltip=({children:et,message:o,open:tt,xOffset:rt=0,yOffset:nt=0,delay:ot})=>{var it;const st=useContext(),at=useThemeContext();if(!((it=st.options)===null||it===void 0)&&it.hideTooltips)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:et});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[mt,ft]=reactExports.useState("small"),[pt,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),bt=reactExports.useRef(null),[xt,vt]=useMeasure({debounce:pt?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let At=!1;const kt=rt+vt.left+vt.width,It=nt+vt.top+vt.height*.5;return(kt>window.innerWidth||kt<0||It>window.innerHeight||It<0)&&(At=!0),At};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!bt.current||vt.top+vt.bottom+vt.left+vt.right+vt.height+vt.width===0)return;const At=rt+vt.left+vt.width,kt=nt+vt.top+vt.height*.5;!pt&&At!==0&&kt!==0&&yt(!0),bt.current.style.left=`${At}px`,bt.current.style.top=`${kt}px`,ft(bt.current.offsetHeight<=40?"small":"large"),ht(Et())},[vt,tt,ct]),reactExports.useEffect(()=>{st.open||lt(!1)},[st.open]),reactExports.useEffect(()=>{lt(!!tt)},[tt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(motion.div,{ref:xt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:et}),jsxRuntimeExports.jsx(Portal,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:gt===st.route&&!dt&&ct&&jsxRuntimeExports.jsx(ResetContainer,{$useTheme:at.theme,$useMode:at.mode,$customTheme:at.customTheme,children:jsxRuntimeExports.jsx(TooltipWindow,{children:jsxRuntimeExports.jsxs(TooltipContainer,{role:"tooltip",$size:mt,ref:bt,initial:"collapsed",animate:pt?"open":{},exit:"collapsed",variants:{collapsed:{transformOrigin:"20px 50%",opacity:0,scale:.9,z:.01,y:"-50%",x:20,transition:{duration:.1}},open:{willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:"-50%",x:20,transition:{ease:[.76,0,.24,1],duration:.15,delay:ot||.5}}},children:[o,jsxRuntimeExports.jsx(TooltipTail,{$size:mt})]})})})})})]})},LogoContainer$4=styled(motion.div)` z-index: 4; position: relative; overflow: hidden; @@ -3226,7 +3226,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C input[type="radio"]:not(:disabled), input[type="checkbox"]:not(:disabled), select:not(:disabled) - `),Lt=Nt[0],Mt=Nt[Nt.length-1];if(St.key==="ArrowUp")if(document.activeElement===Lt)Mt.focus();else{let zt=(kt=document==null?void 0:document.activeElement)===null||kt===void 0?void 0:kt.previousSibling;for(zt||(zt=Mt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Mt)Lt.focus();else{let zt=(It=document==null?void 0:document.activeElement)===null||It===void 0?void 0:It.nextSibling;for(zt||(zt=Lt);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",Ct),()=>{document.removeEventListener("keydown",Ct)}},[o]);const ft=reactExports.useRef(null),pt=reactExports.useCallback(Ct=>{Ct&&(ft.current=Ct,bt())},[o]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),bt=()=>{if(!ft.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let Ct=gt.left+rt,St=gt.top+gt.height+nt;ft.current.style.left=`${Ct}px`,ft.current.style.top=`${St}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(bt,[ft.current,gt,o]),reactExports.useEffect(bt,[o,ft.current]);const vt=tt,Et=tt;return reactExports.useEffect(()=>(bt(),window.addEventListener("scroll",vt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",vt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:et}),jsxRuntimeExports.jsx(AnimatePresence,{children:o&&jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(ot=ct.theme)!==null&&ot!==void 0?ot:at.theme,$useMode:(it=ct.mode)!==null&&it!==void 0?it:at.mode,$customTheme:(st=ct.customTheme)!==null&&st!==void 0?st:at.customTheme,children:jsxRuntimeExports.jsx(FocusTrap,{children:jsxRuntimeExports.jsxs(DropdownWindow,{ref:mt,children:[jsxRuntimeExports.jsx(DropdownOverlay,{onClick:tt}),jsxRuntimeExports.jsxs(DropdownContainer,{ref:pt,style:{left:dt.x,top:dt.y},initial:"collapsed",animate:"open",exit:"collapsed",variants:{collapsed:{transformOrigin:"0 0",opacity:0,scale:.96,z:.01,y:-4,x:0,transition:{duration:.1}},open:{transformOrigin:"0 0",willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:0,x:0,transition:{ease:[.76,0,.24,1],duration:.15}}},children:[jsxRuntimeExports.jsx(DropdownHeading,{children:lt.switchNetworks}),jsxRuntimeExports.jsx(ChainSelectList,{})]})]})})})})})]})},ChainContainer=styled.div` + `),Lt=Nt[0],Mt=Nt[Nt.length-1];if(St.key==="ArrowUp")if(document.activeElement===Lt)Mt.focus();else{let zt=(kt=document==null?void 0:document.activeElement)===null||kt===void 0?void 0:kt.previousSibling;for(zt||(zt=Mt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Mt)Lt.focus();else{let zt=(It=document==null?void 0:document.activeElement)===null||It===void 0?void 0:It.nextSibling;for(zt||(zt=Lt);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",Ct),()=>{document.removeEventListener("keydown",Ct)}},[o]);const ft=reactExports.useRef(null),pt=reactExports.useCallback(Ct=>{Ct&&(ft.current=Ct,bt())},[o]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),bt=()=>{if(!ft.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let Ct=gt.left+rt,St=gt.top+gt.height+nt;ft.current.style.left=`${Ct}px`,ft.current.style.top=`${St}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(bt,[ft.current,gt,o]),reactExports.useEffect(bt,[o,ft.current]);const vt=tt,Et=tt;return reactExports.useEffect(()=>(bt(),window.addEventListener("scroll",vt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",vt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:et}),jsxRuntimeExports.jsx(AnimatePresence,{children:o&&jsxRuntimeExports.jsx(Portal,{children:jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(ot=ct.theme)!==null&&ot!==void 0?ot:at.theme,$useMode:(it=ct.mode)!==null&&it!==void 0?it:at.mode,$customTheme:(st=ct.customTheme)!==null&&st!==void 0?st:at.customTheme,children:jsxRuntimeExports.jsx(FocusTrap,{children:jsxRuntimeExports.jsxs(DropdownWindow,{ref:mt,children:[jsxRuntimeExports.jsx(DropdownOverlay,{onClick:tt}),jsxRuntimeExports.jsxs(DropdownContainer,{ref:pt,style:{left:dt.x,top:dt.y},initial:"collapsed",animate:"open",exit:"collapsed",variants:{collapsed:{transformOrigin:"0 0",opacity:0,scale:.96,z:.01,y:-4,x:0,transition:{duration:.1}},open:{transformOrigin:"0 0",willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:0,x:0,transition:{ease:[.76,0,.24,1],duration:.15}}},children:[jsxRuntimeExports.jsx(DropdownHeading,{children:lt.switchNetworks}),jsxRuntimeExports.jsx(ChainSelectList,{})]})]})})})})})]})},ChainContainer=styled.div` --bg: transparent; --color: #333; ${et=>typeof et.size=="string"?Ae` @@ -3870,7 +3870,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends(){return _extends=Object.assign?Object.assign.bind():function(et){for(var o=1;o=0)&&(tt[nt]=et[nt]);return tt}function isModifiedEvent(et){return!!(et.metaKey||et.altKey||et.ctrlKey||et.shiftKey)}function shouldProcessLinkClick(et,o){return et.button===0&&(!o||o==="_self")&&!isModifiedEvent(et)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(et){let{basename:o,children:tt,future:rt,window:nt}=et,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:nt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=rt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.createElement(Router,{basename:o,children:tt,location:st.location,navigationType:st.action,navigator:it,future:rt})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(o,tt){let{onClick:rt,relative:nt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=o,ht=_objectWithoutPropertiesLoose$1(o,_excluded),{basename:mt}=reactExports.useContext(NavigationContext),ft,pt=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(ft=ct,isBrowser$1))try{let xt=new URL(window.location.href),vt=ct.startsWith("//")?new URL(xt.protocol+ct):new URL(ct),Et=stripBasename(vt.pathname,mt);vt.origin===xt.origin&&Et!=null?ct=Et+vt.search+vt.hash:pt=!0}catch{}let yt=useHref(ct,{relative:nt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:nt,viewTransition:dt});function bt(xt){rt&&rt(xt),xt.defaultPrevented||gt(xt)}return reactExports.createElement("a",_extends({},ht,{href:ft||yt,onClick:pt||ot?rt:bt,ref:tt,target:at}))});var DataRouterHook;(function(et){et.UseScrollRestoration="useScrollRestoration",et.UseSubmit="useSubmit",et.UseSubmitFetcher="useSubmitFetcher",et.UseFetcher="useFetcher",et.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(et){et.UseFetcher="useFetcher",et.UseFetchers="useFetchers",et.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(et,o){let{target:tt,replace:rt,state:nt,preventScrollReset:ot,relative:it,viewTransition:st}=o===void 0?{}:o,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(et,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=rt!==void 0?rt:createPath(ct)===createPath(lt);at(et,{replace:ht,state:nt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,rt,nt,tt,et,ot,it,st])}function setRef(et,o){typeof et=="function"?et(o):et!=null&&(et.current=o)}function composeRefs(...et){return o=>et.forEach(tt=>setRef(tt,o))}function useComposedRefs(...et){return reactExports.useCallback(composeRefs(...et),et)}var Slot=reactExports.forwardRef((et,o)=>{const{children:tt,...rt}=et,nt=reactExports.Children.toArray(tt),ot=nt.find(isSlottable);if(ot){const it=ot.props.children,st=nt.map(at=>at===ot?reactExports.Children.count(it)>1?reactExports.Children.only(null):reactExports.isValidElement(it)?it.props.children:null:at);return jsxRuntimeExports.jsx(SlotClone,{...rt,ref:o,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...rt,ref:o,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((et,o)=>{const{children:tt,...rt}=et;if(reactExports.isValidElement(tt)){const nt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(rt,tt.props),ref:o?composeRefs(o,nt):nt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:et})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:et});function isSlottable(et){return reactExports.isValidElement(et)&&et.type===Slottable}function mergeProps(et,o){const tt={...o};for(const rt in o){const nt=et[rt],ot=o[rt];/^on[A-Z]/.test(rt)?nt&&ot?tt[rt]=(...st)=>{ot(...st),nt(...st)}:nt&&(tt[rt]=nt):rt==="style"?tt[rt]={...nt,...ot}:rt==="className"&&(tt[rt]=[nt,ot].filter(Boolean).join(" "))}return{...et,...tt}}function getElementRef$1(et){var rt,nt;let o=(rt=Object.getOwnPropertyDescriptor(et.props,"ref"))==null?void 0:rt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning;return tt?et.ref:(o=(nt=Object.getOwnPropertyDescriptor(et,"ref"))==null?void 0:nt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning,tt?et.props.ref:et.props.ref||et.ref)}function r$1(et){var o,tt,rt="";if(typeof et=="string"||typeof et=="number")rt+=et;else if(typeof et=="object")if(Array.isArray(et))for(o=0;otypeof et=="boolean"?"".concat(et):et===0?"0":et,cx=clsx$1,cva=(et,o)=>tt=>{var rt;if((o==null?void 0:o.variants)==null)return cx(et,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:nt,defaultVariants:ot}=o,it=Object.keys(nt).map(ct=>{const lt=tt==null?void 0:tt[ct],dt=ot==null?void 0:ot[ct];if(lt===null)return null;const ht=falsyToString(lt)||falsyToString(dt);return nt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=o==null||(rt=o.compoundVariants)===null||rt===void 0?void 0:rt.reduce((ct,lt)=>{let{class:dt,className:ht,...mt}=lt;return Object.entries(mt).every(ft=>{let[pt,yt]=ft;return Array.isArray(yt)?yt.includes({...ot,...st}[pt]):{...ot,...st}[pt]===yt})?[...ct,dt,ht]:ct},[]);return cx(et,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(et){var o,tt,rt="";if(typeof et=="string"||typeof et=="number")rt+=et;else if(typeof et=="object")if(Array.isArray(et)){var nt=et.length;for(o=0;o{const o=createClassMap(et),{conflictingClassGroups:tt,conflictingClassGroupModifiers:rt}=et;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,o)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&rt[it]?[...at,...rt[it]]:at}}},getGroupRecursive=(et,o)=>{var it;if(et.length===0)return o.classGroupId;const tt=et[0],rt=o.nextPart.get(tt),nt=rt?getGroupRecursive(et.slice(1),rt):void 0;if(nt)return nt;if(o.validators.length===0)return;const ot=et.join(CLASS_PART_SEPARATOR);return(it=o.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=et=>{if(arbitraryPropertyRegex.test(et)){const o=arbitraryPropertyRegex.exec(et)[1],tt=o==null?void 0:o.substring(0,o.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=et=>{const{theme:o,prefix:tt}=et,rt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(et.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,rt,ot,o)}),rt},processClassesRecursively=(et,o,tt,rt)=>{et.forEach(nt=>{if(typeof nt=="string"){const ot=nt===""?o:getPart(o,nt);ot.classGroupId=tt;return}if(typeof nt=="function"){if(isThemeGetter(nt)){processClassesRecursively(nt(rt),o,tt,rt);return}o.validators.push({validator:nt,classGroupId:tt});return}Object.entries(nt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(o,ot),tt,rt)})})},getPart=(et,o)=>{let tt=et;return o.split(CLASS_PART_SEPARATOR).forEach(rt=>{tt.nextPart.has(rt)||tt.nextPart.set(rt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(rt)}),tt},isThemeGetter=et=>et.isThemeGetter,getPrefixedClassGroupEntries=(et,o)=>o?et.map(([tt,rt])=>{const nt=rt.map(ot=>typeof ot=="string"?o+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[o+it,st])):ot);return[tt,nt]}):et,createLruCache=et=>{if(et<1)return{get:()=>{},set:()=>{}};let o=0,tt=new Map,rt=new Map;const nt=(ot,it)=>{tt.set(ot,it),o++,o>et&&(o=0,rt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=rt.get(ot))!==void 0)return nt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):nt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=et=>{const{separator:o,experimentalParseClassName:tt}=et,rt=o.length===1,nt=o[0],ot=o.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:mt,baseClassName:ft,maybePostfixModifierPosition:pt}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=et=>{if(et.length<=1)return et;const o=[];let tt=[];return et.forEach(rt=>{rt[0]==="["?(o.push(...tt.sort(),rt),tt=[]):tt.push(rt)}),o.push(...tt.sort()),o},createConfigUtils=et=>({cache:createLruCache(et.cacheSize),parseClassName:createParseClassName(et),...createClassGroupUtils(et)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(et,o)=>{const{parseClassName:tt,getClassGroupId:rt,getConflictingClassGroupIds:nt}=o,ot=[],it=et.trim().split(SPLIT_CLASSES_REGEX);let st="";for(let at=it.length-1;at>=0;at-=1){const ct=it[at],{modifiers:lt,hasImportantModifier:dt,baseClassName:ht,maybePostfixModifierPosition:mt}=tt(ct);let ft=!!mt,pt=rt(ft?ht.substring(0,mt):ht);if(!pt){if(!ft){st=ct+(st.length>0?" "+st:st);continue}if(pt=rt(ht),!pt){st=ct+(st.length>0?" "+st:st);continue}ft=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,bt=gt+pt;if(ot.includes(bt))continue;ot.push(bt);const xt=nt(pt,ft);for(let vt=0;vt0?" "+st:st)}return st};function twJoin(){let et=0,o,tt,rt="";for(;et{if(typeof et=="string")return et;let o,tt="";for(let rt=0;rtdt(lt),et());return tt=createConfigUtils(ct),rt=tt.cache.get,nt=tt.cache.set,ot=st,st(at)}function st(at){const ct=rt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return nt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=et=>{const o=tt=>tt[et]||[];return o.isThemeGetter=!0,o},arbitraryValueRegex=/^\[(?:([a-z-]+):)?(.+)\]$/i,fractionRegex=/^\d+\/\d+$/,stringLengths=new Set(["px","full","screen"]),tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isLength=et=>isNumber(et)||stringLengths.has(et)||fractionRegex.test(et),isArbitraryLength=et=>getIsArbitraryValue(et,"length",isLengthOnly),isNumber=et=>!!et&&!Number.isNaN(Number(et)),isArbitraryNumber=et=>getIsArbitraryValue(et,"number",isNumber),isInteger$1=et=>!!et&&Number.isInteger(Number(et)),isPercent=et=>et.endsWith("%")&&isNumber(et.slice(0,-1)),isArbitraryValue=et=>arbitraryValueRegex.test(et),isTshirtSize=et=>tshirtUnitRegex.test(et),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=et=>getIsArbitraryValue(et,sizeLabels,isNever),isArbitraryPosition=et=>getIsArbitraryValue(et,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=et=>getIsArbitraryValue(et,imageLabels,isImage),isArbitraryShadow=et=>getIsArbitraryValue(et,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(et,o,tt)=>{const rt=arbitraryValueRegex.exec(et);return rt?rt[1]?typeof o=="string"?rt[1]===o:o.has(rt[1]):tt(rt[2]):!1},isLengthOnly=et=>lengthUnitRegex.test(et)&&!colorFunctionRegex.test(et),isNever=()=>!1,isShadow=et=>shadowRegex.test(et),isImage=et=>imageRegex.test(et),getDefaultConfig=()=>{const et=fromTheme("colors"),o=fromTheme("spacing"),tt=fromTheme("blur"),rt=fromTheme("brightness"),nt=fromTheme("borderColor"),ot=fromTheme("borderRadius"),it=fromTheme("borderSpacing"),st=fromTheme("borderWidth"),at=fromTheme("contrast"),ct=fromTheme("grayscale"),lt=fromTheme("hueRotate"),dt=fromTheme("invert"),ht=fromTheme("gap"),mt=fromTheme("gradientColorStops"),ft=fromTheme("gradientColorStopPositions"),pt=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),bt=fromTheme("padding"),xt=fromTheme("saturate"),vt=fromTheme("scale"),Et=fromTheme("sepia"),Ct=fromTheme("skew"),St=fromTheme("space"),At=fromTheme("translate"),kt=()=>["auto","contain","none"],It=()=>["auto","hidden","clip","visible","scroll"],Nt=()=>["auto",isArbitraryValue,o],Lt=()=>[isArbitraryValue,o],Mt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ut=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Xt=()=>["solid","dashed","dotted","double","none"],Wt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ft=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Pt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Yt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Yt(),borderColor:[et],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Lt(),borderWidth:Mt(),contrast:Yt(),grayscale:qt(),hueRotate:Yt(),invert:qt(),gap:Lt(),gradientColorStops:[et],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:Nt(),margin:Nt(),opacity:Yt(),padding:Lt(),saturate:Yt(),scale:Yt(),sepia:qt(),skew:Yt(),space:Lt(),translate:Lt()},classGroups:{aspect:[{aspect:["auto","square","video",isArbitraryValue]}],container:["container"],columns:[{columns:[isTshirtSize]}],"break-after":[{"break-after":Pt()}],"break-before":[{"break-before":Pt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ut(),isArbitraryValue]}],overflow:[{overflow:It()}],"overflow-x":[{"overflow-x":It()}],"overflow-y":[{"overflow-y":It()}],overscroll:[{overscroll:kt()}],"overscroll-x":[{"overscroll-x":kt()}],"overscroll-y":[{"overscroll-y":kt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[pt]}],"inset-x":[{"inset-x":[pt]}],"inset-y":[{"inset-y":[pt]}],start:[{start:[pt]}],end:[{end:[pt]}],top:[{top:[pt]}],right:[{right:[pt]}],bottom:[{bottom:[pt]}],left:[{left:[pt]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",isInteger$1,isArbitraryValue]}],basis:[{basis:Nt()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",isArbitraryValue]}],grow:[{grow:qt()}],shrink:[{shrink:qt()}],order:[{order:["first","last","none",isInteger$1,isArbitraryValue]}],"grid-cols":[{"grid-cols":[isAny]}],"col-start-end":[{col:["auto",{span:["full",isInteger$1,isArbitraryValue]},isArbitraryValue]}],"col-start":[{"col-start":zt()}],"col-end":[{"col-end":zt()}],"grid-rows":[{"grid-rows":[isAny]}],"row-start-end":[{row:["auto",{span:[isInteger$1,isArbitraryValue]},isArbitraryValue]}],"row-start":[{"row-start":zt()}],"row-end":[{"row-end":zt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",isArbitraryValue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",isArbitraryValue]}],gap:[{gap:[ht]}],"gap-x":[{"gap-x":[ht]}],"gap-y":[{"gap-y":[ht]}],"justify-content":[{justify:["normal",...Ft()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ft(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ft(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[bt]}],px:[{px:[bt]}],py:[{py:[bt]}],ps:[{ps:[bt]}],pe:[{pe:[bt]}],pt:[{pt:[bt]}],pr:[{pr:[bt]}],pb:[{pb:[bt]}],pl:[{pl:[bt]}],m:[{m:[yt]}],mx:[{mx:[yt]}],my:[{my:[yt]}],ms:[{ms:[yt]}],me:[{me:[yt]}],mt:[{mt:[yt]}],mr:[{mr:[yt]}],mb:[{mb:[yt]}],ml:[{ml:[yt]}],"space-x":[{"space-x":[St]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[St]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,o]}],"min-w":[{"min-w":[isArbitraryValue,o,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,o,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,o,"auto","min","max","fit"]}],"font-size":[{text:["base",isTshirtSize,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",isArbitraryNumber]}],"font-family":[{font:[isAny]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",isArbitraryValue]}],"line-clamp":[{"line-clamp":["none",isNumber,isArbitraryNumber]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",isLength,isArbitraryValue]}],"list-image":[{"list-image":["none",isArbitraryValue]}],"list-style-type":[{list:["none","disc","decimal",isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[et]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[et]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Xt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Lt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[gt]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ut(),isArbitraryPosition]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",isArbitrarySize]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},isArbitraryImage]}],"bg-color":[{bg:[et]}],"gradient-from-pos":[{from:[ft]}],"gradient-via-pos":[{via:[ft]}],"gradient-to-pos":[{to:[ft]}],"gradient-from":[{from:[mt]}],"gradient-via":[{via:[mt]}],"gradient-to":[{to:[mt]}],rounded:[{rounded:[ot]}],"rounded-s":[{"rounded-s":[ot]}],"rounded-e":[{"rounded-e":[ot]}],"rounded-t":[{"rounded-t":[ot]}],"rounded-r":[{"rounded-r":[ot]}],"rounded-b":[{"rounded-b":[ot]}],"rounded-l":[{"rounded-l":[ot]}],"rounded-ss":[{"rounded-ss":[ot]}],"rounded-se":[{"rounded-se":[ot]}],"rounded-ee":[{"rounded-ee":[ot]}],"rounded-es":[{"rounded-es":[ot]}],"rounded-tl":[{"rounded-tl":[ot]}],"rounded-tr":[{"rounded-tr":[ot]}],"rounded-br":[{"rounded-br":[ot]}],"rounded-bl":[{"rounded-bl":[ot]}],"border-w":[{border:[st]}],"border-w-x":[{"border-x":[st]}],"border-w-y":[{"border-y":[st]}],"border-w-s":[{"border-s":[st]}],"border-w-e":[{"border-e":[st]}],"border-w-t":[{"border-t":[st]}],"border-w-r":[{"border-r":[st]}],"border-w-b":[{"border-b":[st]}],"border-w-l":[{"border-l":[st]}],"border-opacity":[{"border-opacity":[gt]}],"border-style":[{border:[...Xt(),"hidden"]}],"divide-x":[{"divide-x":[st]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[st]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[gt]}],"divide-style":[{divide:Xt()}],"border-color":[{border:[nt]}],"border-color-x":[{"border-x":[nt]}],"border-color-y":[{"border-y":[nt]}],"border-color-s":[{"border-s":[nt]}],"border-color-e":[{"border-e":[nt]}],"border-color-t":[{"border-t":[nt]}],"border-color-r":[{"border-r":[nt]}],"border-color-b":[{"border-b":[nt]}],"border-color-l":[{"border-l":[nt]}],"divide-color":[{divide:[nt]}],"outline-style":[{outline:["",...Xt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[et]}],"ring-w":[{ring:Mt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[et]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[et]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Wt(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Wt()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[rt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[xt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[rt]}],"backdrop-contrast":[{"backdrop-contrast":[at]}],"backdrop-grayscale":[{"backdrop-grayscale":[ct]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[lt]}],"backdrop-invert":[{"backdrop-invert":[dt]}],"backdrop-opacity":[{"backdrop-opacity":[gt]}],"backdrop-saturate":[{"backdrop-saturate":[xt]}],"backdrop-sepia":[{"backdrop-sepia":[Et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[it]}],"border-spacing-x":[{"border-spacing-x":[it]}],"border-spacing-y":[{"border-spacing-y":[it]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",isArbitraryValue]}],duration:[{duration:Yt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Yt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[vt]}],"scale-x":[{"scale-x":[vt]}],"scale-y":[{"scale-y":[vt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[At]}],"translate-y":[{"translate-y":[At]}],"skew-x":[{"skew-x":[Ct]}],"skew-y":[{"skew-y":[Ct]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",et]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryValue]}],"caret-color":[{caret:[et]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Lt()}],"scroll-mx":[{"scroll-mx":Lt()}],"scroll-my":[{"scroll-my":Lt()}],"scroll-ms":[{"scroll-ms":Lt()}],"scroll-me":[{"scroll-me":Lt()}],"scroll-mt":[{"scroll-mt":Lt()}],"scroll-mr":[{"scroll-mr":Lt()}],"scroll-mb":[{"scroll-mb":Lt()}],"scroll-ml":[{"scroll-ml":Lt()}],"scroll-p":[{"scroll-p":Lt()}],"scroll-px":[{"scroll-px":Lt()}],"scroll-py":[{"scroll-py":Lt()}],"scroll-ps":[{"scroll-ps":Lt()}],"scroll-pe":[{"scroll-pe":Lt()}],"scroll-pt":[{"scroll-pt":Lt()}],"scroll-pr":[{"scroll-pr":Lt()}],"scroll-pb":[{"scroll-pb":Lt()}],"scroll-pl":[{"scroll-pl":Lt()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryValue]}],fill:[{fill:[et,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[et,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...et){return twMerge(clsx(et))}const buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=reactExports.forwardRef(({className:et,variant:o,size:tt,asChild:rt=!1,...nt},ot)=>{const it=rt?Slot:"button";return jsxRuntimeExports.jsx(it,{className:cn(buttonVariants({variant:o,size:tt,className:et})),ref:ot,...nt})});Button.displayName="Button";function allocUnsafe$j(et=0){return new Uint8Array(et)}const N1$6=Math.pow(2,7),N2$6=Math.pow(2,14),N3$6=Math.pow(2,21),N4$6=Math.pow(2,28),N5$6=Math.pow(2,35),N6$6=Math.pow(2,42),N7$6=Math.pow(2,49),MSB$8=128,REST$8=127;function encodingLength$6(et){if(etNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(et,o,tt=0){switch(encodingLength$6(et)){case 8:o[tt++]=et&255|MSB$8,et/=128;case 7:o[tt++]=et&255|MSB$8,et/=128;case 6:o[tt++]=et&255|MSB$8,et/=128;case 5:o[tt++]=et&255|MSB$8,et/=128;case 4:o[tt++]=et&255|MSB$8,et>>>=7;case 3:o[tt++]=et&255|MSB$8,et>>>=7;case 2:o[tt++]=et&255|MSB$8,et>>>=7;case 1:{o[tt++]=et&255,et>>>=7;break}default:throw new Error("unreachable")}return o}function encodeUint8ArrayList(et,o,tt=0){switch(encodingLength$6(et)){case 8:o.set(tt++,et&255|MSB$8),et/=128;case 7:o.set(tt++,et&255|MSB$8),et/=128;case 6:o.set(tt++,et&255|MSB$8),et/=128;case 5:o.set(tt++,et&255|MSB$8),et/=128;case 4:o.set(tt++,et&255|MSB$8),et>>>=7;case 3:o.set(tt++,et&255|MSB$8),et>>>=7;case 2:o.set(tt++,et&255|MSB$8),et>>>=7;case 1:{o.set(tt++,et&255),et>>>=7;break}default:throw new Error("unreachable")}return o}function decodeUint8Array(et,o){let tt=et[o],rt=0;if(rt+=tt&REST$8,tt>>31>0){const tt=~this.lo+1>>>0;let rt=~this.hi>>>0;return tt===0&&(rt=rt+1>>>0),-(tt+rt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(o=!1){if(o)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let rt=~this.hi>>>0;return tt===0&&(rt=rt+1>>>0),-(BigInt(tt)+(BigInt(rt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(o=!1){return this.toBigInt(o).toString()}zzEncode(){const o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this}zzDecode(){const o=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this}length(){const o=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,rt=this.hi>>>24;return rt===0?tt===0?o<16384?o<128?1:2:o<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:rt<128?9:10}static fromBigInt(o){if(o===0n)return zero;if(oMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(o));const tt=o<0n;tt&&(o=-o);let rt=o>>32n,nt=o-(rt<<32n);return tt&&(rt=~rt|0n,nt=~nt|0n,++nt>TWO_32&&(nt=0n,++rt>TWO_32&&(rt=0n))),new Sn(Number(nt),Number(rt))}static fromNumber(o){if(o===0)return zero;const tt=o<0;tt&&(o=-o);let rt=o>>>0,nt=(o-rt)/4294967296>>>0;return tt&&(nt=~nt>>>0,rt=~rt>>>0,++rt>4294967295&&(rt=0,++nt>4294967295&&(nt=0))),new Sn(rt,nt)}static from(o){return typeof o=="number"?Sn.fromNumber(o):typeof o=="bigint"?Sn.fromBigInt(o):typeof o=="string"?Sn.fromBigInt(BigInt(o)):o.low!=null||o.high!=null?new Sn(o.low>>>0,o.high>>>0):zero}};const zero=new LongBits$2(0,0);zero.toBigInt=function(){return 0n};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};const TWO_32=4294967296n;function length$6(et){let o=0,tt=0;for(let rt=0;rt191&&st<224?ot[it++]=(st&31)<<6|et[o++]&63:st>239&&st<365?(st=((st&7)<<18|(et[o++]&63)<<12|(et[o++]&63)<<6|et[o++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(et[o++]&63)<<6|et[o++]&63,it>8191&&((nt??(nt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return nt!=null?(it>0&&nt.push(String.fromCharCode.apply(String,ot.slice(0,it))),nt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(et,o,tt){const rt=tt;let nt,ot;for(let it=0;it>6|192,o[tt++]=nt&63|128):(nt&64512)===55296&&((ot=et.charCodeAt(it+1))&64512)===56320?(nt=65536+((nt&1023)<<10)+(ot&1023),++it,o[tt++]=nt>>18|240,o[tt++]=nt>>12&63|128,o[tt++]=nt>>6&63|128,o[tt++]=nt&63|128):(o[tt++]=nt>>12|224,o[tt++]=nt>>6&63|128,o[tt++]=nt&63|128);return tt-rt}function indexOutOfRange$1(et,o){return RangeError(`index out of range: ${et.pos} + ${o??1} > ${et.len}`)}function readFixed32End(et,o){return(et[o-4]|et[o-3]<<8|et[o-2]<<16|et[o-1]<<24)>>>0}class Uint8ArrayReader{constructor(o){wt(this,"buf");wt(this,"pos");wt(this,"len");wt(this,"_slice",Uint8Array.prototype.subarray);this.buf=o,this.pos=0,this.len=o.length}uint32(){let o=4294967295;if(o=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(o=(o|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return o;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return o}int32(){return this.uint32()|0}sint32(){const o=this.uint32();return o>>>1^-(o&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);const o=readFloatLE(this.buf,this.pos);return this.pos+=4,o}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const o=readDoubleLE(this.buf,this.pos);return this.pos+=8,o}bytes(){const o=this.uint32(),tt=this.pos,rt=this.pos+o;if(rt>this.len)throw indexOutOfRange$1(this,o);return this.pos+=o,tt===rt?new Uint8Array(0):this.buf.subarray(tt,rt)}string(){const o=this.bytes();return read$7(o,0,o.length)}skip(o){if(typeof o=="number"){if(this.pos+o>this.len)throw indexOutOfRange$1(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${o} at offset ${this.pos}`)}return this}readLongVarint(){const o=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;tt<5;++tt)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const o=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(o,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const o=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$6(o),o}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function createReader(et){return new Uint8ArrayReader(et instanceof Uint8Array?et:et.subarray())}function decodeMessage(et,o,tt){const rt=createReader(et);return o.decode(rt,void 0,tt)}function allocUnsafe$i(et=0){return new Uint8Array(et)}function coerce$k(et){if(et instanceof Uint8Array&&et.constructor.name==="Uint8Array")return et;if(et instanceof ArrayBuffer)return new Uint8Array(et);if(ArrayBuffer.isView(et))return new Uint8Array(et.buffer,et.byteOffset,et.byteLength);throw new Error("Unknown type, must be binary type")}function fromString$w(et){return new TextEncoder().encode(et)}function toString$x(et){return new TextDecoder().decode(et)}function base$l(et,o){if(et.length>=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$l=base$l,_brrp__multiformats_scope_baseX$k=src$l;let Encoder$m=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$m=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$m(this,o)}},ComposedDecoder$k=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$m(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$m(et,o){return new ComposedDecoder$k({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$k=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$m(o,tt,rt),this.decoder=new Decoder$m(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$n({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$k(et,o,tt,rt)}function baseX$k({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$k(tt,et);return from$n({prefix:o,name:et,encode:rt,decode:ot=>coerce$k(nt(ot))})}function decode$Y(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$O(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<(et[tt]=o,et),[]),alphabetCharsToBytes$g=alphabet$g.reduce((et,o,tt)=>{const rt=o.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${o}`);return et[rt]=tt,et},[]);function encode$N(et){return et.reduce((o,tt)=>(o+=alphabetBytesToChars$g[tt],o),"")}function decode$X(et){const o=[];for(const tt of et){const rt=tt.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${tt}`);const nt=alphabetCharsToBytes$g[rt];if(nt==null)throw new Error(`Non-base256emoji character: ${tt}`);o.push(nt)}return new Uint8Array(o)}const base256emoji$w=from$n({prefix:"🚀",name:"base256emoji",encode:encode$N,decode:decode$X}),base256emoji$x=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$w},Symbol.toStringTag,{value:"Module"})),base32$A=rfc4648$j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$g=rfc4648$j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$g=rfc4648$j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$g=rfc4648$j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$g=rfc4648$j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$g=rfc4648$j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$g=rfc4648$j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$g=rfc4648$j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$g=rfc4648$j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$B=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$A,base32hex:base32hex$g,base32hexpad:base32hexpad$g,base32hexpadupper:base32hexpadupper$g,base32hexupper:base32hexupper$g,base32pad:base32pad$g,base32padupper:base32padupper$g,base32upper:base32upper$g,base32z:base32z$g},Symbol.toStringTag,{value:"Module"})),base36$x=baseX$k({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$g=baseX$k({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$y=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$x,base36upper:base36upper$g},Symbol.toStringTag,{value:"Module"})),base58btc$k=baseX$k({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$g=baseX$k({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$g=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$k,base58flickr:base58flickr$g},Symbol.toStringTag,{value:"Module"})),base64$z=rfc4648$j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$g=rfc4648$j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$h=rfc4648$j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$g=rfc4648$j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$A=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$z,base64pad:base64pad$g,base64url:base64url$h,base64urlpad:base64urlpad$g},Symbol.toStringTag,{value:"Module"})),base8$w=rfc4648$j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$x=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$w},Symbol.toStringTag,{value:"Module"})),identity$i=from$n({prefix:"\0",name:"identity",encode:et=>toString$x(et),decode:et=>fromString$w(et)}),identityBase$g=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$i},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$g={...identityBase$g,...base2$x,...base8$x,...base10$x,...base16$x,...base32$B,...base36$y,...base58$g,...base64$A,...base256emoji$x};function createCodec$h(et,o,tt,rt){return{name:et,prefix:o,encoder:{name:et,prefix:o,encode:tt},decoder:{decode:rt}}}const string$k=createCodec$h("utf8","u",et=>"u"+new TextDecoder("utf8").decode(et),et=>new TextEncoder().encode(et.substring(1))),ascii$g=createCodec$h("ascii","a",et=>{let o="a";for(let tt=0;tt{et=et.substring(1);const o=allocUnsafe$i(et.length);for(let tt=0;tt4096)return allocUnsafe$i(it);nt+it>8192&&(rt=allocUnsafe$i(8192),nt=0);const st=rt.subarray(nt,nt+=it);return nt&7&&(nt=(nt|7)+1),st}}let Op$1=class{constructor(o,tt,rt){wt(this,"fn");wt(this,"len");wt(this,"next");wt(this,"val");this.fn=o,this.len=tt,this.next=void 0,this.val=rt}};function noop$2(){}let State$1=class{constructor(o){wt(this,"head");wt(this,"tail");wt(this,"len");wt(this,"next");this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}};const bufferPool=pool$1();function alloc$7(et){return globalThis.Buffer!=null?allocUnsafe$i(et):bufferPool(et)}class Uint8ArrayWriter{constructor(){wt(this,"len");wt(this,"head");wt(this,"tail");wt(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(o,tt,rt){return this.tail=this.tail.next=new Op$1(o,tt,rt),this.len+=tt,this}uint32(o){return this.len+=(this.tail=this.tail.next=new VarintOp$1((o=o>>>0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this}int32(o){return o<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(o)):this.uint32(o)}sint32(o){return this.uint32((o<<1^o>>31)>>>0)}uint64(o){const tt=LongBits$2.fromBigInt(o);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(o){return this._push(encodeUint8Array,encodingLength$6(o),o)}uint64String(o){return this.uint64(BigInt(o))}int64(o){return this.uint64(o)}int64Number(o){return this.uint64Number(o)}int64String(o){return this.uint64String(o)}sint64(o){const tt=LongBits$2.fromBigInt(o).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(o){const tt=LongBits$2.fromNumber(o).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(o){return this.sint64(BigInt(o))}bool(o){return this._push(writeByte$1,1,o?1:0)}fixed32(o){return this._push(writeFixed32$1,4,o>>>0)}sfixed32(o){return this.fixed32(o)}fixed64(o){const tt=LongBits$2.fromBigInt(o);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(o){const tt=LongBits$2.fromNumber(o);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(o){return this.fixed64(BigInt(o))}sfixed64(o){return this.fixed64(o)}sfixed64Number(o){return this.fixed64Number(o)}sfixed64String(o){return this.fixed64String(o)}float(o){return this._push(writeFloatLE,4,o)}double(o){return this._push(writeDoubleLE,8,o)}bytes(o){const tt=o.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,o)}string(o){const tt=length$6(o);return tt!==0?this.uint32(tt)._push(write$2,tt,o):this._push(writeByte$1,1,0)}fork(){return this.states=new State$1(this),this.head=this.tail=new Op$1(noop$2,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op$1(noop$2,0,0),this.len=0),this}ldelim(){const o=this.head,tt=this.tail,rt=this.len;return this.reset().uint32(rt),rt!==0&&(this.tail.next=o.next,this.tail=tt,this.len+=rt),this}finish(){let o=this.head.next;const tt=alloc$7(this.len);let rt=0;for(;o!=null;)o.fn(o.val,tt,rt),rt+=o.len,o=o.next;return tt}}function writeByte$1(et,o,tt){o[tt]=et&255}function writeVarint32$1(et,o,tt){for(;et>127;)o[tt++]=et&127|128,et>>>=7;o[tt]=et}let VarintOp$1=class extends Op$1{constructor(tt,rt){super(writeVarint32$1,tt,rt);wt(this,"next");this.next=void 0}};function writeVarint64$1(et,o,tt){for(;et.hi!==0;)o[tt++]=et.lo&127|128,et.lo=(et.lo>>>7|et.hi<<25)>>>0,et.hi>>>=7;for(;et.lo>127;)o[tt++]=et.lo&127|128,et.lo=et.lo>>>7;o[tt++]=et.lo}function writeFixed32$1(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}function writeBytes$1(et,o,tt){o.set(et,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(et){const o=et.length>>>0;return this.uint32(o),o>0&&this._push(writeBytesBuffer,o,et),this},Uint8ArrayWriter.prototype.string=function(et){const o=globalThis.Buffer.byteLength(et);return this.uint32(o),o>0&&this._push(writeStringBuffer$1,o,et),this});function writeBytesBuffer(et,o,tt){o.set(et,tt)}function writeStringBuffer$1(et,o,tt){et.length<40?write$2(et,o,tt):o.utf8Write!=null?o.utf8Write(et,tt):o.set(fromString$v(et),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(et,o){const tt=createWriter();return o.encode(et,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(et){et[et.VARINT=0]="VARINT",et[et.BIT64=1]="BIT64",et[et.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",et[et.START_GROUP=3]="START_GROUP",et[et.END_GROUP=4]="END_GROUP",et[et.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec$g(et,o,tt,rt){return{name:et,type:o,encode:tt,decode:rt}}function enumeration(et){function o(nt){if(et[nt.toString()]==null)throw new Error("Invalid enum value");return et[nt]}const tt=function(ot,it){const st=o(ot);it.int32(st)},rt=function(ot){const it=ot.int32();return o(it)};return createCodec$g("enum",CODEC_TYPES.VARINT,tt,rt)}function message$1(et,o){return createCodec$g("message",CODEC_TYPES.LENGTH_DELIMITED,et,o)}class MaxLengthError extends Error{constructor(){super(...arguments);wt(this,"code","ERR_MAX_LENGTH");wt(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);wt(this,"code","ERR_MAX_SIZE");wt(this,"name","MaxSizeError")}}function alloc$6(et=0){return globalThis.Buffer!=null&&globalThis.Buffer.alloc!=null?globalThis.Buffer.alloc(et):new Uint8Array(et)}function allocUnsafe$h(et=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(et):new Uint8Array(et)}var RateLimitProof$4;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$4.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(et){(function(tt){let rt;tt.codec=()=>(rt==null&&(rt=message$1((nt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),nt.contentTopic!=null&&nt.contentTopic!==""&&(ot.uint32(10),ot.string(nt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(nt,ot,it={})=>{const st={contentTopic:""},at=ot==null?nt.len:nt.pos+ot;for(;nt.pos>>3){case 1:{st.contentTopic=nt.string();break}default:{nt.skipType(ct&7);break}}}return st})),rt),tt.encode=nt=>encodeMessage(nt,tt.codec()),tt.decode=(nt,ot)=>decodeMessage(nt,tt.codec(),ot)})(et.ContentFilter||(et.ContentFilter={}));let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(rt.uint32(8),rt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(rt.uint32(18),rt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)rt.uint32(26),et.ContentFilter.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=nt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===nt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(et.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.messages!=null)for(const ot of tt.messages)rt.uint32(10),WakuMessage$3.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={messages:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{if(((st=nt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===nt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessage$3.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.request!=null&&(rt.uint32(18),FilterRequest.codec().encode(tt.request,rt)),tt.push!=null&&(rt.uint32(26),MessagePush$1.codec().encode(tt.push,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$3.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(et){let o;(function(nt){nt.SUBSCRIBER_PING="SUBSCRIBER_PING",nt.SUBSCRIBE="SUBSCRIBE",nt.UNSUBSCRIBE="UNSUBSCRIBE",nt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(o=et.FilterSubscribeType||(et.FilterSubscribeType={}));let tt;(function(nt){nt[nt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",nt[nt.SUBSCRIBE=1]="SUBSCRIBE",nt[nt.UNSUBSCRIBE=2]="UNSUBSCRIBE",nt[nt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(nt){nt.codec=()=>enumeration(tt)}(o=et.FilterSubscribeType||(et.FilterSubscribeType={}));let rt;et.codec=()=>(rt==null&&(rt=message$1((nt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),nt.requestId!=null&&nt.requestId!==""&&(ot.uint32(10),ot.string(nt.requestId)),nt.filterSubscribeType!=null&&tt[nt.filterSubscribeType]!==0&&(ot.uint32(16),et.FilterSubscribeType.codec().encode(nt.filterSubscribeType,ot)),nt.pubsubTopic!=null&&(ot.uint32(82),ot.string(nt.pubsubTopic)),nt.contentTopics!=null)for(const st of nt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(nt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:o.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?nt.len:nt.pos+ot;for(;nt.pos>>3){case 1:{st.requestId=nt.string();break}case 2:{st.filterSubscribeType=et.FilterSubscribeType.codec().decode(nt);break}case 10:{st.pubsubTopic=nt.string();break}case 11:{if(((ct=it.limits)==null?void 0:ct.contentTopics)!=null&&st.contentTopics.length===it.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');st.contentTopics.push(nt.string());break}default:{nt.skipType(lt&7);break}}}return st})),rt),et.encode=nt=>encodeMessage(nt,et.codec()),et.decode=(nt,ot)=>decodeMessage(nt,et.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(rt.uint32(80),rt.uint32(tt.statusCode)),tt.statusDesc!=null&&(rt.uint32(90),rt.string(tt.statusDesc)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={requestId:"",statusCode:0},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.wakuMessage!=null&&(rt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,rt)),tt.pubsubTopic!=null&&(rt.uint32(18),rt.string(tt.pubsubTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$2.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(rt.uint32(10),rt.string(tt.pubsubTopic)),tt.message!=null&&(rt.uint32(18),WakuMessage$1.codec().encode(tt.message,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={pubsubTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushRequest||(PushRequest={}));var PushResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(rt.uint32(8),rt.bool(tt.isSuccess)),tt.info!=null&&(rt.uint32(18),rt.string(tt.info)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={isSuccess:!1},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.isSuccess=tt.bool();break}case 2:{ot.info=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushResponse||(PushResponse={}));var PushRpc$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.request!=null&&(rt.uint32(18),PushRequest.codec().encode(tt.request,rt)),tt.response!=null&&(rt.uint32(26),PushResponse.codec().encode(tt.response,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushRpc$1||(PushRpc$1={}));var RateLimitProof$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$1.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.messageHash!=null&&(rt.uint32(10),rt.bytes(tt.messageHash)),tt.message!=null&&(rt.uint32(18),WakuMessage.codec().encode(tt.message,rt)),tt.pubsubTopic!=null&&(rt.uint32(26),rt.string(tt.pubsubTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(rt.uint32(16),rt.bool(tt.includeData)),tt.pubsubTopic!=null&&(rt.uint32(82),rt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)rt.uint32(90),rt.string(ot);if(tt.timeStart!=null&&(rt.uint32(96),rt.sint64(tt.timeStart)),tt.timeEnd!=null&&(rt.uint32(104),rt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)rt.uint32(162),rt.bytes(ot);tt.paginationCursor!=null&&(rt.uint32(410),rt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(rt.uint32(416),rt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(rt.uint32(424),rt.uint64(tt.paginationLimit)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.includeData=tt.bool();break}case 10:{ot.pubsubTopic=tt.string();break}case 11:{if(((st=nt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===nt.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');ot.contentTopics.push(tt.string());break}case 12:{ot.timeStart=tt.sint64();break}case 13:{ot.timeEnd=tt.sint64();break}case 20:{if(((at=nt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===nt.limits.messageHashes)throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');ot.messageHashes.push(tt.bytes());break}case 51:{ot.paginationCursor=tt.bytes();break}case 52:{ot.paginationForward=tt.bool();break}case 53:{ot.paginationLimit=tt.uint64();break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.statusCode!=null&&(rt.uint32(80),rt.uint32(tt.statusCode)),tt.statusDesc!=null&&(rt.uint32(90),rt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)rt.uint32(162),WakuMessageKeyValue.codec().encode(ot,rt);tt.paginationCursor!=null&&(rt.uint32(410),rt.bytes(tt.paginationCursor)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:"",messages:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}case 20:{if(((st=nt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===nt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessageKeyValue.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.enr!=null&&(rt.uint32(10),rt.bytes(tt.enr)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.numPeers!=null&&(rt.uint32(8),rt.uint64(tt.numPeers)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)rt.uint32(10),PeerInfo.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={peerInfos:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{if(((st=nt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===nt.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');ot.peerInfos.push(PeerInfo.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.query!=null&&(rt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,rt)),tt.response!=null&&(rt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.clusterId!=null&&(rt.uint32(8),rt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)rt.uint32(16),rt.uint32(ot);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={shards:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=nt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===nt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.clusterId!=null&&(rt.uint32(8),rt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)rt.uint32(16),rt.uint32(ot);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={shards:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=nt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===nt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMetadataResponse||(WakuMetadataResponse={}));function isDefined(et){return!!et}function groupByContentTopic(et){const o=new Map;return et.forEach(tt=>{let rt=o.get(tt.contentTopic);rt||(o.set(tt.contentTopic,[]),rt=o.get(tt.contentTopic)),rt.push(tt)}),o}const FRAME_RATE=60;async function toAsyncIterator(et,o,tt){const rt=FRAME_RATE,nt=[];let ot;ot=await et.subscribeWithUnsubscribe(o,lt=>{nt.push(lt)});const it=Number.isInteger(tt==null?void 0:tt.timeoutMs),st=0,at=Date.now();async function*ct(){for(;;){if(it&&Date.now()-at>=st)return;await wait(rt);const lt=nt.shift();if(!ot&&nt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(et){return new Promise(o=>{setTimeout(o,et)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(et,o){const tt=await et.toWire(o);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=et=>et.length/MB<=SIZE_CAP_IN_MB;var Protocols;(function(et){et.Relay="relay",et.Store="store",et.LightPush="lightpush",et.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError$1;(function(et){et.GENERIC_FAIL="Generic error",et.ENCODE_FAILED="Failed to encode",et.DECODE_FAILED="Failed to decode",et.EMPTY_PAYLOAD="Payload is empty",et.SIZE_TOO_BIG="Size is too big",et.TOPIC_NOT_CONFIGURED="Topic not configured",et.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",et.INVALID_DECODER_TOPICS="Invalid decoder topics",et.NO_PEER_AVAILABLE="No peer available",et.NO_STREAM_AVAILABLE="No stream available",et.NO_RESPONSE="No response received",et.REMOTE_PEER_REJECTED="Remote peer rejected",et.REQUEST_TIMEOUT="Request timeout",et.RLN_IDENTITY_MISSING="Identity credentials are not set",et.RLN_MEMBERSHIP_INDEX="Membership index is not set",et.RLN_LIMIT_MISSING="User message limit is not set",et.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags;(function(et){et.BOOTSTRAP="bootstrap",et.PEER_EXCHANGE="peer-exchange",et.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(et){et.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",et.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",et.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",et.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(et){et.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents||(EConnectionStateEvents={}));const DNS_DISCOVERY_TAG="@waku/bootstrap",DEFAULT_CLUSTER_ID=1,DefaultShardInfo={clusterId:DEFAULT_CLUSTER_ID,shards:[0,1,2,3,4,5,6,7,8]},DefaultNetworkConfig=DefaultShardInfo;var HealthStatus;(function(et){et.Unhealthy="Unhealthy",et.MinimallyHealthy="MinimallyHealthy",et.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function coerce$j(et){if(et instanceof Uint8Array&&et.constructor.name==="Uint8Array")return et;if(et instanceof ArrayBuffer)return new Uint8Array(et);if(ArrayBuffer.isView(et))return new Uint8Array(et.buffer,et.byteOffset,et.byteLength);throw new Error("Unknown type, must be binary type")}function fromString$u(et){return new TextEncoder().encode(et)}function toString$w(et){return new TextDecoder().decode(et)}function base$k(et,o){if(et.length>=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$k=base$k,_brrp__multiformats_scope_baseX$j=src$k;let Encoder$l=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$l=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$l(this,o)}},ComposedDecoder$j=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$l(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$l(et,o){return new ComposedDecoder$j({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$j=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$l(o,tt,rt),this.decoder=new Decoder$l(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$m({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$j(et,o,tt,rt)}function baseX$j({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$j(tt,et);return from$m({prefix:o,name:et,encode:rt,decode:ot=>coerce$j(nt(ot))})}function decode$W(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$M(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<(et[tt]=o,et),[]),alphabetCharsToBytes$f=alphabet$f.reduce((et,o,tt)=>{const rt=o.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${o}`);return et[rt]=tt,et},[]);function encode$L(et){return et.reduce((o,tt)=>(o+=alphabetBytesToChars$f[tt],o),"")}function decode$V(et){const o=[];for(const tt of et){const rt=tt.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${tt}`);const nt=alphabetCharsToBytes$f[rt];if(nt==null)throw new Error(`Non-base256emoji character: ${tt}`);o.push(nt)}return new Uint8Array(o)}const base256emoji$u=from$m({prefix:"🚀",name:"base256emoji",encode:encode$L,decode:decode$V}),base256emoji$v=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$u},Symbol.toStringTag,{value:"Module"})),base32$y=rfc4648$i({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$f=rfc4648$i({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$f=rfc4648$i({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$f=rfc4648$i({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$f=rfc4648$i({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$f=rfc4648$i({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$f=rfc4648$i({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$f=rfc4648$i({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$f=rfc4648$i({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$z=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$y,base32hex:base32hex$f,base32hexpad:base32hexpad$f,base32hexpadupper:base32hexpadupper$f,base32hexupper:base32hexupper$f,base32pad:base32pad$f,base32padupper:base32padupper$f,base32upper:base32upper$f,base32z:base32z$f},Symbol.toStringTag,{value:"Module"})),base36$v=baseX$j({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$f=baseX$j({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$w=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$v,base36upper:base36upper$f},Symbol.toStringTag,{value:"Module"})),base58btc$j=baseX$j({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$f=baseX$j({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$f=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$j,base58flickr:base58flickr$f},Symbol.toStringTag,{value:"Module"})),base64$x=rfc4648$i({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$f=rfc4648$i({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$g=rfc4648$i({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$f=rfc4648$i({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$y=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$x,base64pad:base64pad$f,base64url:base64url$g,base64urlpad:base64urlpad$f},Symbol.toStringTag,{value:"Module"})),base8$u=rfc4648$i({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$v=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$u},Symbol.toStringTag,{value:"Module"})),identity$h=from$m({prefix:"\0",name:"identity",encode:et=>toString$w(et),decode:et=>fromString$u(et)}),identityBase$f=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$h},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$f={...identityBase$f,...base2$v,...base8$v,...base10$v,...base16$v,...base32$z,...base36$w,...base58$f,...base64$y,...base256emoji$v};function allocUnsafe$g(et=0){return new Uint8Array(et)}function createCodec$f(et,o,tt,rt){return{name:et,prefix:o,encoder:{name:et,prefix:o,encode:tt},decoder:{decode:rt}}}const string$j=createCodec$f("utf8","u",et=>"u"+new TextDecoder("utf8").decode(et),et=>new TextEncoder().encode(et.substring(1))),ascii$f=createCodec$f("ascii","a",et=>{let o="a";for(let tt=0;tt{et=et.substring(1);const o=allocUnsafe$g(et.length);for(let tt=0;tttoString$v(et,"base16"),bytesToUtf8=et=>toString$v(et,"utf8"),utf8ToBytes$1=et=>fromString$t(et,"utf8");function concat$5(et,o){const tt=et.reduce((ot,it)=>ot+it.length,0),rt=new Uint8Array(tt);let nt=0;for(const ot of et)rt.set(ot,nt),nt+=ot.length;return rt}function isStaticSharding(et){return"clusterId"in et&&"shards"in et&&!("contentTopics"in et)}function isAutoSharding(et){return"contentTopics"in et}function derivePubsubTopicsFromNetworkConfig(et){if(isStaticSharding(et)){if(et.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(et)}else if(isAutoSharding(et)){if(et.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return et.contentTopics.map(o=>contentTopicToPubsubTopic(o,et.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=et=>{if(et.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${et.clusterId??DEFAULT_CLUSTER_ID}/${et.shard}`},shardInfoToPubsubTopics=et=>{if("contentTopics"in et&&et.contentTopics)return Array.from(new Set(et.contentTopics.map(o=>contentTopicToPubsubTopic(o,et.clusterId))));if("shards"in et){if(et.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(et.shards.map(o=>`/waku/2/rs/${et.clusterId??DEFAULT_CLUSTER_ID}/${o}`)))}else{if("application"in et&&"version"in et)return[contentTopicToPubsubTopic(`/${et.application}/${et.version}/default/default`,et.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=et=>{const o=et.split("/");if(o.length!=6||o[1]!=="waku"||o[2]!=="2"||o[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(o[4]),rt=parseInt(o[5]);if(isNaN(tt)||isNaN(rt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:rt}},pubsubTopicsToShardInfo=et=>{const o=new Set,tt=new Set;for(const ot of et){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);o.add(`${it}:${st}`),tt.add(it)}if(o.size===0)throw new Error("No valid pubsub topics provided");if(tt.size>1)throw new Error("Pubsub topics from multiple cluster IDs are not supported");const rt=tt.values().next().value,nt=Array.from(o).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:rt,shards:nt}};function ensurePubsubTopicIsConfigured(et,o){if(!o.includes(et))throw new Error(`Pubsub topic ${et} has not been configured on this instance. Configured topics are: ${o}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(et){const o=et.split("/");if(o.length<5||o.length>6)throw Error("Content topic format is invalid");let tt=0;if(o.length==6){if(tt=parseInt(o[1]),isNaN(tt))throw new Error("Invalid generation field in content topic");if(tt>0)throw new Error("Generation greater than 0 is not supported")}const rt=o.splice(-4);if(rt[0].length==0)throw new Error("Application field cannot be empty");if(rt[1].length==0)throw new Error("Version field cannot be empty");if(rt[2].length==0)throw new Error("Topic name field cannot be empty");if(rt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:rt[0],version:rt[1],topicName:rt[2],encoding:rt[3]}}function contentTopicToShardIndex(et,o=8){const{application:tt,version:rt}=ensureValidContentTopic(et),nt=sha256$3(concat$5([utf8ToBytes$1(tt),utf8ToBytes$1(rt)])),ot=new DataView(nt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(o))}function contentTopicToPubsubTopic(et,o=DEFAULT_CLUSTER_ID,tt=8){if(!et)throw Error("Content topic must be specified");const rt=contentTopicToShardIndex(et,tt);return`/waku/2/rs/${o}/${rt}`}function determinePubsubTopic(et,o){return typeof o=="string"?o:(o==null?void 0:o.shard)!==void 0?singleShardInfoToPubsubTopic(o):contentTopicToPubsubTopic(et,(o==null?void 0:o.clusterId)??DEFAULT_CLUSTER_ID)}const decodeRelayShard=et=>{if(et=new Uint8Array(et),et.length<3)throw new Error("Insufficient data");const o=new DataView(et.buffer),tt=o.getUint16(0),rt=[];if(et.length===130)for(let nt=0;nt<1024;nt++){const ot=Math.floor(nt/8)+2,it=7-nt%8;o.getUint8(ot)&1<=et.length)throw new Error("Unexpected end of data");rt.push(o.getUint16(it))}}return{clusterId:tt,shards:rt}},encodeRelayShard=et=>{const{clusterId:o,shards:tt}=et,rt=tt.length>=64?130:3+2*tt.length,nt=new ArrayBuffer(rt),ot=new DataView(nt);if(ot.setUint16(0,o),tt.length>=64)for(const it of tt){const st=Math.floor(it/8)+2,at=7-it%8;ot.setUint8(st,ot.getUint8(st)|1<tt.toString().includes("ws")||tt.toString().includes("wss"));if(!o)throw new Error("No ws multiaddr found in the given addresses");return o}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var et=1e3,o=et*60,tt=o*60,rt=tt*24,nt=rt*7,ot=rt*365.25;ms$1=function(lt,dt){dt=dt||{};var ht=typeof lt;if(ht==="string"&<.length>0)return it(lt);if(ht==="number"&&isFinite(lt))return dt.long?at(lt):st(lt);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(lt))};function it(lt){if(lt=String(lt),!(lt.length>100)){var dt=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(lt);if(dt){var ht=parseFloat(dt[1]),mt=(dt[2]||"ms").toLowerCase();switch(mt){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*nt;case"days":case"day":case"d":return ht*rt;case"hours":case"hour":case"hrs":case"hr":case"h":return ht*tt;case"minutes":case"minute":case"mins":case"min":case"m":return ht*o;case"seconds":case"second":case"secs":case"sec":case"s":return ht*et;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=rt?Math.round(lt/rt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=o?Math.round(lt/o)+"m":dt>=et?Math.round(lt/et)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=rt?ct(lt,dt,rt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=o?ct(lt,dt,o,"minute"):dt>=et?ct(lt,dt,et,"second"):lt+" ms"}function ct(lt,dt,ht,mt){var ft=dt>=ht*1.5;return Math.round(lt/ht)+" "+mt+(ft?"s":"")}return ms$1}function setup$1(et){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=nt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(et).forEach(lt=>{tt[lt]=et[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function o(lt){let dt=0;for(let ht=0;ht{if(Ct==="%%")return"%";vt++;const At=tt.formatters[St];if(typeof At=="function"){const kt=yt[vt];Ct=At.call(gt,kt),yt.splice(vt,1),vt--}return Ct}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return pt.namespace=lt,pt.useColors=tt.useColors(),pt.color=tt.selectColor(lt),pt.extend=rt,pt.destroy=tt.destroy,Object.defineProperty(pt,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(mt!==tt.namespaces&&(mt=tt.namespaces,ft=tt.enabled(lt)),ft),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(pt),pt}function rt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function nt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),mt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt{let lt=!1;return()=>{lt||(lt=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),o.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function nt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let lt;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(lt=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(lt[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ot(lt){if(lt[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+lt[0]+(this.useColors?"%c ":" ")+"+"+et.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,mt=0;lt[0].replace(/%[a-zA-Z%]/g,ft=>{ft!=="%%"&&(ht++,ft==="%c"&&(mt=ht))}),lt.splice(mt,0,dt)}o.log=console.debug||console.log||(()=>{});function it(lt){try{lt?o.storage.setItem("debug",lt):o.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=o.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=rt.DEBUG),lt}function at(){try{return localStorage}catch{}}et.exports=common$1(o);const{formatters:ct}=et.exports;ct.j=function(lt){try{return JSON.stringify(lt)}catch(dt){return"[UnexpectedJSONParseError]: "+dt.message}}})(browser,browser.exports);var browserExports=browser.exports;const debug=getDefaultExportFromCjs(browserExports),APP_NAME="waku";let Logger$1=class _i{constructor(o){wt(this,"_info");wt(this,"_warn");wt(this,"_error");this._info=debug(_i.createDebugNamespace("info",o)),this._warn=debug(_i.createDebugNamespace("warn",o)),this._error=debug(_i.createDebugNamespace("error",o))}static createDebugNamespace(o,tt){return tt?`${APP_NAME}:${o}:${tt}`:`${APP_NAME}:${o}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(o,...tt){const rt=this[o];rt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(o,tt){wt(this,"pubsubTopic");wt(this,"proto");this.pubsubTopic=o,this.proto=tt}get ephemeral(){return!!this.proto.ephemeral}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const o=this.proto.timestamp/OneMillion;return new Date(Number(o))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$k=class{constructor(o,tt=!1,rt,nt){wt(this,"contentTopic");wt(this,"ephemeral");wt(this,"pubsubTopic");wt(this,"metaSetter");if(this.contentTopic=o,this.ephemeral=tt,this.pubsubTopic=rt,this.metaSetter=nt,!o||o==="")throw new Error("Content topic must be specified")}async toWire(o){return WakuMessage$4.encode(await this.toProtoObj(o))}async toProtoObj(o){const tt=o.timestamp??new Date,rt={payload:o.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:o.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const nt=this.metaSetter(rt);return{...rt,meta:nt}}return rt}};function createEncoder({pubsubTopic:et,pubsubTopicShardInfo:o,contentTopic:tt,ephemeral:rt,metaSetter:nt}){return new Encoder$k(tt,rt,determinePubsubTopic(tt,et??o),nt)}let Decoder$k=class{constructor(o,tt){wt(this,"pubsubTopic");wt(this,"contentTopic");if(this.pubsubTopic=o,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(o){const tt=WakuMessage$4.decode(o);return Promise.resolve({payload:tt.payload,contentTopic:tt.contentTopic,version:tt.version??void 0,timestamp:tt.timestamp??void 0,meta:tt.meta??void 0,rateLimitProof:tt.rateLimitProof??void 0,ephemeral:tt.ephemeral??!1})}async fromProtoObj(o,tt){return tt.version??Version!==0?(log$o.error("Failed to decode due to incorrect version, expected:",Version,", actual:",tt.version),Promise.resolve(void 0)):new DecodedMessage(o,tt)}};function createDecoder(et,o){return new Decoder$k(determinePubsubTopic(et,o),et)}function isAsyncIterable$8(et){return et[Symbol.asyncIterator]!=null}function all$2(et){if(isAsyncIterable$8(et))return(async()=>{const tt=[];for await(const rt of et)tt.push(rt);return tt})();const o=[];for(const tt of et)o.push(tt);return o}function alloc$5(et=0){return new Uint8Array(et)}function allocUnsafe$f(et=0){return new Uint8Array(et)}function asUint8Array$3(et){return et}function concat$4(et,o){o==null&&(o=et.reduce((nt,ot)=>nt+ot.length,0));const tt=allocUnsafe$f(o);let rt=0;for(const nt of et)tt.set(nt,rt),rt+=nt.length;return tt}function equals$f(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(o)}*[(Zs=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...o){this.appendAll(o)}appendAll(o){let tt=0;for(const rt of o)if(rt instanceof Uint8Array)tt+=rt.byteLength,this.bufs.push(rt);else if(isUint8ArrayList(rt))tt+=rt.byteLength,this.bufs.push(...rt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...o){this.prependAll(o)}prependAll(o){let tt=0;for(const rt of o.reverse())if(rt instanceof Uint8Array)tt+=rt.byteLength,this.bufs.unshift(rt);else if(isUint8ArrayList(rt))tt+=rt.byteLength,this.bufs.unshift(...rt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(o){const tt=findBufAndOffset(this.bufs,o);return tt.buf[tt.index]}set(o,tt){const rt=findBufAndOffset(this.bufs,o);rt.buf[rt.index]=tt}write(o,tt=0){if(o instanceof Uint8Array)for(let rt=0;rt0;)if(o>=this.bufs[0].byteLength)o-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(o),this.length-=o;break}}}slice(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt);return concat$4(rt,nt)}subarray(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt);return rt.length===1?rt[0]:concat$4(rt,nt)}sublist(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt),ot=new Uint8ArrayList;return ot.length=nt,ot.bufs=[...rt],ot}_subList(o,tt){if(o=o??0,tt=tt??this.length,o<0&&(o=this.length+o),tt<0&&(tt=this.length+tt),o<0||tt>this.length)throw new RangeError("index is out of bounds");if(o===tt)return{bufs:[],length:0};if(o===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const rt=[];let nt=0;for(let ot=0;ot=at)continue;const ct=o>=st&&ost&&tt<=at;if(ct&<){if(o===st&&tt===at){rt.push(it);break}const dt=o-st;rt.push(it.subarray(dt,dt+(tt-o)));break}if(ct){if(o===0){rt.push(it);continue}rt.push(it.subarray(o-st));continue}if(lt){if(tt===at){rt.push(it);break}rt.push(it.subarray(0,tt-st));break}rt.push(it)}return{bufs:rt,length:tt-o}}indexOf(o,tt=0){if(!isUint8ArrayList(o)&&!(o instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const rt=o instanceof Uint8Array?o:o.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),o.length===0)return tt>this.length?this.length:tt;const nt=rt.byteLength;if(nt===0)throw new TypeError("search must be at least 1 byte long");const ot=256,it=new Int32Array(ot);for(let dt=0;dt=0;ht--){const mt=this.get(dt+ht);if(rt[ht]!==mt){lt=Math.max(1,ht-st[mt]);break}}if(lt===0)return dt}return-1}getInt8(o){const tt=this.subarray(o,o+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(o,tt){const rt=allocUnsafe$f(1);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt8(0,tt),this.write(rt,o)}getInt16(o,tt){const rt=this.subarray(o,o+2);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getInt16(0,tt)}setInt16(o,tt,rt){const nt=alloc$5(2);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt16(0,tt,rt),this.write(nt,o)}getInt32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getInt32(0,tt)}setInt32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt32(0,tt,rt),this.write(nt,o)}getBigInt64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getBigInt64(0,tt)}setBigInt64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setBigInt64(0,tt,rt),this.write(nt,o)}getUint8(o){const tt=this.subarray(o,o+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(o,tt){const rt=allocUnsafe$f(1);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint8(0,tt),this.write(rt,o)}getUint16(o,tt){const rt=this.subarray(o,o+2);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getUint16(0,tt)}setUint16(o,tt,rt){const nt=alloc$5(2);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint16(0,tt,rt),this.write(nt,o)}getUint32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getUint32(0,tt)}setUint32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint32(0,tt,rt),this.write(nt,o)}getBigUint64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getBigUint64(0,tt)}setBigUint64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setBigUint64(0,tt,rt),this.write(nt,o)}getFloat32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getFloat32(0,tt)}setFloat32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat32(0,tt,rt),this.write(nt,o)}getFloat64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getFloat64(0,tt)}setFloat64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat64(0,tt,rt),this.write(nt,o)}equals(o){if(o==null||!(o instanceof Uint8ArrayList)||o.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttnt+ot.byteLength,0)),rt.length=tt,rt}}function allocUnsafe$e(et=0){return new Uint8Array(et)}function isAsyncIterable$7(et){return et[Symbol.asyncIterator]!=null}const defaultEncoder=et=>{const o=encodingLength$6(et),tt=allocUnsafe$e(o);return encode$P(et,tt),defaultEncoder.bytes=o,tt};defaultEncoder.bytes=0;function encode$K(et,o){o=o??{};const tt=o.lengthEncoder??defaultEncoder;function*rt(nt){const ot=tt(nt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,nt instanceof Uint8Array?yield nt:yield*nt}return isAsyncIterable$7(et)?async function*(){for await(const nt of et)yield*rt(nt)}():function*(){for(const nt of et)yield*rt(nt)}()}encode$K.single=(et,o)=>{o=o??{};const tt=o.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(et.byteLength),et)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidMessageLengthError");wt(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidDataLengthError");wt(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidDataLengthLengthError");wt(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","UnexpectedEOFError");wt(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(et){et[et.LENGTH=0]="LENGTH",et[et.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=et=>{const o=decode$Z(et);return defaultDecoder.bytes=encodingLength$6(o),o};defaultDecoder.bytes=0;function decode$U(et,o){const tt=new Uint8ArrayList;let rt=ReadMode.LENGTH,nt=-1;const ot=(o==null?void 0:o.lengthDecoder)??defaultDecoder,it=(o==null?void 0:o.maxLengthLength)??MAX_LENGTH_LENGTH,st=(o==null?void 0:o.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(rt===ReadMode.LENGTH)try{if(nt=ot(tt),nt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(nt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(o==null?void 0:o.onLength)!=null&&o.onLength(nt),rt=ReadMode.DATA}catch(ct){if(ct instanceof RangeError){if(tt.byteLength>it)throw new InvalidDataLengthLengthError$1("Message length length too long");break}throw ct}if(rt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of et)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$U.fromReader=(et,o)=>{let tt=1;const rt=async function*(){for(;;)try{const{done:ot,value:it}=await et.next(tt);if(ot===!0)return;it!=null&&(yield it)}catch(ot){if(ot.code==="ERR_UNDER_READ")return{done:!0,value:null};throw ot}finally{tt=1}}();return decode$U(rt,{...o??{},onLength:ot=>{tt=ot}})};function pDefer(){const et={};return et.promise=new Promise((o,tt)=>{et.resolve=o,et.reject=tt}),et}class FixedFIFO{constructor(o){wt(this,"buffer");wt(this,"mask");wt(this,"top");wt(this,"btm");wt(this,"next");if(!(o>0)||o-1&o)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(o),this.mask=o-1,this.top=0,this.btm=0,this.next=null}push(o){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=o,this.top=this.top+1&this.mask,!0)}shift(){const o=this.buffer[this.btm];if(o!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,o}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(o={}){wt(this,"size");wt(this,"hwm");wt(this,"head");wt(this,"tail");this.hwm=o.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(o){return(o==null?void 0:o.byteLength)!=null?o.byteLength:1}push(o){if((o==null?void 0:o.value)!=null&&(this.size+=this.calculateSize(o.value)),!this.head.push(o)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(o)}}shift(){let o=this.tail.shift();if(o===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,o=this.tail.shift()}return(o==null?void 0:o.value)!=null&&(this.size-=this.calculateSize(o.value)),o}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,rt){super(tt??"The operation was aborted");wt(this,"type");wt(this,"code");this.type="aborted",this.code=rt??"ABORT_ERR"}};function pushable(et={}){return _pushable(tt=>{const rt=tt.shift();if(rt==null)return{done:!0};if(rt.error!=null)throw rt.error;return{done:rt.done===!0,value:rt.value}},et)}function _pushable(et,o){o=o??{};let tt=o.onEnd,rt=new FIFO,nt,ot,it,st=pDefer();const at=async()=>{try{return rt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=bt=>{ot=null,rt.push(bt);try{yt(et(rt))}catch(xt){gt(xt)}return nt}}):et(rt)}finally{rt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(rt.push(yt),nt),lt=yt=>(rt=new FIFO,ot!=null?ot({error:yt}):(rt.push({error:yt}),nt)),dt=yt=>{if(it)return nt;if((o==null?void 0:o.objectMode)!==!0&&(yt==null?void 0:yt.byteLength)==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return ct({done:!1,value:yt})},ht=yt=>it?nt:(it=!0,yt!=null?lt(yt):ct({done:!0})),mt=()=>(rt=new FIFO,ht(),{done:!0}),ft=yt=>(ht(yt),{done:!0});if(nt={[Symbol.asyncIterator](){return this},next:at,return:mt,throw:ft,push:dt,end:ht,get readableLength(){return rt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),rt.isEmpty())return;let bt,xt;gt!=null&&(bt=new Promise((vt,Et)=>{xt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",xt)}));try{await Promise.race([st.promise,bt])}finally{xt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",xt))}}},tt==null)return nt;const pt=nt;return nt={[Symbol.asyncIterator](){return this},next(){return pt.next()},throw(yt){return pt.throw(yt),tt!=null&&(tt(yt),tt=void 0),{done:!0}},return(){return pt.return(),tt!=null&&(tt(),tt=void 0),{done:!0}},push:dt,end(yt){return pt.end(yt),tt!=null&&(tt(yt),tt=void 0),nt},get readableLength(){return pt.readableLength},onEmpty:yt=>pt.onEmpty(yt)},nt}function isAsyncIterable$6(et){return et[Symbol.asyncIterator]!=null}function merge$2(...et){const o=[];for(const tt of et)isAsyncIterable$6(tt)||o.push(tt);return o.length===et.length?function*(){for(const tt of o)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(et.map(async rt=>{for await(const nt of rt)tt.push(nt)})),tt.end()}catch(rt){tt.end(rt)}}),yield*tt}()}function pipe(et,...o){if(et==null)throw new Error("Empty pipeline");if(isDuplex(et)){const rt=et;et=()=>rt.source}else if(isIterable(et)||isAsyncIterable$5(et)){const rt=et;et=()=>rt}const tt=[et,...o];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let rt=1;rt{let o;for(;et.length>0;)o=et.shift()(o);return o},isAsyncIterable$5=et=>(et==null?void 0:et[Symbol.asyncIterator])!=null,isIterable=et=>(et==null?void 0:et[Symbol.iterator])!=null,isDuplex=et=>et==null?!1:et.sink!=null&&et.source!=null,duplexPipelineFn=et=>o=>{const tt=et.sink(o);if((tt==null?void 0:tt.then)!=null){const rt=pushable({objectMode:!0});tt.then(()=>{rt.end()},it=>{rt.end(it)});let nt;const ot=et.source;if(isAsyncIterable$5(ot))nt=async function*(){yield*ot,rt.end()};else if(isIterable(ot))nt=function*(){yield*ot,rt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(rt,nt())}return et.source};async function sortPeersByLatency(et,o){return o.length===0?[]:(await Promise.all(o.map(async nt=>{try{const ot=(await et.get(nt.id)).metadata.get("ping");if(!ot)return{peer:nt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:nt,ping:it}}catch{return{peer:nt,ping:1/0}}}))).filter(nt=>nt!==null).sort((nt,ot)=>nt.ping-ot.ping).map(nt=>nt.peer)}async function getPeersForProtocol(et,o){const tt=[];return await et.forEach(rt=>{for(let nt=0;ntit.tags.has(Tags.BOOTSTRAP)).slice(0,tt);o>0&&o!it.tags.has(Tags.BOOTSTRAP));if(o===0)return[...rt,...nt];const ot=[...rt];for(;ot.length0;){const it=Math.floor(Math.random()*nt.length),st=nt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(et){return et.filter(o=>o.status==="open").sort((o,tt)=>tt.timeline.open-o.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(o,tt,rt){wt(this,"multicodec");wt(this,"getConnections");wt(this,"addEventListener");wt(this,"log");wt(this,"ongoingCreation",new Set);wt(this,"streamPool",new Map);wt(this,"handlePeerUpdateStreamPool",o=>{const{peer:tt}=o.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=o,this.getConnections=tt,this.addEventListener=rt,this.log=new Logger$1(`stream-manager:${o}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(o){const tt=o.id.toString(),rt=this.streamPool.get(tt);rt&&(this.streamPool.delete(tt),await rt);let nt=this.getOpenStreamForCodec(o.id);return nt?(this.log.info(`Found existing stream peerId=${o.id.toString()} multicodec=${this.multicodec}`),this.lockStream(o.id.toString(),nt),nt):(nt=await this.createStream(o),this.lockStream(o.id.toString(),nt),nt)}async createStream(o,tt=0){const rt=this.getConnections(o.id),nt=selectOpenConnection(rt);if(!nt)throw new Error(`Failed to get a connection to the peer peerId=${o.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!nt||["done","closed","closing"].includes(nt.writeStatus||"")||this.isStreamLocked(nt)))return nt}lockStream(o,tt){this.log.info(`Locking stream for peerId:${o} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(o){return!!o.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(o,tt,rt,nt){wt(this,"multicodec");wt(this,"components");wt(this,"log");wt(this,"pubsubTopics");wt(this,"addLibp2pEventListener");wt(this,"removeLibp2pEventListener");wt(this,"streamManager");this.multicodec=o,this.components=tt,this.log=rt,this.pubsubTopics=nt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(o,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(o){return this.streamManager.getStream(o)}async allPeers(){return getPeersForProtocol(this.components.peerStore,[this.multicodec])}async connectedPeers(){return(await this.allPeers()).filter(tt=>this.components.connectionManager.getConnections(tt.id).length>0)}async getPeers({numPeers:o,maxBootstrapPeers:tt,peerIdStr:rt}={maxBootstrapPeers:0,numPeers:0}){if(rt){const st=(await this.connectedPeers()).find(at=>at.id.toString()===rt);return st?[st]:(this.log.warn(`Passed node to use for ${this.multicodec} not found: ${rt}. Attempting to use random peers.`),this.getPeers({numPeers:o,maxBootstrapPeers:tt}))}const nt=await this.connectedPeers(),ot=filterPeersByDiscovery(nt,o,tt),it=await sortPeersByLatency(this.components.peerStore,ot);return it.length===0&&this.log.warn("No peers found. Ensure you have a connection to the network."),it.length{log$n.error("Failed to register ",FilterCodecs.PUSH,ot)})}async subscribe(tt,rt,nt){const ot=await this.getStream(rt),it=FilterSubscribeRpc.createSubscribeRequest(tt,nt);let st;try{st=await pipe([it.encode()],encode$K,ot,decode$U,async dt=>await all$2(dt))}catch(dt){return log$n.error("Failed to send subscribe request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}const{statusCode:at,requestId:ct,statusDesc:lt}=FilterSubscribeResponse.decode(st[0].slice());return at<200||at>=300?(log$n.error(`Filter subscribe request ${ct} failed with status code ${at}: ${lt}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id},success:null}):{failure:null,success:rt.id}}async unsubscribe(tt,rt,nt){let ot;try{ot=await this.getStream(rt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${rt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:rt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,nt);try{await pipe([it.encode()],encode$K,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}return{success:rt.id,failure:null}}async unsubscribeAll(tt,rt){const nt=await this.getStream(rt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$K,nt,decode$U,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$1.NO_RESPONSE,peerId:rt.id},success:null};const{statusCode:st,requestId:at,statusDesc:ct}=FilterSubscribeResponse.decode(it[0].slice());return st<200||st>=300?(log$n.error(`Filter unsubscribe all request ${at} failed with status code ${st}: ${ct}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id},success:null}):{failure:null,success:rt.id}}async ping(tt){let rt;try{rt=await this.getStream(tt)}catch(ct){return log$n.error(`Failed to get a stream for remote peer${tt.id.toString()}`,ct),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:tt.id}}}const nt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([nt.encode()],encode$K,rt,decode$U,async ct=>await all$2(ct))}catch(ct){return log$n.error("Failed to send ping request",ct),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:tt.id}}}if(!ot||!ot.length)return{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:tt.id}};const{statusCode:it,requestId:st,statusDesc:at}=FilterSubscribeResponse.decode(ot[0].slice());return it<200||it>=300?(log$n.error(`Filter ping request ${st} failed with status code ${it}: ${at}`),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:tt.id}}):{success:tt.id,failure:null}}onRequest(tt){const{connection:rt,stream:nt}=tt,{remotePeer:ot}=rt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(nt,decode$U,async it=>{for await(const st of it){const at=FilterPushRpc.decode(st.slice()),{pubsubTopic:ct,wakuMessage:lt}=at;if(!lt){log$n.error("Received empty message");return}if(!ct){log$n.error("Pubsub topic missing from push message");return}await this.handleIncomingMessage(ct,lt,rt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${rt.remotePeer.toString()} -- stream:${nt.id} -- protocol:${nt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}class PushRpc{constructor(o){wt(this,"proto");this.proto=o}static createRequest(o,tt){return new PushRpc({requestId:v4$2(),request:{message:o,pubsubTopic:tt},response:void 0})}static decode(o){const tt=PushRpc$1.decode(o);return new PushRpc(tt)}encode(){return PushRpc$1.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const RLN_GENERATION_PREFIX_ERROR="could not generate rln-v2 proof",isRLNResponseError=et=>et?et.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=et=>{const o={[ProtocolError$1.RLN_IDENTITY_MISSING]:ProtocolError$1.RLN_IDENTITY_MISSING,[ProtocolError$1.RLN_MEMBERSHIP_INDEX]:ProtocolError$1.RLN_MEMBERSHIP_INDEX,[ProtocolError$1.RLN_LIMIT_MISSING]:ProtocolError$1.RLN_LIMIT_MISSING},tt=et.toLowerCase();for(const rt in o)if(tt.includes(rt.toLowerCase()))return o[rt];return ProtocolError$1.RLN_PROOF_GENERATION},log$m=new Logger$1("light-push"),LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";class LightPushCore extends BaseProtocol{constructor(tt,rt){super(LightPushCodec,rt.components,log$m,tt);wt(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,rt){try{if(!rt.payload||rt.payload.length===0)return log$m.error("Failed to send waku light push: payload is empty"),{query:null,error:ProtocolError$1.EMPTY_PAYLOAD};if(!await isMessageSizeUnderCap(tt,rt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$1.SIZE_TOO_BIG};const nt=await tt.toProtoObj(rt);return nt?{query:PushRpc.createRequest(nt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$1.ENCODE_FAILED})}catch(nt){return log$m.error("Failed to prepare push message",nt),{query:null,error:ProtocolError$1.GENERIC_FAIL}}}async send(tt,rt,nt){const{query:ot,error:it}=await this.preparePushMessage(tt,rt);if(it||!ot)return{success:null,failure:{error:it,peerId:nt.id}};let st;try{st=await this.getStream(nt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:nt.id}}}let at;try{at=await pipe([ot.encode()],encode$K,st,decode$U,async dt=>await all$2(dt))}catch(dt){return log$m.error("Failed to send waku light push request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}const ct=new Uint8ArrayList;at.forEach(dt=>{ct.append(dt)});let lt;try{lt=PushRpc.decode(ct).response}catch(dt){return log$m.error("Failed to decode push reply",dt),{success:null,failure:{error:ProtocolError$1.DECODE_FAILED,peerId:nt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:nt.id}};if(isRLNResponseError(lt.info)){const dt=matchRLNErrorMessage(lt.info);return log$m.error("Remote peer rejected the message: ",dt),{success:null,failure:{error:dt,peerId:nt.id}}}return lt.isSuccess?{success:nt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(et){return{...EmptyMessage,...et}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;class StoreQueryRequest{constructor(o){wt(this,"proto");this.proto=o}static create(o){const tt=new StoreQueryRequest({...o,requestId:v4$2(),timeStart:o.timeStart?BigInt(o.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:o.timeEnd?BigInt(o.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:o.messageHashes||[],paginationLimit:o.paginationLimit?BigInt(o.paginationLimit):void 0});if(o.pubsubTopic&&!o.contentTopics||!o.pubsubTopic&&o.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(o.messageHashes&&(o.pubsubTopic||o.contentTopics||o.timeStart||o.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(o){const tt=StoreQueryRequest$1.decode(o);return new StoreQueryRequest(tt)}encode(){return StoreQueryRequest$1.encode(this.proto)}}class StoreQueryResponse{constructor(o){wt(this,"proto");this.proto=o}static decode(o){const tt=StoreQueryResponse$1.decode(o);return new StoreQueryResponse(tt)}encode(){return StoreQueryResponse$1.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get messages(){return this.proto.messages}get paginationCursor(){return this.proto.paginationCursor}}const log$l=new Logger$1("store"),StoreCodec="/vac/waku/store-query/3.0.0";class StoreCore extends BaseProtocol{constructor(tt,rt){super(StoreCodec,rt.components,log$l,tt);wt(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,rt,nt){if(tt.contentTopics.toString()!==Array.from(rt.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let ot=tt.paginationCursor;for(;;){const it=StoreQueryRequest.create({...tt,paginationCursor:ot});let st;try{st=await this.getStream(nt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$K,st,decode$U,async ht=>await all$2(ht)),ct=new Uint8ArrayList;at.forEach(ht=>{ct.append(ht)});const lt=StoreQueryResponse.decode(ct);if(!lt.statusCode||lt.statusCode>=300){const ht=`Store query failed with status code: ${lt.statusCode}, description: ${lt.statusDesc}`;throw log$l.error(ht),new Error(ht)}if(!lt.messages||!lt.messages.length){log$l.warn("Stopping pagination due to empty messages in response");break}if(log$l.info(`${lt.messages.length} messages retrieved from store`),yield lt.messages.map(ht=>{if(!ht.message)return Promise.resolve(void 0);const mt=ht.message.contentTopic;if(mt){const ft=rt.get(mt);if(ft)return ft.fromProtoObj(ht.pubsubTopic||"",toProtoMessage(ht.message))}return Promise.resolve(void 0)}),tt.paginationForward?ot=lt.messages[lt.messages.length-1].messageHash:ot=lt.messages[0].messageHash,lt.messages.length>MAX_PAGE_SIZE&<.messages.length<(tt.paginationLimit||DEFAULT_PAGE_SIZE))break}}}const peerDiscoverySymbol$2=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$3=Symbol.for("@libp2p/peer-id");function isPeerId$2(et){return!!(et!=null&&et[peerIdSymbol$3])}var ls;let AbortError$9=(ls=class extends Error{constructor(o="The operation was aborted"){super(o),this.name="AbortError"}},wt(ls,"name","AbortError"),ls);class UnexpectedPeerError extends Error{constructor(o="Unexpected Peer"){super(o),this.name="UnexpectedPeerError"}}wt(UnexpectedPeerError,"name","UnexpectedPeerError");var us;let InvalidMessageError$3=(us=class extends Error{constructor(o="Invalid message"){super(o),this.name="InvalidMessageError"}},wt(us,"name","InvalidMessageError"),us);class ProtocolError extends Error{constructor(o="Protocol error"){super(o),this.name="ProtocolError"}}wt(ProtocolError,"name","ProtocolError");var ds;let TimeoutError$3=(ds=class extends Error{constructor(o="Timed out"){super(o),this.name="TimeoutError"}},wt(ds,"name","TimeoutError"),ds);function setMaxListeners$9(){}const setMaxListeners$8=(et,...o)=>{try{[...o]}catch{}};var Yr,Js;let TypedEventEmitter$3=(Js=class extends EventTarget{constructor(){super();fr(this,Yr,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const rt=Ot(this,Yr).get(tt);return rt==null?0:rt.length}addEventListener(tt,rt,nt){super.addEventListener(tt,rt,nt);let ot=Ot(this,Yr).get(tt);ot==null&&(ot=[],Ot(this,Yr).set(tt,ot)),ot.push({callback:rt,once:(nt!==!0&&nt!==!1&&(nt==null?void 0:nt.once))??!1})}removeEventListener(tt,rt,nt){super.removeEventListener(tt.toString(),rt??null,nt);let ot=Ot(this,Yr).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==rt),Ot(this,Yr).set(tt,ot))}dispatchEvent(tt){const rt=super.dispatchEvent(tt);let nt=Ot(this,Yr).get(tt.type);return nt==null||(nt=nt.filter(({once:ot})=>!ot),Ot(this,Yr).set(tt.type,nt)),rt}safeDispatchEvent(tt,rt={}){return this.dispatchEvent(new CustomEvent(tt,rt))}},Yr=new WeakMap,Js);const serviceCapabilities$5=Symbol.for("@libp2p/service-capabilities"),RelayPingContentTopic="/relay-ping/1/ping/null",log$k=new Logger$1("keep-alive");class KeepAliveManager{constructor({options:o,relay:tt,libp2p:rt}){wt(this,"relay");wt(this,"libp2p");wt(this,"options");wt(this,"pingKeepAliveTimers",new Map);wt(this,"relayKeepAliveTimers",new Map);this.options=o,this.relay=tt,this.libp2p=rt}start(o){this.stop(o);const{pingKeepAlive:tt,relayKeepAlive:rt}=this.options,nt=o.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(o),log$k.info(`Ping succeeded (${nt})`,st)}catch{log$k.error(`Ping failed for peer (${nt}). + */function _extends(){return _extends=Object.assign?Object.assign.bind():function(et){for(var o=1;o=0)&&(tt[nt]=et[nt]);return tt}function isModifiedEvent(et){return!!(et.metaKey||et.altKey||et.ctrlKey||et.shiftKey)}function shouldProcessLinkClick(et,o){return et.button===0&&(!o||o==="_self")&&!isModifiedEvent(et)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(et){let{basename:o,children:tt,future:rt,window:nt}=et,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:nt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=rt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.createElement(Router,{basename:o,children:tt,location:st.location,navigationType:st.action,navigator:it,future:rt})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(o,tt){let{onClick:rt,relative:nt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=o,ht=_objectWithoutPropertiesLoose(o,_excluded),{basename:mt}=reactExports.useContext(NavigationContext),ft,pt=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(ft=ct,isBrowser$1))try{let xt=new URL(window.location.href),vt=ct.startsWith("//")?new URL(xt.protocol+ct):new URL(ct),Et=stripBasename(vt.pathname,mt);vt.origin===xt.origin&&Et!=null?ct=Et+vt.search+vt.hash:pt=!0}catch{}let yt=useHref(ct,{relative:nt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:nt,viewTransition:dt});function bt(xt){rt&&rt(xt),xt.defaultPrevented||gt(xt)}return reactExports.createElement("a",_extends({},ht,{href:ft||yt,onClick:pt||ot?rt:bt,ref:tt,target:at}))});var DataRouterHook;(function(et){et.UseScrollRestoration="useScrollRestoration",et.UseSubmit="useSubmit",et.UseSubmitFetcher="useSubmitFetcher",et.UseFetcher="useFetcher",et.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(et){et.UseFetcher="useFetcher",et.UseFetchers="useFetchers",et.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(et,o){let{target:tt,replace:rt,state:nt,preventScrollReset:ot,relative:it,viewTransition:st}=o===void 0?{}:o,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(et,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=rt!==void 0?rt:createPath(ct)===createPath(lt);at(et,{replace:ht,state:nt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,rt,nt,tt,et,ot,it,st])}function setRef(et,o){typeof et=="function"?et(o):et!=null&&(et.current=o)}function composeRefs(...et){return o=>et.forEach(tt=>setRef(tt,o))}function useComposedRefs(...et){return reactExports.useCallback(composeRefs(...et),et)}var Slot=reactExports.forwardRef((et,o)=>{const{children:tt,...rt}=et,nt=reactExports.Children.toArray(tt),ot=nt.find(isSlottable);if(ot){const it=ot.props.children,st=nt.map(at=>at===ot?reactExports.Children.count(it)>1?reactExports.Children.only(null):reactExports.isValidElement(it)?it.props.children:null:at);return jsxRuntimeExports.jsx(SlotClone,{...rt,ref:o,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...rt,ref:o,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((et,o)=>{const{children:tt,...rt}=et;if(reactExports.isValidElement(tt)){const nt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(rt,tt.props),ref:o?composeRefs(o,nt):nt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:et})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:et});function isSlottable(et){return reactExports.isValidElement(et)&&et.type===Slottable}function mergeProps(et,o){const tt={...o};for(const rt in o){const nt=et[rt],ot=o[rt];/^on[A-Z]/.test(rt)?nt&&ot?tt[rt]=(...st)=>{ot(...st),nt(...st)}:nt&&(tt[rt]=nt):rt==="style"?tt[rt]={...nt,...ot}:rt==="className"&&(tt[rt]=[nt,ot].filter(Boolean).join(" "))}return{...et,...tt}}function getElementRef$1(et){var rt,nt;let o=(rt=Object.getOwnPropertyDescriptor(et.props,"ref"))==null?void 0:rt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning;return tt?et.ref:(o=(nt=Object.getOwnPropertyDescriptor(et,"ref"))==null?void 0:nt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning,tt?et.props.ref:et.props.ref||et.ref)}function r$1(et){var o,tt,rt="";if(typeof et=="string"||typeof et=="number")rt+=et;else if(typeof et=="object")if(Array.isArray(et))for(o=0;otypeof et=="boolean"?"".concat(et):et===0?"0":et,cx=clsx$1,cva=(et,o)=>tt=>{var rt;if((o==null?void 0:o.variants)==null)return cx(et,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:nt,defaultVariants:ot}=o,it=Object.keys(nt).map(ct=>{const lt=tt==null?void 0:tt[ct],dt=ot==null?void 0:ot[ct];if(lt===null)return null;const ht=falsyToString(lt)||falsyToString(dt);return nt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=o==null||(rt=o.compoundVariants)===null||rt===void 0?void 0:rt.reduce((ct,lt)=>{let{class:dt,className:ht,...mt}=lt;return Object.entries(mt).every(ft=>{let[pt,yt]=ft;return Array.isArray(yt)?yt.includes({...ot,...st}[pt]):{...ot,...st}[pt]===yt})?[...ct,dt,ht]:ct},[]);return cx(et,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(et){var o,tt,rt="";if(typeof et=="string"||typeof et=="number")rt+=et;else if(typeof et=="object")if(Array.isArray(et)){var nt=et.length;for(o=0;o{const o=createClassMap(et),{conflictingClassGroups:tt,conflictingClassGroupModifiers:rt}=et;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,o)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&rt[it]?[...at,...rt[it]]:at}}},getGroupRecursive=(et,o)=>{var it;if(et.length===0)return o.classGroupId;const tt=et[0],rt=o.nextPart.get(tt),nt=rt?getGroupRecursive(et.slice(1),rt):void 0;if(nt)return nt;if(o.validators.length===0)return;const ot=et.join(CLASS_PART_SEPARATOR);return(it=o.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=et=>{if(arbitraryPropertyRegex.test(et)){const o=arbitraryPropertyRegex.exec(et)[1],tt=o==null?void 0:o.substring(0,o.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=et=>{const{theme:o,prefix:tt}=et,rt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(et.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,rt,ot,o)}),rt},processClassesRecursively=(et,o,tt,rt)=>{et.forEach(nt=>{if(typeof nt=="string"){const ot=nt===""?o:getPart(o,nt);ot.classGroupId=tt;return}if(typeof nt=="function"){if(isThemeGetter(nt)){processClassesRecursively(nt(rt),o,tt,rt);return}o.validators.push({validator:nt,classGroupId:tt});return}Object.entries(nt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(o,ot),tt,rt)})})},getPart=(et,o)=>{let tt=et;return o.split(CLASS_PART_SEPARATOR).forEach(rt=>{tt.nextPart.has(rt)||tt.nextPart.set(rt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(rt)}),tt},isThemeGetter=et=>et.isThemeGetter,getPrefixedClassGroupEntries=(et,o)=>o?et.map(([tt,rt])=>{const nt=rt.map(ot=>typeof ot=="string"?o+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[o+it,st])):ot);return[tt,nt]}):et,createLruCache=et=>{if(et<1)return{get:()=>{},set:()=>{}};let o=0,tt=new Map,rt=new Map;const nt=(ot,it)=>{tt.set(ot,it),o++,o>et&&(o=0,rt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=rt.get(ot))!==void 0)return nt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):nt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=et=>{const{separator:o,experimentalParseClassName:tt}=et,rt=o.length===1,nt=o[0],ot=o.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:mt,baseClassName:ft,maybePostfixModifierPosition:pt}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=et=>{if(et.length<=1)return et;const o=[];let tt=[];return et.forEach(rt=>{rt[0]==="["?(o.push(...tt.sort(),rt),tt=[]):tt.push(rt)}),o.push(...tt.sort()),o},createConfigUtils=et=>({cache:createLruCache(et.cacheSize),parseClassName:createParseClassName(et),...createClassGroupUtils(et)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(et,o)=>{const{parseClassName:tt,getClassGroupId:rt,getConflictingClassGroupIds:nt}=o,ot=[],it=et.trim().split(SPLIT_CLASSES_REGEX);let st="";for(let at=it.length-1;at>=0;at-=1){const ct=it[at],{modifiers:lt,hasImportantModifier:dt,baseClassName:ht,maybePostfixModifierPosition:mt}=tt(ct);let ft=!!mt,pt=rt(ft?ht.substring(0,mt):ht);if(!pt){if(!ft){st=ct+(st.length>0?" "+st:st);continue}if(pt=rt(ht),!pt){st=ct+(st.length>0?" "+st:st);continue}ft=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,bt=gt+pt;if(ot.includes(bt))continue;ot.push(bt);const xt=nt(pt,ft);for(let vt=0;vt0?" "+st:st)}return st};function twJoin(){let et=0,o,tt,rt="";for(;et{if(typeof et=="string")return et;let o,tt="";for(let rt=0;rtdt(lt),et());return tt=createConfigUtils(ct),rt=tt.cache.get,nt=tt.cache.set,ot=st,st(at)}function st(at){const ct=rt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return nt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=et=>{const o=tt=>tt[et]||[];return o.isThemeGetter=!0,o},arbitraryValueRegex=/^\[(?:([a-z-]+):)?(.+)\]$/i,fractionRegex=/^\d+\/\d+$/,stringLengths=new Set(["px","full","screen"]),tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isLength=et=>isNumber(et)||stringLengths.has(et)||fractionRegex.test(et),isArbitraryLength=et=>getIsArbitraryValue(et,"length",isLengthOnly),isNumber=et=>!!et&&!Number.isNaN(Number(et)),isArbitraryNumber=et=>getIsArbitraryValue(et,"number",isNumber),isInteger$1=et=>!!et&&Number.isInteger(Number(et)),isPercent=et=>et.endsWith("%")&&isNumber(et.slice(0,-1)),isArbitraryValue=et=>arbitraryValueRegex.test(et),isTshirtSize=et=>tshirtUnitRegex.test(et),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=et=>getIsArbitraryValue(et,sizeLabels,isNever),isArbitraryPosition=et=>getIsArbitraryValue(et,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=et=>getIsArbitraryValue(et,imageLabels,isImage),isArbitraryShadow=et=>getIsArbitraryValue(et,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(et,o,tt)=>{const rt=arbitraryValueRegex.exec(et);return rt?rt[1]?typeof o=="string"?rt[1]===o:o.has(rt[1]):tt(rt[2]):!1},isLengthOnly=et=>lengthUnitRegex.test(et)&&!colorFunctionRegex.test(et),isNever=()=>!1,isShadow=et=>shadowRegex.test(et),isImage=et=>imageRegex.test(et),getDefaultConfig=()=>{const et=fromTheme("colors"),o=fromTheme("spacing"),tt=fromTheme("blur"),rt=fromTheme("brightness"),nt=fromTheme("borderColor"),ot=fromTheme("borderRadius"),it=fromTheme("borderSpacing"),st=fromTheme("borderWidth"),at=fromTheme("contrast"),ct=fromTheme("grayscale"),lt=fromTheme("hueRotate"),dt=fromTheme("invert"),ht=fromTheme("gap"),mt=fromTheme("gradientColorStops"),ft=fromTheme("gradientColorStopPositions"),pt=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),bt=fromTheme("padding"),xt=fromTheme("saturate"),vt=fromTheme("scale"),Et=fromTheme("sepia"),Ct=fromTheme("skew"),St=fromTheme("space"),At=fromTheme("translate"),kt=()=>["auto","contain","none"],It=()=>["auto","hidden","clip","visible","scroll"],Nt=()=>["auto",isArbitraryValue,o],Lt=()=>[isArbitraryValue,o],Mt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ut=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Xt=()=>["solid","dashed","dotted","double","none"],Wt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ft=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Pt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Yt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Yt(),borderColor:[et],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Lt(),borderWidth:Mt(),contrast:Yt(),grayscale:qt(),hueRotate:Yt(),invert:qt(),gap:Lt(),gradientColorStops:[et],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:Nt(),margin:Nt(),opacity:Yt(),padding:Lt(),saturate:Yt(),scale:Yt(),sepia:qt(),skew:Yt(),space:Lt(),translate:Lt()},classGroups:{aspect:[{aspect:["auto","square","video",isArbitraryValue]}],container:["container"],columns:[{columns:[isTshirtSize]}],"break-after":[{"break-after":Pt()}],"break-before":[{"break-before":Pt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ut(),isArbitraryValue]}],overflow:[{overflow:It()}],"overflow-x":[{"overflow-x":It()}],"overflow-y":[{"overflow-y":It()}],overscroll:[{overscroll:kt()}],"overscroll-x":[{"overscroll-x":kt()}],"overscroll-y":[{"overscroll-y":kt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[pt]}],"inset-x":[{"inset-x":[pt]}],"inset-y":[{"inset-y":[pt]}],start:[{start:[pt]}],end:[{end:[pt]}],top:[{top:[pt]}],right:[{right:[pt]}],bottom:[{bottom:[pt]}],left:[{left:[pt]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",isInteger$1,isArbitraryValue]}],basis:[{basis:Nt()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",isArbitraryValue]}],grow:[{grow:qt()}],shrink:[{shrink:qt()}],order:[{order:["first","last","none",isInteger$1,isArbitraryValue]}],"grid-cols":[{"grid-cols":[isAny]}],"col-start-end":[{col:["auto",{span:["full",isInteger$1,isArbitraryValue]},isArbitraryValue]}],"col-start":[{"col-start":zt()}],"col-end":[{"col-end":zt()}],"grid-rows":[{"grid-rows":[isAny]}],"row-start-end":[{row:["auto",{span:[isInteger$1,isArbitraryValue]},isArbitraryValue]}],"row-start":[{"row-start":zt()}],"row-end":[{"row-end":zt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",isArbitraryValue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",isArbitraryValue]}],gap:[{gap:[ht]}],"gap-x":[{"gap-x":[ht]}],"gap-y":[{"gap-y":[ht]}],"justify-content":[{justify:["normal",...Ft()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ft(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ft(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[bt]}],px:[{px:[bt]}],py:[{py:[bt]}],ps:[{ps:[bt]}],pe:[{pe:[bt]}],pt:[{pt:[bt]}],pr:[{pr:[bt]}],pb:[{pb:[bt]}],pl:[{pl:[bt]}],m:[{m:[yt]}],mx:[{mx:[yt]}],my:[{my:[yt]}],ms:[{ms:[yt]}],me:[{me:[yt]}],mt:[{mt:[yt]}],mr:[{mr:[yt]}],mb:[{mb:[yt]}],ml:[{ml:[yt]}],"space-x":[{"space-x":[St]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[St]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,o]}],"min-w":[{"min-w":[isArbitraryValue,o,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,o,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,o,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,o,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,o,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,o,"auto","min","max","fit"]}],"font-size":[{text:["base",isTshirtSize,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",isArbitraryNumber]}],"font-family":[{font:[isAny]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",isArbitraryValue]}],"line-clamp":[{"line-clamp":["none",isNumber,isArbitraryNumber]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",isLength,isArbitraryValue]}],"list-image":[{"list-image":["none",isArbitraryValue]}],"list-style-type":[{list:["none","disc","decimal",isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[et]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[et]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Xt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[et]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Lt()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[gt]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ut(),isArbitraryPosition]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",isArbitrarySize]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},isArbitraryImage]}],"bg-color":[{bg:[et]}],"gradient-from-pos":[{from:[ft]}],"gradient-via-pos":[{via:[ft]}],"gradient-to-pos":[{to:[ft]}],"gradient-from":[{from:[mt]}],"gradient-via":[{via:[mt]}],"gradient-to":[{to:[mt]}],rounded:[{rounded:[ot]}],"rounded-s":[{"rounded-s":[ot]}],"rounded-e":[{"rounded-e":[ot]}],"rounded-t":[{"rounded-t":[ot]}],"rounded-r":[{"rounded-r":[ot]}],"rounded-b":[{"rounded-b":[ot]}],"rounded-l":[{"rounded-l":[ot]}],"rounded-ss":[{"rounded-ss":[ot]}],"rounded-se":[{"rounded-se":[ot]}],"rounded-ee":[{"rounded-ee":[ot]}],"rounded-es":[{"rounded-es":[ot]}],"rounded-tl":[{"rounded-tl":[ot]}],"rounded-tr":[{"rounded-tr":[ot]}],"rounded-br":[{"rounded-br":[ot]}],"rounded-bl":[{"rounded-bl":[ot]}],"border-w":[{border:[st]}],"border-w-x":[{"border-x":[st]}],"border-w-y":[{"border-y":[st]}],"border-w-s":[{"border-s":[st]}],"border-w-e":[{"border-e":[st]}],"border-w-t":[{"border-t":[st]}],"border-w-r":[{"border-r":[st]}],"border-w-b":[{"border-b":[st]}],"border-w-l":[{"border-l":[st]}],"border-opacity":[{"border-opacity":[gt]}],"border-style":[{border:[...Xt(),"hidden"]}],"divide-x":[{"divide-x":[st]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[st]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[gt]}],"divide-style":[{divide:Xt()}],"border-color":[{border:[nt]}],"border-color-x":[{"border-x":[nt]}],"border-color-y":[{"border-y":[nt]}],"border-color-s":[{"border-s":[nt]}],"border-color-e":[{"border-e":[nt]}],"border-color-t":[{"border-t":[nt]}],"border-color-r":[{"border-r":[nt]}],"border-color-b":[{"border-b":[nt]}],"border-color-l":[{"border-l":[nt]}],"divide-color":[{divide:[nt]}],"outline-style":[{outline:["",...Xt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[et]}],"ring-w":[{ring:Mt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[et]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[et]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Wt(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Wt()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[rt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[xt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[rt]}],"backdrop-contrast":[{"backdrop-contrast":[at]}],"backdrop-grayscale":[{"backdrop-grayscale":[ct]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[lt]}],"backdrop-invert":[{"backdrop-invert":[dt]}],"backdrop-opacity":[{"backdrop-opacity":[gt]}],"backdrop-saturate":[{"backdrop-saturate":[xt]}],"backdrop-sepia":[{"backdrop-sepia":[Et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[it]}],"border-spacing-x":[{"border-spacing-x":[it]}],"border-spacing-y":[{"border-spacing-y":[it]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",isArbitraryValue]}],duration:[{duration:Yt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Yt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[vt]}],"scale-x":[{"scale-x":[vt]}],"scale-y":[{"scale-y":[vt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[At]}],"translate-y":[{"translate-y":[At]}],"skew-x":[{"skew-x":[Ct]}],"skew-y":[{"skew-y":[Ct]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",et]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryValue]}],"caret-color":[{caret:[et]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Lt()}],"scroll-mx":[{"scroll-mx":Lt()}],"scroll-my":[{"scroll-my":Lt()}],"scroll-ms":[{"scroll-ms":Lt()}],"scroll-me":[{"scroll-me":Lt()}],"scroll-mt":[{"scroll-mt":Lt()}],"scroll-mr":[{"scroll-mr":Lt()}],"scroll-mb":[{"scroll-mb":Lt()}],"scroll-ml":[{"scroll-ml":Lt()}],"scroll-p":[{"scroll-p":Lt()}],"scroll-px":[{"scroll-px":Lt()}],"scroll-py":[{"scroll-py":Lt()}],"scroll-ps":[{"scroll-ps":Lt()}],"scroll-pe":[{"scroll-pe":Lt()}],"scroll-pt":[{"scroll-pt":Lt()}],"scroll-pr":[{"scroll-pr":Lt()}],"scroll-pb":[{"scroll-pb":Lt()}],"scroll-pl":[{"scroll-pl":Lt()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryValue]}],fill:[{fill:[et,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[et,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...et){return twMerge(clsx(et))}const buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=reactExports.forwardRef(({className:et,variant:o,size:tt,asChild:rt=!1,...nt},ot)=>{const it=rt?Slot:"button";return jsxRuntimeExports.jsx(it,{className:cn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50","min-h-[44px] px-4 py-2 md:min-h-[36px] md:px-3 md:py-1.5",buttonVariants({variant:o,size:tt,className:et})),ref:ot,...nt})});Button.displayName="Button";function allocUnsafe$j(et=0){return new Uint8Array(et)}const N1$6=Math.pow(2,7),N2$6=Math.pow(2,14),N3$6=Math.pow(2,21),N4$6=Math.pow(2,28),N5$6=Math.pow(2,35),N6$6=Math.pow(2,42),N7$6=Math.pow(2,49),MSB$8=128,REST$8=127;function encodingLength$6(et){if(etNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(et,o,tt=0){switch(encodingLength$6(et)){case 8:o[tt++]=et&255|MSB$8,et/=128;case 7:o[tt++]=et&255|MSB$8,et/=128;case 6:o[tt++]=et&255|MSB$8,et/=128;case 5:o[tt++]=et&255|MSB$8,et/=128;case 4:o[tt++]=et&255|MSB$8,et>>>=7;case 3:o[tt++]=et&255|MSB$8,et>>>=7;case 2:o[tt++]=et&255|MSB$8,et>>>=7;case 1:{o[tt++]=et&255,et>>>=7;break}default:throw new Error("unreachable")}return o}function encodeUint8ArrayList(et,o,tt=0){switch(encodingLength$6(et)){case 8:o.set(tt++,et&255|MSB$8),et/=128;case 7:o.set(tt++,et&255|MSB$8),et/=128;case 6:o.set(tt++,et&255|MSB$8),et/=128;case 5:o.set(tt++,et&255|MSB$8),et/=128;case 4:o.set(tt++,et&255|MSB$8),et>>>=7;case 3:o.set(tt++,et&255|MSB$8),et>>>=7;case 2:o.set(tt++,et&255|MSB$8),et>>>=7;case 1:{o.set(tt++,et&255),et>>>=7;break}default:throw new Error("unreachable")}return o}function decodeUint8Array(et,o){let tt=et[o],rt=0;if(rt+=tt&REST$8,tt>>31>0){const tt=~this.lo+1>>>0;let rt=~this.hi>>>0;return tt===0&&(rt=rt+1>>>0),-(tt+rt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(o=!1){if(o)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let rt=~this.hi>>>0;return tt===0&&(rt=rt+1>>>0),-(BigInt(tt)+(BigInt(rt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(o=!1){return this.toBigInt(o).toString()}zzEncode(){const o=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^o)>>>0,this.lo=(this.lo<<1^o)>>>0,this}zzDecode(){const o=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^o)>>>0,this.hi=(this.hi>>>1^o)>>>0,this}length(){const o=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,rt=this.hi>>>24;return rt===0?tt===0?o<16384?o<128?1:2:o<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:rt<128?9:10}static fromBigInt(o){if(o===0n)return zero;if(oMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(o));const tt=o<0n;tt&&(o=-o);let rt=o>>32n,nt=o-(rt<<32n);return tt&&(rt=~rt|0n,nt=~nt|0n,++nt>TWO_32&&(nt=0n,++rt>TWO_32&&(rt=0n))),new Sn(Number(nt),Number(rt))}static fromNumber(o){if(o===0)return zero;const tt=o<0;tt&&(o=-o);let rt=o>>>0,nt=(o-rt)/4294967296>>>0;return tt&&(nt=~nt>>>0,rt=~rt>>>0,++rt>4294967295&&(rt=0,++nt>4294967295&&(nt=0))),new Sn(rt,nt)}static from(o){return typeof o=="number"?Sn.fromNumber(o):typeof o=="bigint"?Sn.fromBigInt(o):typeof o=="string"?Sn.fromBigInt(BigInt(o)):o.low!=null||o.high!=null?new Sn(o.low>>>0,o.high>>>0):zero}};const zero=new LongBits$2(0,0);zero.toBigInt=function(){return 0n};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};const TWO_32=4294967296n;function length$6(et){let o=0,tt=0;for(let rt=0;rt191&&st<224?ot[it++]=(st&31)<<6|et[o++]&63:st>239&&st<365?(st=((st&7)<<18|(et[o++]&63)<<12|(et[o++]&63)<<6|et[o++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(et[o++]&63)<<6|et[o++]&63,it>8191&&((nt??(nt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return nt!=null?(it>0&&nt.push(String.fromCharCode.apply(String,ot.slice(0,it))),nt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(et,o,tt){const rt=tt;let nt,ot;for(let it=0;it>6|192,o[tt++]=nt&63|128):(nt&64512)===55296&&((ot=et.charCodeAt(it+1))&64512)===56320?(nt=65536+((nt&1023)<<10)+(ot&1023),++it,o[tt++]=nt>>18|240,o[tt++]=nt>>12&63|128,o[tt++]=nt>>6&63|128,o[tt++]=nt&63|128):(o[tt++]=nt>>12|224,o[tt++]=nt>>6&63|128,o[tt++]=nt&63|128);return tt-rt}function indexOutOfRange$1(et,o){return RangeError(`index out of range: ${et.pos} + ${o??1} > ${et.len}`)}function readFixed32End(et,o){return(et[o-4]|et[o-3]<<8|et[o-2]<<16|et[o-1]<<24)>>>0}class Uint8ArrayReader{constructor(o){wt(this,"buf");wt(this,"pos");wt(this,"len");wt(this,"_slice",Uint8Array.prototype.subarray);this.buf=o,this.pos=0,this.len=o.length}uint32(){let o=4294967295;if(o=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(o=(o|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return o;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return o}int32(){return this.uint32()|0}sint32(){const o=this.uint32();return o>>>1^-(o&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);const o=readFloatLE(this.buf,this.pos);return this.pos+=4,o}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const o=readDoubleLE(this.buf,this.pos);return this.pos+=8,o}bytes(){const o=this.uint32(),tt=this.pos,rt=this.pos+o;if(rt>this.len)throw indexOutOfRange$1(this,o);return this.pos+=o,tt===rt?new Uint8Array(0):this.buf.subarray(tt,rt)}string(){const o=this.bytes();return read$7(o,0,o.length)}skip(o){if(typeof o=="number"){if(this.pos+o>this.len)throw indexOutOfRange$1(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${o} at offset ${this.pos}`)}return this}readLongVarint(){const o=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;tt<5;++tt)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const o=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(o,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const o=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$6(o),o}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function createReader(et){return new Uint8ArrayReader(et instanceof Uint8Array?et:et.subarray())}function decodeMessage(et,o,tt){const rt=createReader(et);return o.decode(rt,void 0,tt)}function allocUnsafe$i(et=0){return new Uint8Array(et)}function coerce$k(et){if(et instanceof Uint8Array&&et.constructor.name==="Uint8Array")return et;if(et instanceof ArrayBuffer)return new Uint8Array(et);if(ArrayBuffer.isView(et))return new Uint8Array(et.buffer,et.byteOffset,et.byteLength);throw new Error("Unknown type, must be binary type")}function fromString$w(et){return new TextEncoder().encode(et)}function toString$x(et){return new TextDecoder().decode(et)}function base$l(et,o){if(et.length>=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$l=base$l,_brrp__multiformats_scope_baseX$k=src$l;let Encoder$m=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$m=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$m(this,o)}},ComposedDecoder$k=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$m(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$m(et,o){return new ComposedDecoder$k({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$k=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$m(o,tt,rt),this.decoder=new Decoder$m(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$n({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$k(et,o,tt,rt)}function baseX$k({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$k(tt,et);return from$n({prefix:o,name:et,encode:rt,decode:ot=>coerce$k(nt(ot))})}function decode$Y(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$O(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<(et[tt]=o,et),[]),alphabetCharsToBytes$g=alphabet$g.reduce((et,o,tt)=>{const rt=o.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${o}`);return et[rt]=tt,et},[]);function encode$N(et){return et.reduce((o,tt)=>(o+=alphabetBytesToChars$g[tt],o),"")}function decode$X(et){const o=[];for(const tt of et){const rt=tt.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${tt}`);const nt=alphabetCharsToBytes$g[rt];if(nt==null)throw new Error(`Non-base256emoji character: ${tt}`);o.push(nt)}return new Uint8Array(o)}const base256emoji$w=from$n({prefix:"🚀",name:"base256emoji",encode:encode$N,decode:decode$X}),base256emoji$x=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$w},Symbol.toStringTag,{value:"Module"})),base32$A=rfc4648$j({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$g=rfc4648$j({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$g=rfc4648$j({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$g=rfc4648$j({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$g=rfc4648$j({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$g=rfc4648$j({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$g=rfc4648$j({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$g=rfc4648$j({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$g=rfc4648$j({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$B=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$A,base32hex:base32hex$g,base32hexpad:base32hexpad$g,base32hexpadupper:base32hexpadupper$g,base32hexupper:base32hexupper$g,base32pad:base32pad$g,base32padupper:base32padupper$g,base32upper:base32upper$g,base32z:base32z$g},Symbol.toStringTag,{value:"Module"})),base36$x=baseX$k({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$g=baseX$k({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$y=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$x,base36upper:base36upper$g},Symbol.toStringTag,{value:"Module"})),base58btc$k=baseX$k({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$g=baseX$k({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$g=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$k,base58flickr:base58flickr$g},Symbol.toStringTag,{value:"Module"})),base64$z=rfc4648$j({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$g=rfc4648$j({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$h=rfc4648$j({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$g=rfc4648$j({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$A=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$z,base64pad:base64pad$g,base64url:base64url$h,base64urlpad:base64urlpad$g},Symbol.toStringTag,{value:"Module"})),base8$w=rfc4648$j({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$x=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$w},Symbol.toStringTag,{value:"Module"})),identity$i=from$n({prefix:"\0",name:"identity",encode:et=>toString$x(et),decode:et=>fromString$w(et)}),identityBase$g=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$i},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$g={...identityBase$g,...base2$x,...base8$x,...base10$x,...base16$x,...base32$B,...base36$y,...base58$g,...base64$A,...base256emoji$x};function createCodec$h(et,o,tt,rt){return{name:et,prefix:o,encoder:{name:et,prefix:o,encode:tt},decoder:{decode:rt}}}const string$k=createCodec$h("utf8","u",et=>"u"+new TextDecoder("utf8").decode(et),et=>new TextEncoder().encode(et.substring(1))),ascii$g=createCodec$h("ascii","a",et=>{let o="a";for(let tt=0;tt{et=et.substring(1);const o=allocUnsafe$i(et.length);for(let tt=0;tt4096)return allocUnsafe$i(it);nt+it>8192&&(rt=allocUnsafe$i(8192),nt=0);const st=rt.subarray(nt,nt+=it);return nt&7&&(nt=(nt|7)+1),st}}let Op$1=class{constructor(o,tt,rt){wt(this,"fn");wt(this,"len");wt(this,"next");wt(this,"val");this.fn=o,this.len=tt,this.next=void 0,this.val=rt}};function noop$2(){}let State$1=class{constructor(o){wt(this,"head");wt(this,"tail");wt(this,"len");wt(this,"next");this.head=o.head,this.tail=o.tail,this.len=o.len,this.next=o.states}};const bufferPool=pool$1();function alloc$7(et){return globalThis.Buffer!=null?allocUnsafe$i(et):bufferPool(et)}class Uint8ArrayWriter{constructor(){wt(this,"len");wt(this,"head");wt(this,"tail");wt(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(o,tt,rt){return this.tail=this.tail.next=new Op$1(o,tt,rt),this.len+=tt,this}uint32(o){return this.len+=(this.tail=this.tail.next=new VarintOp$1((o=o>>>0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this}int32(o){return o<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(o)):this.uint32(o)}sint32(o){return this.uint32((o<<1^o>>31)>>>0)}uint64(o){const tt=LongBits$2.fromBigInt(o);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(o){return this._push(encodeUint8Array,encodingLength$6(o),o)}uint64String(o){return this.uint64(BigInt(o))}int64(o){return this.uint64(o)}int64Number(o){return this.uint64Number(o)}int64String(o){return this.uint64String(o)}sint64(o){const tt=LongBits$2.fromBigInt(o).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(o){const tt=LongBits$2.fromNumber(o).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(o){return this.sint64(BigInt(o))}bool(o){return this._push(writeByte$1,1,o?1:0)}fixed32(o){return this._push(writeFixed32$1,4,o>>>0)}sfixed32(o){return this.fixed32(o)}fixed64(o){const tt=LongBits$2.fromBigInt(o);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(o){const tt=LongBits$2.fromNumber(o);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(o){return this.fixed64(BigInt(o))}sfixed64(o){return this.fixed64(o)}sfixed64Number(o){return this.fixed64Number(o)}sfixed64String(o){return this.fixed64String(o)}float(o){return this._push(writeFloatLE,4,o)}double(o){return this._push(writeDoubleLE,8,o)}bytes(o){const tt=o.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,o)}string(o){const tt=length$6(o);return tt!==0?this.uint32(tt)._push(write$2,tt,o):this._push(writeByte$1,1,0)}fork(){return this.states=new State$1(this),this.head=this.tail=new Op$1(noop$2,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op$1(noop$2,0,0),this.len=0),this}ldelim(){const o=this.head,tt=this.tail,rt=this.len;return this.reset().uint32(rt),rt!==0&&(this.tail.next=o.next,this.tail=tt,this.len+=rt),this}finish(){let o=this.head.next;const tt=alloc$7(this.len);let rt=0;for(;o!=null;)o.fn(o.val,tt,rt),rt+=o.len,o=o.next;return tt}}function writeByte$1(et,o,tt){o[tt]=et&255}function writeVarint32$1(et,o,tt){for(;et>127;)o[tt++]=et&127|128,et>>>=7;o[tt]=et}let VarintOp$1=class extends Op$1{constructor(tt,rt){super(writeVarint32$1,tt,rt);wt(this,"next");this.next=void 0}};function writeVarint64$1(et,o,tt){for(;et.hi!==0;)o[tt++]=et.lo&127|128,et.lo=(et.lo>>>7|et.hi<<25)>>>0,et.hi>>>=7;for(;et.lo>127;)o[tt++]=et.lo&127|128,et.lo=et.lo>>>7;o[tt++]=et.lo}function writeFixed32$1(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}function writeBytes$1(et,o,tt){o.set(et,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(et){const o=et.length>>>0;return this.uint32(o),o>0&&this._push(writeBytesBuffer,o,et),this},Uint8ArrayWriter.prototype.string=function(et){const o=globalThis.Buffer.byteLength(et);return this.uint32(o),o>0&&this._push(writeStringBuffer$1,o,et),this});function writeBytesBuffer(et,o,tt){o.set(et,tt)}function writeStringBuffer$1(et,o,tt){et.length<40?write$2(et,o,tt):o.utf8Write!=null?o.utf8Write(et,tt):o.set(fromString$v(et),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(et,o){const tt=createWriter();return o.encode(et,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(et){et[et.VARINT=0]="VARINT",et[et.BIT64=1]="BIT64",et[et.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",et[et.START_GROUP=3]="START_GROUP",et[et.END_GROUP=4]="END_GROUP",et[et.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec$g(et,o,tt,rt){return{name:et,type:o,encode:tt,decode:rt}}function enumeration(et){function o(nt){if(et[nt.toString()]==null)throw new Error("Invalid enum value");return et[nt]}const tt=function(ot,it){const st=o(ot);it.int32(st)},rt=function(ot){const it=ot.int32();return o(it)};return createCodec$g("enum",CODEC_TYPES.VARINT,tt,rt)}function message$1(et,o){return createCodec$g("message",CODEC_TYPES.LENGTH_DELIMITED,et,o)}class MaxLengthError extends Error{constructor(){super(...arguments);wt(this,"code","ERR_MAX_LENGTH");wt(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);wt(this,"code","ERR_MAX_SIZE");wt(this,"name","MaxSizeError")}}function alloc$6(et=0){return globalThis.Buffer!=null&&globalThis.Buffer.alloc!=null?globalThis.Buffer.alloc(et):new Uint8Array(et)}function allocUnsafe$h(et=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(et):new Uint8Array(et)}var RateLimitProof$4;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$4.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(et){(function(tt){let rt;tt.codec=()=>(rt==null&&(rt=message$1((nt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),nt.contentTopic!=null&&nt.contentTopic!==""&&(ot.uint32(10),ot.string(nt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(nt,ot,it={})=>{const st={contentTopic:""},at=ot==null?nt.len:nt.pos+ot;for(;nt.pos>>3){case 1:{st.contentTopic=nt.string();break}default:{nt.skipType(ct&7);break}}}return st})),rt),tt.encode=nt=>encodeMessage(nt,tt.codec()),tt.decode=(nt,ot)=>decodeMessage(nt,tt.codec(),ot)})(et.ContentFilter||(et.ContentFilter={}));let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(rt.uint32(8),rt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(rt.uint32(18),rt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)rt.uint32(26),et.ContentFilter.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=nt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===nt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(et.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.messages!=null)for(const ot of tt.messages)rt.uint32(10),WakuMessage$3.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={messages:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{if(((st=nt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===nt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessage$3.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.request!=null&&(rt.uint32(18),FilterRequest.codec().encode(tt.request,rt)),tt.push!=null&&(rt.uint32(26),MessagePush$1.codec().encode(tt.push,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$3.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(et){let o;(function(nt){nt.SUBSCRIBER_PING="SUBSCRIBER_PING",nt.SUBSCRIBE="SUBSCRIBE",nt.UNSUBSCRIBE="UNSUBSCRIBE",nt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(o=et.FilterSubscribeType||(et.FilterSubscribeType={}));let tt;(function(nt){nt[nt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",nt[nt.SUBSCRIBE=1]="SUBSCRIBE",nt[nt.UNSUBSCRIBE=2]="UNSUBSCRIBE",nt[nt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(nt){nt.codec=()=>enumeration(tt)}(o=et.FilterSubscribeType||(et.FilterSubscribeType={}));let rt;et.codec=()=>(rt==null&&(rt=message$1((nt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),nt.requestId!=null&&nt.requestId!==""&&(ot.uint32(10),ot.string(nt.requestId)),nt.filterSubscribeType!=null&&tt[nt.filterSubscribeType]!==0&&(ot.uint32(16),et.FilterSubscribeType.codec().encode(nt.filterSubscribeType,ot)),nt.pubsubTopic!=null&&(ot.uint32(82),ot.string(nt.pubsubTopic)),nt.contentTopics!=null)for(const st of nt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(nt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:o.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?nt.len:nt.pos+ot;for(;nt.pos>>3){case 1:{st.requestId=nt.string();break}case 2:{st.filterSubscribeType=et.FilterSubscribeType.codec().decode(nt);break}case 10:{st.pubsubTopic=nt.string();break}case 11:{if(((ct=it.limits)==null?void 0:ct.contentTopics)!=null&&st.contentTopics.length===it.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');st.contentTopics.push(nt.string());break}default:{nt.skipType(lt&7);break}}}return st})),rt),et.encode=nt=>encodeMessage(nt,et.codec()),et.decode=(nt,ot)=>decodeMessage(nt,et.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(rt.uint32(80),rt.uint32(tt.statusCode)),tt.statusDesc!=null&&(rt.uint32(90),rt.string(tt.statusDesc)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={requestId:"",statusCode:0},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.wakuMessage!=null&&(rt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,rt)),tt.pubsubTopic!=null&&(rt.uint32(18),rt.string(tt.pubsubTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$2.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(rt.uint32(10),rt.string(tt.pubsubTopic)),tt.message!=null&&(rt.uint32(18),WakuMessage$1.codec().encode(tt.message,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={pubsubTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushRequest||(PushRequest={}));var PushResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(rt.uint32(8),rt.bool(tt.isSuccess)),tt.info!=null&&(rt.uint32(18),rt.string(tt.info)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={isSuccess:!1},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.isSuccess=tt.bool();break}case 2:{ot.info=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushResponse||(PushResponse={}));var PushRpc$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.request!=null&&(rt.uint32(18),PushRequest.codec().encode(tt.request,rt)),tt.response!=null&&(rt.uint32(26),PushResponse.codec().encode(tt.response,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PushRpc$1||(PushRpc$1={}));var RateLimitProof$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$1.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.messageHash!=null&&(rt.uint32(10),rt.bytes(tt.messageHash)),tt.message!=null&&(rt.uint32(18),WakuMessage.codec().encode(tt.message,rt)),tt.pubsubTopic!=null&&(rt.uint32(26),rt.string(tt.pubsubTopic)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(rt.uint32(16),rt.bool(tt.includeData)),tt.pubsubTopic!=null&&(rt.uint32(82),rt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)rt.uint32(90),rt.string(ot);if(tt.timeStart!=null&&(rt.uint32(96),rt.sint64(tt.timeStart)),tt.timeEnd!=null&&(rt.uint32(104),rt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)rt.uint32(162),rt.bytes(ot);tt.paginationCursor!=null&&(rt.uint32(410),rt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(rt.uint32(416),rt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(rt.uint32(424),rt.uint64(tt.paginationLimit)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.includeData=tt.bool();break}case 10:{ot.pubsubTopic=tt.string();break}case 11:{if(((st=nt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===nt.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');ot.contentTopics.push(tt.string());break}case 12:{ot.timeStart=tt.sint64();break}case 13:{ot.timeEnd=tt.sint64();break}case 20:{if(((at=nt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===nt.limits.messageHashes)throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');ot.messageHashes.push(tt.bytes());break}case 51:{ot.paginationCursor=tt.bytes();break}case 52:{ot.paginationForward=tt.bool();break}case 53:{ot.paginationLimit=tt.uint64();break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.requestId!=null&&tt.requestId!==""&&(rt.uint32(10),rt.string(tt.requestId)),tt.statusCode!=null&&(rt.uint32(80),rt.uint32(tt.statusCode)),tt.statusDesc!=null&&(rt.uint32(90),rt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)rt.uint32(162),WakuMessageKeyValue.codec().encode(ot,rt);tt.paginationCursor!=null&&(rt.uint32(410),rt.bytes(tt.paginationCursor)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={requestId:"",messages:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}case 20:{if(((st=nt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===nt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessageKeyValue.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(rt.uint32(10),rt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(rt.uint32(18),rt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(rt.uint32(26),rt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(rt.uint32(34),rt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(rt.uint32(42),rt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(rt.uint32(50),rt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(rt.uint32(58),rt.bytes(tt.rlnIdentifier)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={proof:alloc$6(0),merkleRoot:alloc$6(0),epoch:alloc$6(0),shareX:alloc$6(0),shareY:alloc$6(0),nullifier:alloc$6(0),rlnIdentifier:alloc$6(0)},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(rt.uint32(10),rt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(rt.uint32(18),rt.string(tt.contentTopic)),tt.version!=null&&(rt.uint32(24),rt.uint32(tt.version)),tt.timestamp!=null&&(rt.uint32(80),rt.sint64(tt.timestamp)),tt.meta!=null&&(rt.uint32(90),rt.bytes(tt.meta)),tt.rateLimitProof!=null&&(rt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,rt)),tt.ephemeral!=null&&(rt.uint32(248),rt.bool(tt.ephemeral)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={payload:alloc$6(0),contentTopic:""},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.enr!=null&&(rt.uint32(10),rt.bytes(tt.enr)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.numPeers!=null&&(rt.uint32(8),rt.uint64(tt.numPeers)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)rt.uint32(10),PeerInfo.codec().encode(ot,rt);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={peerInfos:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{if(((st=nt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===nt.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');ot.peerInfos.push(PeerInfo.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.query!=null&&(rt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,rt)),tt.response!=null&&(rt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,rt)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st,at;const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=nt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=nt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.clusterId!=null&&(rt.uint32(8),rt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)rt.uint32(16),rt.uint32(ot);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={shards:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=nt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===nt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{if(nt.lengthDelimited!==!1&&rt.fork(),tt.clusterId!=null&&(rt.uint32(8),rt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)rt.uint32(16),rt.uint32(ot);nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{var st;const ot={shards:[]},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=nt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===nt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(WakuMetadataResponse||(WakuMetadataResponse={}));function isDefined(et){return!!et}function groupByContentTopic(et){const o=new Map;return et.forEach(tt=>{let rt=o.get(tt.contentTopic);rt||(o.set(tt.contentTopic,[]),rt=o.get(tt.contentTopic)),rt.push(tt)}),o}const FRAME_RATE=60;async function toAsyncIterator(et,o,tt){const rt=FRAME_RATE,nt=[];let ot;ot=await et.subscribeWithUnsubscribe(o,lt=>{nt.push(lt)});const it=Number.isInteger(tt==null?void 0:tt.timeoutMs),st=0,at=Date.now();async function*ct(){for(;;){if(it&&Date.now()-at>=st)return;await wait(rt);const lt=nt.shift();if(!ot&&nt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(et){return new Promise(o=>{setTimeout(o,et)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(et,o){const tt=await et.toWire(o);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=et=>et.length/MB<=SIZE_CAP_IN_MB;var Protocols;(function(et){et.Relay="relay",et.Store="store",et.LightPush="lightpush",et.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError$1;(function(et){et.GENERIC_FAIL="Generic error",et.ENCODE_FAILED="Failed to encode",et.DECODE_FAILED="Failed to decode",et.EMPTY_PAYLOAD="Payload is empty",et.SIZE_TOO_BIG="Size is too big",et.TOPIC_NOT_CONFIGURED="Topic not configured",et.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",et.INVALID_DECODER_TOPICS="Invalid decoder topics",et.NO_PEER_AVAILABLE="No peer available",et.NO_STREAM_AVAILABLE="No stream available",et.NO_RESPONSE="No response received",et.REMOTE_PEER_REJECTED="Remote peer rejected",et.REQUEST_TIMEOUT="Request timeout",et.RLN_IDENTITY_MISSING="Identity credentials are not set",et.RLN_MEMBERSHIP_INDEX="Membership index is not set",et.RLN_LIMIT_MISSING="User message limit is not set",et.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags;(function(et){et.BOOTSTRAP="bootstrap",et.PEER_EXCHANGE="peer-exchange",et.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(et){et.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",et.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",et.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",et.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(et){et.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents||(EConnectionStateEvents={}));const DNS_DISCOVERY_TAG="@waku/bootstrap",DEFAULT_CLUSTER_ID=1,DefaultShardInfo={clusterId:DEFAULT_CLUSTER_ID,shards:[0,1,2,3,4,5,6,7,8]},DefaultNetworkConfig=DefaultShardInfo;var HealthStatus;(function(et){et.Unhealthy="Unhealthy",et.MinimallyHealthy="MinimallyHealthy",et.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function coerce$j(et){if(et instanceof Uint8Array&&et.constructor.name==="Uint8Array")return et;if(et instanceof ArrayBuffer)return new Uint8Array(et);if(ArrayBuffer.isView(et))return new Uint8Array(et.buffer,et.byteOffset,et.byteLength);throw new Error("Unknown type, must be binary type")}function fromString$u(et){return new TextEncoder().encode(et)}function toString$w(et){return new TextDecoder().decode(et)}function base$k(et,o){if(et.length>=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$k=base$k,_brrp__multiformats_scope_baseX$j=src$k;let Encoder$l=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$l=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$l(this,o)}},ComposedDecoder$j=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$l(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$l(et,o){return new ComposedDecoder$j({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$j=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$l(o,tt,rt),this.decoder=new Decoder$l(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$m({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$j(et,o,tt,rt)}function baseX$j({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$j(tt,et);return from$m({prefix:o,name:et,encode:rt,decode:ot=>coerce$j(nt(ot))})}function decode$W(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$M(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<(et[tt]=o,et),[]),alphabetCharsToBytes$f=alphabet$f.reduce((et,o,tt)=>{const rt=o.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${o}`);return et[rt]=tt,et},[]);function encode$L(et){return et.reduce((o,tt)=>(o+=alphabetBytesToChars$f[tt],o),"")}function decode$V(et){const o=[];for(const tt of et){const rt=tt.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${tt}`);const nt=alphabetCharsToBytes$f[rt];if(nt==null)throw new Error(`Non-base256emoji character: ${tt}`);o.push(nt)}return new Uint8Array(o)}const base256emoji$u=from$m({prefix:"🚀",name:"base256emoji",encode:encode$L,decode:decode$V}),base256emoji$v=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$u},Symbol.toStringTag,{value:"Module"})),base32$y=rfc4648$i({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper$f=rfc4648$i({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad$f=rfc4648$i({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper$f=rfc4648$i({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex$f=rfc4648$i({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper$f=rfc4648$i({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad$f=rfc4648$i({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper$f=rfc4648$i({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z$f=rfc4648$i({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$z=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$y,base32hex:base32hex$f,base32hexpad:base32hexpad$f,base32hexpadupper:base32hexpadupper$f,base32hexupper:base32hexupper$f,base32pad:base32pad$f,base32padupper:base32padupper$f,base32upper:base32upper$f,base32z:base32z$f},Symbol.toStringTag,{value:"Module"})),base36$v=baseX$j({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper$f=baseX$j({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$w=Object.freeze(Object.defineProperty({__proto__:null,base36:base36$v,base36upper:base36upper$f},Symbol.toStringTag,{value:"Module"})),base58btc$j=baseX$j({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr$f=baseX$j({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58$f=Object.freeze(Object.defineProperty({__proto__:null,base58btc:base58btc$j,base58flickr:base58flickr$f},Symbol.toStringTag,{value:"Module"})),base64$x=rfc4648$i({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$f=rfc4648$i({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$g=rfc4648$i({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$f=rfc4648$i({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$y=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$x,base64pad:base64pad$f,base64url:base64url$g,base64urlpad:base64urlpad$f},Symbol.toStringTag,{value:"Module"})),base8$u=rfc4648$i({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$v=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$u},Symbol.toStringTag,{value:"Module"})),identity$h=from$m({prefix:"\0",name:"identity",encode:et=>toString$w(et),decode:et=>fromString$u(et)}),identityBase$f=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$h},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$f={...identityBase$f,...base2$v,...base8$v,...base10$v,...base16$v,...base32$z,...base36$w,...base58$f,...base64$y,...base256emoji$v};function allocUnsafe$g(et=0){return new Uint8Array(et)}function createCodec$f(et,o,tt,rt){return{name:et,prefix:o,encoder:{name:et,prefix:o,encode:tt},decoder:{decode:rt}}}const string$j=createCodec$f("utf8","u",et=>"u"+new TextDecoder("utf8").decode(et),et=>new TextEncoder().encode(et.substring(1))),ascii$f=createCodec$f("ascii","a",et=>{let o="a";for(let tt=0;tt{et=et.substring(1);const o=allocUnsafe$g(et.length);for(let tt=0;tttoString$v(et,"base16"),bytesToUtf8=et=>toString$v(et,"utf8"),utf8ToBytes$1=et=>fromString$t(et,"utf8");function concat$5(et,o){const tt=et.reduce((ot,it)=>ot+it.length,0),rt=new Uint8Array(tt);let nt=0;for(const ot of et)rt.set(ot,nt),nt+=ot.length;return rt}function isStaticSharding(et){return"clusterId"in et&&"shards"in et&&!("contentTopics"in et)}function isAutoSharding(et){return"contentTopics"in et}function derivePubsubTopicsFromNetworkConfig(et){if(isStaticSharding(et)){if(et.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(et)}else if(isAutoSharding(et)){if(et.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return et.contentTopics.map(o=>contentTopicToPubsubTopic(o,et.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=et=>{if(et.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${et.clusterId??DEFAULT_CLUSTER_ID}/${et.shard}`},shardInfoToPubsubTopics=et=>{if("contentTopics"in et&&et.contentTopics)return Array.from(new Set(et.contentTopics.map(o=>contentTopicToPubsubTopic(o,et.clusterId))));if("shards"in et){if(et.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(et.shards.map(o=>`/waku/2/rs/${et.clusterId??DEFAULT_CLUSTER_ID}/${o}`)))}else{if("application"in et&&"version"in et)return[contentTopicToPubsubTopic(`/${et.application}/${et.version}/default/default`,et.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=et=>{const o=et.split("/");if(o.length!=6||o[1]!=="waku"||o[2]!=="2"||o[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(o[4]),rt=parseInt(o[5]);if(isNaN(tt)||isNaN(rt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:rt}},pubsubTopicsToShardInfo=et=>{const o=new Set,tt=new Set;for(const ot of et){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);o.add(`${it}:${st}`),tt.add(it)}if(o.size===0)throw new Error("No valid pubsub topics provided");if(tt.size>1)throw new Error("Pubsub topics from multiple cluster IDs are not supported");const rt=tt.values().next().value,nt=Array.from(o).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:rt,shards:nt}};function ensurePubsubTopicIsConfigured(et,o){if(!o.includes(et))throw new Error(`Pubsub topic ${et} has not been configured on this instance. Configured topics are: ${o}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(et){const o=et.split("/");if(o.length<5||o.length>6)throw Error("Content topic format is invalid");let tt=0;if(o.length==6){if(tt=parseInt(o[1]),isNaN(tt))throw new Error("Invalid generation field in content topic");if(tt>0)throw new Error("Generation greater than 0 is not supported")}const rt=o.splice(-4);if(rt[0].length==0)throw new Error("Application field cannot be empty");if(rt[1].length==0)throw new Error("Version field cannot be empty");if(rt[2].length==0)throw new Error("Topic name field cannot be empty");if(rt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:rt[0],version:rt[1],topicName:rt[2],encoding:rt[3]}}function contentTopicToShardIndex(et,o=8){const{application:tt,version:rt}=ensureValidContentTopic(et),nt=sha256$3(concat$5([utf8ToBytes$1(tt),utf8ToBytes$1(rt)])),ot=new DataView(nt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(o))}function contentTopicToPubsubTopic(et,o=DEFAULT_CLUSTER_ID,tt=8){if(!et)throw Error("Content topic must be specified");const rt=contentTopicToShardIndex(et,tt);return`/waku/2/rs/${o}/${rt}`}function determinePubsubTopic(et,o){return typeof o=="string"?o:(o==null?void 0:o.shard)!==void 0?singleShardInfoToPubsubTopic(o):contentTopicToPubsubTopic(et,(o==null?void 0:o.clusterId)??DEFAULT_CLUSTER_ID)}const decodeRelayShard=et=>{if(et=new Uint8Array(et),et.length<3)throw new Error("Insufficient data");const o=new DataView(et.buffer),tt=o.getUint16(0),rt=[];if(et.length===130)for(let nt=0;nt<1024;nt++){const ot=Math.floor(nt/8)+2,it=7-nt%8;o.getUint8(ot)&1<=et.length)throw new Error("Unexpected end of data");rt.push(o.getUint16(it))}}return{clusterId:tt,shards:rt}},encodeRelayShard=et=>{const{clusterId:o,shards:tt}=et,rt=tt.length>=64?130:3+2*tt.length,nt=new ArrayBuffer(rt),ot=new DataView(nt);if(ot.setUint16(0,o),tt.length>=64)for(const it of tt){const st=Math.floor(it/8)+2,at=7-it%8;ot.setUint8(st,ot.getUint8(st)|1<tt.toString().includes("ws")||tt.toString().includes("wss"));if(!o)throw new Error("No ws multiaddr found in the given addresses");return o}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var et=1e3,o=et*60,tt=o*60,rt=tt*24,nt=rt*7,ot=rt*365.25;ms$1=function(lt,dt){dt=dt||{};var ht=typeof lt;if(ht==="string"&<.length>0)return it(lt);if(ht==="number"&&isFinite(lt))return dt.long?at(lt):st(lt);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(lt))};function it(lt){if(lt=String(lt),!(lt.length>100)){var dt=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(lt);if(dt){var ht=parseFloat(dt[1]),mt=(dt[2]||"ms").toLowerCase();switch(mt){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*nt;case"days":case"day":case"d":return ht*rt;case"hours":case"hour":case"hrs":case"hr":case"h":return ht*tt;case"minutes":case"minute":case"mins":case"min":case"m":return ht*o;case"seconds":case"second":case"secs":case"sec":case"s":return ht*et;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=rt?Math.round(lt/rt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=o?Math.round(lt/o)+"m":dt>=et?Math.round(lt/et)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=rt?ct(lt,dt,rt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=o?ct(lt,dt,o,"minute"):dt>=et?ct(lt,dt,et,"second"):lt+" ms"}function ct(lt,dt,ht,mt){var ft=dt>=ht*1.5;return Math.round(lt/ht)+" "+mt+(ft?"s":"")}return ms$1}function setup$1(et){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=nt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(et).forEach(lt=>{tt[lt]=et[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function o(lt){let dt=0;for(let ht=0;ht{if(Ct==="%%")return"%";vt++;const At=tt.formatters[St];if(typeof At=="function"){const kt=yt[vt];Ct=At.call(gt,kt),yt.splice(vt,1),vt--}return Ct}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return pt.namespace=lt,pt.useColors=tt.useColors(),pt.color=tt.selectColor(lt),pt.extend=rt,pt.destroy=tt.destroy,Object.defineProperty(pt,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(mt!==tt.namespaces&&(mt=tt.namespaces,ft=tt.enabled(lt)),ft),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(pt),pt}function rt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function nt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),mt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt{let lt=!1;return()=>{lt||(lt=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),o.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function nt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let lt;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(lt=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(lt[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ot(lt){if(lt[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+lt[0]+(this.useColors?"%c ":" ")+"+"+et.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,mt=0;lt[0].replace(/%[a-zA-Z%]/g,ft=>{ft!=="%%"&&(ht++,ft==="%c"&&(mt=ht))}),lt.splice(mt,0,dt)}o.log=console.debug||console.log||(()=>{});function it(lt){try{lt?o.storage.setItem("debug",lt):o.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=o.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=rt.DEBUG),lt}function at(){try{return localStorage}catch{}}et.exports=common$1(o);const{formatters:ct}=et.exports;ct.j=function(lt){try{return JSON.stringify(lt)}catch(dt){return"[UnexpectedJSONParseError]: "+dt.message}}})(browser,browser.exports);var browserExports=browser.exports;const debug=getDefaultExportFromCjs(browserExports),APP_NAME="waku";let Logger$1=class _i{constructor(o){wt(this,"_info");wt(this,"_warn");wt(this,"_error");this._info=debug(_i.createDebugNamespace("info",o)),this._warn=debug(_i.createDebugNamespace("warn",o)),this._error=debug(_i.createDebugNamespace("error",o))}static createDebugNamespace(o,tt){return tt?`${APP_NAME}:${o}:${tt}`:`${APP_NAME}:${o}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(o,...tt){const rt=this[o];rt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(o,tt){wt(this,"pubsubTopic");wt(this,"proto");this.pubsubTopic=o,this.proto=tt}get ephemeral(){return!!this.proto.ephemeral}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const o=this.proto.timestamp/OneMillion;return new Date(Number(o))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$k=class{constructor(o,tt=!1,rt,nt){wt(this,"contentTopic");wt(this,"ephemeral");wt(this,"pubsubTopic");wt(this,"metaSetter");if(this.contentTopic=o,this.ephemeral=tt,this.pubsubTopic=rt,this.metaSetter=nt,!o||o==="")throw new Error("Content topic must be specified")}async toWire(o){return WakuMessage$4.encode(await this.toProtoObj(o))}async toProtoObj(o){const tt=o.timestamp??new Date,rt={payload:o.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:o.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const nt=this.metaSetter(rt);return{...rt,meta:nt}}return rt}};function createEncoder({pubsubTopic:et,pubsubTopicShardInfo:o,contentTopic:tt,ephemeral:rt,metaSetter:nt}){return new Encoder$k(tt,rt,determinePubsubTopic(tt,et??o),nt)}let Decoder$k=class{constructor(o,tt){wt(this,"pubsubTopic");wt(this,"contentTopic");if(this.pubsubTopic=o,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(o){const tt=WakuMessage$4.decode(o);return Promise.resolve({payload:tt.payload,contentTopic:tt.contentTopic,version:tt.version??void 0,timestamp:tt.timestamp??void 0,meta:tt.meta??void 0,rateLimitProof:tt.rateLimitProof??void 0,ephemeral:tt.ephemeral??!1})}async fromProtoObj(o,tt){return tt.version??Version!==0?(log$o.error("Failed to decode due to incorrect version, expected:",Version,", actual:",tt.version),Promise.resolve(void 0)):new DecodedMessage(o,tt)}};function createDecoder(et,o){return new Decoder$k(determinePubsubTopic(et,o),et)}function isAsyncIterable$8(et){return et[Symbol.asyncIterator]!=null}function all$2(et){if(isAsyncIterable$8(et))return(async()=>{const tt=[];for await(const rt of et)tt.push(rt);return tt})();const o=[];for(const tt of et)o.push(tt);return o}function alloc$5(et=0){return new Uint8Array(et)}function allocUnsafe$f(et=0){return new Uint8Array(et)}function asUint8Array$3(et){return et}function concat$4(et,o){o==null&&(o=et.reduce((nt,ot)=>nt+ot.length,0));const tt=allocUnsafe$f(o);let rt=0;for(const nt of et)tt.set(nt,rt),rt+=nt.length;return tt}function equals$f(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(o)}*[(Zs=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...o){this.appendAll(o)}appendAll(o){let tt=0;for(const rt of o)if(rt instanceof Uint8Array)tt+=rt.byteLength,this.bufs.push(rt);else if(isUint8ArrayList(rt))tt+=rt.byteLength,this.bufs.push(...rt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...o){this.prependAll(o)}prependAll(o){let tt=0;for(const rt of o.reverse())if(rt instanceof Uint8Array)tt+=rt.byteLength,this.bufs.unshift(rt);else if(isUint8ArrayList(rt))tt+=rt.byteLength,this.bufs.unshift(...rt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(o){const tt=findBufAndOffset(this.bufs,o);return tt.buf[tt.index]}set(o,tt){const rt=findBufAndOffset(this.bufs,o);rt.buf[rt.index]=tt}write(o,tt=0){if(o instanceof Uint8Array)for(let rt=0;rt0;)if(o>=this.bufs[0].byteLength)o-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(o),this.length-=o;break}}}slice(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt);return concat$4(rt,nt)}subarray(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt);return rt.length===1?rt[0]:concat$4(rt,nt)}sublist(o,tt){const{bufs:rt,length:nt}=this._subList(o,tt),ot=new Uint8ArrayList;return ot.length=nt,ot.bufs=[...rt],ot}_subList(o,tt){if(o=o??0,tt=tt??this.length,o<0&&(o=this.length+o),tt<0&&(tt=this.length+tt),o<0||tt>this.length)throw new RangeError("index is out of bounds");if(o===tt)return{bufs:[],length:0};if(o===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const rt=[];let nt=0;for(let ot=0;ot=at)continue;const ct=o>=st&&ost&&tt<=at;if(ct&<){if(o===st&&tt===at){rt.push(it);break}const dt=o-st;rt.push(it.subarray(dt,dt+(tt-o)));break}if(ct){if(o===0){rt.push(it);continue}rt.push(it.subarray(o-st));continue}if(lt){if(tt===at){rt.push(it);break}rt.push(it.subarray(0,tt-st));break}rt.push(it)}return{bufs:rt,length:tt-o}}indexOf(o,tt=0){if(!isUint8ArrayList(o)&&!(o instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const rt=o instanceof Uint8Array?o:o.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),o.length===0)return tt>this.length?this.length:tt;const nt=rt.byteLength;if(nt===0)throw new TypeError("search must be at least 1 byte long");const ot=256,it=new Int32Array(ot);for(let dt=0;dt=0;ht--){const mt=this.get(dt+ht);if(rt[ht]!==mt){lt=Math.max(1,ht-st[mt]);break}}if(lt===0)return dt}return-1}getInt8(o){const tt=this.subarray(o,o+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(o,tt){const rt=allocUnsafe$f(1);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt8(0,tt),this.write(rt,o)}getInt16(o,tt){const rt=this.subarray(o,o+2);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getInt16(0,tt)}setInt16(o,tt,rt){const nt=alloc$5(2);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt16(0,tt,rt),this.write(nt,o)}getInt32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getInt32(0,tt)}setInt32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt32(0,tt,rt),this.write(nt,o)}getBigInt64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getBigInt64(0,tt)}setBigInt64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setBigInt64(0,tt,rt),this.write(nt,o)}getUint8(o){const tt=this.subarray(o,o+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(o,tt){const rt=allocUnsafe$f(1);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint8(0,tt),this.write(rt,o)}getUint16(o,tt){const rt=this.subarray(o,o+2);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getUint16(0,tt)}setUint16(o,tt,rt){const nt=alloc$5(2);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint16(0,tt,rt),this.write(nt,o)}getUint32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getUint32(0,tt)}setUint32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint32(0,tt,rt),this.write(nt,o)}getBigUint64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getBigUint64(0,tt)}setBigUint64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setBigUint64(0,tt,rt),this.write(nt,o)}getFloat32(o,tt){const rt=this.subarray(o,o+4);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getFloat32(0,tt)}setFloat32(o,tt,rt){const nt=alloc$5(4);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat32(0,tt,rt),this.write(nt,o)}getFloat64(o,tt){const rt=this.subarray(o,o+8);return new DataView(rt.buffer,rt.byteOffset,rt.byteLength).getFloat64(0,tt)}setFloat64(o,tt,rt){const nt=alloc$5(8);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setFloat64(0,tt,rt),this.write(nt,o)}equals(o){if(o==null||!(o instanceof Uint8ArrayList)||o.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttnt+ot.byteLength,0)),rt.length=tt,rt}}function allocUnsafe$e(et=0){return new Uint8Array(et)}function isAsyncIterable$7(et){return et[Symbol.asyncIterator]!=null}const defaultEncoder=et=>{const o=encodingLength$6(et),tt=allocUnsafe$e(o);return encode$P(et,tt),defaultEncoder.bytes=o,tt};defaultEncoder.bytes=0;function encode$K(et,o){o=o??{};const tt=o.lengthEncoder??defaultEncoder;function*rt(nt){const ot=tt(nt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,nt instanceof Uint8Array?yield nt:yield*nt}return isAsyncIterable$7(et)?async function*(){for await(const nt of et)yield*rt(nt)}():function*(){for(const nt of et)yield*rt(nt)}()}encode$K.single=(et,o)=>{o=o??{};const tt=o.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(et.byteLength),et)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidMessageLengthError");wt(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidDataLengthError");wt(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","InvalidDataLengthLengthError");wt(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);wt(this,"name","UnexpectedEOFError");wt(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(et){et[et.LENGTH=0]="LENGTH",et[et.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=et=>{const o=decode$Z(et);return defaultDecoder.bytes=encodingLength$6(o),o};defaultDecoder.bytes=0;function decode$U(et,o){const tt=new Uint8ArrayList;let rt=ReadMode.LENGTH,nt=-1;const ot=(o==null?void 0:o.lengthDecoder)??defaultDecoder,it=(o==null?void 0:o.maxLengthLength)??MAX_LENGTH_LENGTH,st=(o==null?void 0:o.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(rt===ReadMode.LENGTH)try{if(nt=ot(tt),nt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(nt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(o==null?void 0:o.onLength)!=null&&o.onLength(nt),rt=ReadMode.DATA}catch(ct){if(ct instanceof RangeError){if(tt.byteLength>it)throw new InvalidDataLengthLengthError$1("Message length length too long");break}throw ct}if(rt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of et)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$U.fromReader=(et,o)=>{let tt=1;const rt=async function*(){for(;;)try{const{done:ot,value:it}=await et.next(tt);if(ot===!0)return;it!=null&&(yield it)}catch(ot){if(ot.code==="ERR_UNDER_READ")return{done:!0,value:null};throw ot}finally{tt=1}}();return decode$U(rt,{...o??{},onLength:ot=>{tt=ot}})};function pDefer(){const et={};return et.promise=new Promise((o,tt)=>{et.resolve=o,et.reject=tt}),et}class FixedFIFO{constructor(o){wt(this,"buffer");wt(this,"mask");wt(this,"top");wt(this,"btm");wt(this,"next");if(!(o>0)||o-1&o)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(o),this.mask=o-1,this.top=0,this.btm=0,this.next=null}push(o){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=o,this.top=this.top+1&this.mask,!0)}shift(){const o=this.buffer[this.btm];if(o!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,o}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(o={}){wt(this,"size");wt(this,"hwm");wt(this,"head");wt(this,"tail");this.hwm=o.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(o){return(o==null?void 0:o.byteLength)!=null?o.byteLength:1}push(o){if((o==null?void 0:o.value)!=null&&(this.size+=this.calculateSize(o.value)),!this.head.push(o)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(o)}}shift(){let o=this.tail.shift();if(o===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,o=this.tail.shift()}return(o==null?void 0:o.value)!=null&&(this.size-=this.calculateSize(o.value)),o}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,rt){super(tt??"The operation was aborted");wt(this,"type");wt(this,"code");this.type="aborted",this.code=rt??"ABORT_ERR"}};function pushable(et={}){return _pushable(tt=>{const rt=tt.shift();if(rt==null)return{done:!0};if(rt.error!=null)throw rt.error;return{done:rt.done===!0,value:rt.value}},et)}function _pushable(et,o){o=o??{};let tt=o.onEnd,rt=new FIFO,nt,ot,it,st=pDefer();const at=async()=>{try{return rt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=bt=>{ot=null,rt.push(bt);try{yt(et(rt))}catch(xt){gt(xt)}return nt}}):et(rt)}finally{rt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(rt.push(yt),nt),lt=yt=>(rt=new FIFO,ot!=null?ot({error:yt}):(rt.push({error:yt}),nt)),dt=yt=>{if(it)return nt;if((o==null?void 0:o.objectMode)!==!0&&(yt==null?void 0:yt.byteLength)==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return ct({done:!1,value:yt})},ht=yt=>it?nt:(it=!0,yt!=null?lt(yt):ct({done:!0})),mt=()=>(rt=new FIFO,ht(),{done:!0}),ft=yt=>(ht(yt),{done:!0});if(nt={[Symbol.asyncIterator](){return this},next:at,return:mt,throw:ft,push:dt,end:ht,get readableLength(){return rt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),rt.isEmpty())return;let bt,xt;gt!=null&&(bt=new Promise((vt,Et)=>{xt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",xt)}));try{await Promise.race([st.promise,bt])}finally{xt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",xt))}}},tt==null)return nt;const pt=nt;return nt={[Symbol.asyncIterator](){return this},next(){return pt.next()},throw(yt){return pt.throw(yt),tt!=null&&(tt(yt),tt=void 0),{done:!0}},return(){return pt.return(),tt!=null&&(tt(),tt=void 0),{done:!0}},push:dt,end(yt){return pt.end(yt),tt!=null&&(tt(yt),tt=void 0),nt},get readableLength(){return pt.readableLength},onEmpty:yt=>pt.onEmpty(yt)},nt}function isAsyncIterable$6(et){return et[Symbol.asyncIterator]!=null}function merge$2(...et){const o=[];for(const tt of et)isAsyncIterable$6(tt)||o.push(tt);return o.length===et.length?function*(){for(const tt of o)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(et.map(async rt=>{for await(const nt of rt)tt.push(nt)})),tt.end()}catch(rt){tt.end(rt)}}),yield*tt}()}function pipe(et,...o){if(et==null)throw new Error("Empty pipeline");if(isDuplex(et)){const rt=et;et=()=>rt.source}else if(isIterable(et)||isAsyncIterable$5(et)){const rt=et;et=()=>rt}const tt=[et,...o];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let rt=1;rt{let o;for(;et.length>0;)o=et.shift()(o);return o},isAsyncIterable$5=et=>(et==null?void 0:et[Symbol.asyncIterator])!=null,isIterable=et=>(et==null?void 0:et[Symbol.iterator])!=null,isDuplex=et=>et==null?!1:et.sink!=null&&et.source!=null,duplexPipelineFn=et=>o=>{const tt=et.sink(o);if((tt==null?void 0:tt.then)!=null){const rt=pushable({objectMode:!0});tt.then(()=>{rt.end()},it=>{rt.end(it)});let nt;const ot=et.source;if(isAsyncIterable$5(ot))nt=async function*(){yield*ot,rt.end()};else if(isIterable(ot))nt=function*(){yield*ot,rt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(rt,nt())}return et.source};async function sortPeersByLatency(et,o){return o.length===0?[]:(await Promise.all(o.map(async nt=>{try{const ot=(await et.get(nt.id)).metadata.get("ping");if(!ot)return{peer:nt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:nt,ping:it}}catch{return{peer:nt,ping:1/0}}}))).filter(nt=>nt!==null).sort((nt,ot)=>nt.ping-ot.ping).map(nt=>nt.peer)}async function getPeersForProtocol(et,o){const tt=[];return await et.forEach(rt=>{for(let nt=0;ntit.tags.has(Tags.BOOTSTRAP)).slice(0,tt);o>0&&o!it.tags.has(Tags.BOOTSTRAP));if(o===0)return[...rt,...nt];const ot=[...rt];for(;ot.length0;){const it=Math.floor(Math.random()*nt.length),st=nt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(et){return et.filter(o=>o.status==="open").sort((o,tt)=>tt.timeline.open-o.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(o,tt,rt){wt(this,"multicodec");wt(this,"getConnections");wt(this,"addEventListener");wt(this,"log");wt(this,"ongoingCreation",new Set);wt(this,"streamPool",new Map);wt(this,"handlePeerUpdateStreamPool",o=>{const{peer:tt}=o.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=o,this.getConnections=tt,this.addEventListener=rt,this.log=new Logger$1(`stream-manager:${o}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(o){const tt=o.id.toString(),rt=this.streamPool.get(tt);rt&&(this.streamPool.delete(tt),await rt);let nt=this.getOpenStreamForCodec(o.id);return nt?(this.log.info(`Found existing stream peerId=${o.id.toString()} multicodec=${this.multicodec}`),this.lockStream(o.id.toString(),nt),nt):(nt=await this.createStream(o),this.lockStream(o.id.toString(),nt),nt)}async createStream(o,tt=0){const rt=this.getConnections(o.id),nt=selectOpenConnection(rt);if(!nt)throw new Error(`Failed to get a connection to the peer peerId=${o.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!nt||["done","closed","closing"].includes(nt.writeStatus||"")||this.isStreamLocked(nt)))return nt}lockStream(o,tt){this.log.info(`Locking stream for peerId:${o} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(o){return!!o.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(o,tt,rt,nt){wt(this,"multicodec");wt(this,"components");wt(this,"log");wt(this,"pubsubTopics");wt(this,"addLibp2pEventListener");wt(this,"removeLibp2pEventListener");wt(this,"streamManager");this.multicodec=o,this.components=tt,this.log=rt,this.pubsubTopics=nt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(o,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(o){return this.streamManager.getStream(o)}async allPeers(){return getPeersForProtocol(this.components.peerStore,[this.multicodec])}async connectedPeers(){return(await this.allPeers()).filter(tt=>this.components.connectionManager.getConnections(tt.id).length>0)}async getPeers({numPeers:o,maxBootstrapPeers:tt,peerIdStr:rt}={maxBootstrapPeers:0,numPeers:0}){if(rt){const st=(await this.connectedPeers()).find(at=>at.id.toString()===rt);return st?[st]:(this.log.warn(`Passed node to use for ${this.multicodec} not found: ${rt}. Attempting to use random peers.`),this.getPeers({numPeers:o,maxBootstrapPeers:tt}))}const nt=await this.connectedPeers(),ot=filterPeersByDiscovery(nt,o,tt),it=await sortPeersByLatency(this.components.peerStore,ot);return it.length===0&&this.log.warn("No peers found. Ensure you have a connection to the network."),it.length{log$n.error("Failed to register ",FilterCodecs.PUSH,ot)})}async subscribe(tt,rt,nt){const ot=await this.getStream(rt),it=FilterSubscribeRpc.createSubscribeRequest(tt,nt);let st;try{st=await pipe([it.encode()],encode$K,ot,decode$U,async dt=>await all$2(dt))}catch(dt){return log$n.error("Failed to send subscribe request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}const{statusCode:at,requestId:ct,statusDesc:lt}=FilterSubscribeResponse.decode(st[0].slice());return at<200||at>=300?(log$n.error(`Filter subscribe request ${ct} failed with status code ${at}: ${lt}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id},success:null}):{failure:null,success:rt.id}}async unsubscribe(tt,rt,nt){let ot;try{ot=await this.getStream(rt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${rt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:rt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,nt);try{await pipe([it.encode()],encode$K,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}return{success:rt.id,failure:null}}async unsubscribeAll(tt,rt){const nt=await this.getStream(rt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$K,nt,decode$U,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$1.NO_RESPONSE,peerId:rt.id},success:null};const{statusCode:st,requestId:at,statusDesc:ct}=FilterSubscribeResponse.decode(it[0].slice());return st<200||st>=300?(log$n.error(`Filter unsubscribe all request ${at} failed with status code ${st}: ${ct}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id},success:null}):{failure:null,success:rt.id}}async ping(tt){let rt;try{rt=await this.getStream(tt)}catch(ct){return log$n.error(`Failed to get a stream for remote peer${tt.id.toString()}`,ct),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:tt.id}}}const nt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([nt.encode()],encode$K,rt,decode$U,async ct=>await all$2(ct))}catch(ct){return log$n.error("Failed to send ping request",ct),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:tt.id}}}if(!ot||!ot.length)return{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:tt.id}};const{statusCode:it,requestId:st,statusDesc:at}=FilterSubscribeResponse.decode(ot[0].slice());return it<200||it>=300?(log$n.error(`Filter ping request ${st} failed with status code ${it}: ${at}`),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:tt.id}}):{success:tt.id,failure:null}}onRequest(tt){const{connection:rt,stream:nt}=tt,{remotePeer:ot}=rt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(nt,decode$U,async it=>{for await(const st of it){const at=FilterPushRpc.decode(st.slice()),{pubsubTopic:ct,wakuMessage:lt}=at;if(!lt){log$n.error("Received empty message");return}if(!ct){log$n.error("Pubsub topic missing from push message");return}await this.handleIncomingMessage(ct,lt,rt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${rt.remotePeer.toString()} -- stream:${nt.id} -- protocol:${nt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}class PushRpc{constructor(o){wt(this,"proto");this.proto=o}static createRequest(o,tt){return new PushRpc({requestId:v4$2(),request:{message:o,pubsubTopic:tt},response:void 0})}static decode(o){const tt=PushRpc$1.decode(o);return new PushRpc(tt)}encode(){return PushRpc$1.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const RLN_GENERATION_PREFIX_ERROR="could not generate rln-v2 proof",isRLNResponseError=et=>et?et.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=et=>{const o={[ProtocolError$1.RLN_IDENTITY_MISSING]:ProtocolError$1.RLN_IDENTITY_MISSING,[ProtocolError$1.RLN_MEMBERSHIP_INDEX]:ProtocolError$1.RLN_MEMBERSHIP_INDEX,[ProtocolError$1.RLN_LIMIT_MISSING]:ProtocolError$1.RLN_LIMIT_MISSING},tt=et.toLowerCase();for(const rt in o)if(tt.includes(rt.toLowerCase()))return o[rt];return ProtocolError$1.RLN_PROOF_GENERATION},log$m=new Logger$1("light-push"),LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";class LightPushCore extends BaseProtocol{constructor(tt,rt){super(LightPushCodec,rt.components,log$m,tt);wt(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,rt){try{if(!rt.payload||rt.payload.length===0)return log$m.error("Failed to send waku light push: payload is empty"),{query:null,error:ProtocolError$1.EMPTY_PAYLOAD};if(!await isMessageSizeUnderCap(tt,rt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$1.SIZE_TOO_BIG};const nt=await tt.toProtoObj(rt);return nt?{query:PushRpc.createRequest(nt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$1.ENCODE_FAILED})}catch(nt){return log$m.error("Failed to prepare push message",nt),{query:null,error:ProtocolError$1.GENERIC_FAIL}}}async send(tt,rt,nt){const{query:ot,error:it}=await this.preparePushMessage(tt,rt);if(it||!ot)return{success:null,failure:{error:it,peerId:nt.id}};let st;try{st=await this.getStream(nt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:nt.id}}}let at;try{at=await pipe([ot.encode()],encode$K,st,decode$U,async dt=>await all$2(dt))}catch(dt){return log$m.error("Failed to send waku light push request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}const ct=new Uint8ArrayList;at.forEach(dt=>{ct.append(dt)});let lt;try{lt=PushRpc.decode(ct).response}catch(dt){return log$m.error("Failed to decode push reply",dt),{success:null,failure:{error:ProtocolError$1.DECODE_FAILED,peerId:nt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:nt.id}};if(isRLNResponseError(lt.info)){const dt=matchRLNErrorMessage(lt.info);return log$m.error("Remote peer rejected the message: ",dt),{success:null,failure:{error:dt,peerId:nt.id}}}return lt.isSuccess?{success:nt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(et){return{...EmptyMessage,...et}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;class StoreQueryRequest{constructor(o){wt(this,"proto");this.proto=o}static create(o){const tt=new StoreQueryRequest({...o,requestId:v4$2(),timeStart:o.timeStart?BigInt(o.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:o.timeEnd?BigInt(o.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:o.messageHashes||[],paginationLimit:o.paginationLimit?BigInt(o.paginationLimit):void 0});if(o.pubsubTopic&&!o.contentTopics||!o.pubsubTopic&&o.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(o.messageHashes&&(o.pubsubTopic||o.contentTopics||o.timeStart||o.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(o){const tt=StoreQueryRequest$1.decode(o);return new StoreQueryRequest(tt)}encode(){return StoreQueryRequest$1.encode(this.proto)}}class StoreQueryResponse{constructor(o){wt(this,"proto");this.proto=o}static decode(o){const tt=StoreQueryResponse$1.decode(o);return new StoreQueryResponse(tt)}encode(){return StoreQueryResponse$1.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get messages(){return this.proto.messages}get paginationCursor(){return this.proto.paginationCursor}}const log$l=new Logger$1("store"),StoreCodec="/vac/waku/store-query/3.0.0";class StoreCore extends BaseProtocol{constructor(tt,rt){super(StoreCodec,rt.components,log$l,tt);wt(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,rt,nt){if(tt.contentTopics.toString()!==Array.from(rt.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let ot=tt.paginationCursor;for(;;){const it=StoreQueryRequest.create({...tt,paginationCursor:ot});let st;try{st=await this.getStream(nt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$K,st,decode$U,async ht=>await all$2(ht)),ct=new Uint8ArrayList;at.forEach(ht=>{ct.append(ht)});const lt=StoreQueryResponse.decode(ct);if(!lt.statusCode||lt.statusCode>=300){const ht=`Store query failed with status code: ${lt.statusCode}, description: ${lt.statusDesc}`;throw log$l.error(ht),new Error(ht)}if(!lt.messages||!lt.messages.length){log$l.warn("Stopping pagination due to empty messages in response");break}if(log$l.info(`${lt.messages.length} messages retrieved from store`),yield lt.messages.map(ht=>{if(!ht.message)return Promise.resolve(void 0);const mt=ht.message.contentTopic;if(mt){const ft=rt.get(mt);if(ft)return ft.fromProtoObj(ht.pubsubTopic||"",toProtoMessage(ht.message))}return Promise.resolve(void 0)}),tt.paginationForward?ot=lt.messages[lt.messages.length-1].messageHash:ot=lt.messages[0].messageHash,lt.messages.length>MAX_PAGE_SIZE&<.messages.length<(tt.paginationLimit||DEFAULT_PAGE_SIZE))break}}}const peerDiscoverySymbol$2=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$3=Symbol.for("@libp2p/peer-id");function isPeerId$2(et){return!!(et!=null&&et[peerIdSymbol$3])}var ls;let AbortError$9=(ls=class extends Error{constructor(o="The operation was aborted"){super(o),this.name="AbortError"}},wt(ls,"name","AbortError"),ls);class UnexpectedPeerError extends Error{constructor(o="Unexpected Peer"){super(o),this.name="UnexpectedPeerError"}}wt(UnexpectedPeerError,"name","UnexpectedPeerError");var us;let InvalidMessageError$3=(us=class extends Error{constructor(o="Invalid message"){super(o),this.name="InvalidMessageError"}},wt(us,"name","InvalidMessageError"),us);class ProtocolError extends Error{constructor(o="Protocol error"){super(o),this.name="ProtocolError"}}wt(ProtocolError,"name","ProtocolError");var ds;let TimeoutError$3=(ds=class extends Error{constructor(o="Timed out"){super(o),this.name="TimeoutError"}},wt(ds,"name","TimeoutError"),ds);function setMaxListeners$9(){}const setMaxListeners$8=(et,...o)=>{try{[...o]}catch{}};var Yr,Js;let TypedEventEmitter$3=(Js=class extends EventTarget{constructor(){super();fr(this,Yr,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const rt=Ot(this,Yr).get(tt);return rt==null?0:rt.length}addEventListener(tt,rt,nt){super.addEventListener(tt,rt,nt);let ot=Ot(this,Yr).get(tt);ot==null&&(ot=[],Ot(this,Yr).set(tt,ot)),ot.push({callback:rt,once:(nt!==!0&&nt!==!1&&(nt==null?void 0:nt.once))??!1})}removeEventListener(tt,rt,nt){super.removeEventListener(tt.toString(),rt??null,nt);let ot=Ot(this,Yr).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==rt),Ot(this,Yr).set(tt,ot))}dispatchEvent(tt){const rt=super.dispatchEvent(tt);let nt=Ot(this,Yr).get(tt.type);return nt==null||(nt=nt.filter(({once:ot})=>!ot),Ot(this,Yr).set(tt.type,nt)),rt}safeDispatchEvent(tt,rt={}){return this.dispatchEvent(new CustomEvent(tt,rt))}},Yr=new WeakMap,Js);const serviceCapabilities$5=Symbol.for("@libp2p/service-capabilities"),RelayPingContentTopic="/relay-ping/1/ping/null",log$k=new Logger$1("keep-alive");class KeepAliveManager{constructor({options:o,relay:tt,libp2p:rt}){wt(this,"relay");wt(this,"libp2p");wt(this,"options");wt(this,"pingKeepAliveTimers",new Map);wt(this,"relayKeepAliveTimers",new Map);this.options=o,this.relay=tt,this.libp2p=rt}start(o){this.stop(o);const{pingKeepAlive:tt,relayKeepAlive:rt}=this.options,nt=o.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(o),log$k.info(`Ping succeeded (${nt})`,st)}catch{log$k.error(`Ping failed for peer (${nt}). Next ping will be attempted in ${tt} seconds. `);return}try{await this.libp2p.peerStore.merge(o,{metadata:{ping:utf8ToBytes$1(st.toString())}})}catch(at){log$k.error("Failed to update ping",at)}}catch(at){log$k.error(`Ping failed (${nt})`,at)}})()},tt*1e3);this.pingKeepAliveTimers.set(nt,it)}const ot=this.relay;if(ot&&rt!==0){const it=this.scheduleRelayPings(ot,rt,o.toString());this.relayKeepAliveTimers.set(o,it)}}stop(o){var rt;const tt=o.toString();this.pingKeepAliveTimers.has(tt)&&(clearInterval(this.pingKeepAliveTimers.get(tt)),this.pingKeepAliveTimers.delete(tt)),this.relayKeepAliveTimers.has(o)&&((rt=this.relayKeepAliveTimers.get(o))==null||rt.map(clearInterval),this.relayKeepAliveTimers.delete(o))}stopAll(){for(const o of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(o);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}connectionsExist(){return this.pingKeepAliveTimers.size>0||this.relayKeepAliveTimers.size>0}scheduleRelayPings(o,tt,rt){const nt=[];for(const ot of o.pubsubTopics){if(!o.getMeshPeers(ot).includes(rt))continue;const st=createEncoder({pubsubTopicShardInfo:pubsubTopicToSingleShardInfo(ot),contentTopic:RelayPingContentTopic,ephemeral:!0}),at=setInterval(()=>{log$k.info("Sending Waku Relay ping message"),o.send(st,{payload:new Uint8Array([1])}).catch(ct=>log$k.error("Failed to send relay ping",ct))},tt*1e3);nt.push(at)}return nt}}const log$j=new Logger$1("connection-manager"),DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED=1,DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER=3,DEFAULT_MAX_PARALLEL_DIALS=3,Nn=class Nn extends TypedEventEmitter$3{constructor(tt,rt,nt,ot,it){super();wt(this,"configuredPubsubTopics");wt(this,"keepAliveManager");wt(this,"options");wt(this,"libp2p");wt(this,"dialAttemptsForPeer",new Map);wt(this,"dialErrorsForPeer",new Map);wt(this,"currentActiveParallelDialCount",0);wt(this,"pendingPeerDialQueue",[]);wt(this,"isP2PNetworkConnected",!1);wt(this,"onEventHandlers",{"peer:discovery":tt=>{(async()=>{const{id:rt}=tt.detail;await this.dispatchDiscoveryEvent(rt);try{await this.attemptDial(rt)}catch(nt){log$j.error(`Error dialing peer ${rt.toString()} : ${nt}`)}})()},"peer:connect":tt=>{(async()=>{log$j.info(`Connected to peer ${tt.detail.toString()}`);const rt=tt.detail;this.keepAliveManager.start(rt),(await this.getTagNamesForPeer(rt)).includes(Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.includes(Tags.BOOTSTRAP)).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(rt):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_BOOTSTRAP,{detail:rt})):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_PEER_EXCHANGE,{detail:rt})),this.setP2PNetworkConnected()})()},"peer:disconnect":tt=>{(async()=>(this.keepAliveManager.stop(tt.detail),this.setP2PNetworkDisconnected()))()},"browser:network":()=>{this.dispatchWakuConnectionEvent()}});this.configuredPubsubTopics=nt,this.libp2p=tt,this.configuredPubsubTopics=nt,this.options={maxDialAttemptsForPeer:DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER,maxBootstrapPeersAllowed:DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED,maxParallelDials:DEFAULT_MAX_PARALLEL_DIALS,...it},this.keepAliveManager=new KeepAliveManager({relay:ot,libp2p:tt,options:rt}),this.startEventListeners().then(()=>log$j.info("Connection Manager is now running")).catch(st=>log$j.error("Unexpected error while running service",st)),this.dialPeerStorePeers().catch(st=>log$j.error("Unexpected error while dialing peer store peers",st))}isConnected(){var tt;return globalThis!=null&&globalThis.navigator&&!((tt=globalThis==null?void 0:globalThis.navigator)!=null&&tt.onLine)?!1:this.isP2PNetworkConnected}static create(tt,rt,nt,ot,it,st){let at=Nn.instances.get(tt);return at||(at=new Nn(rt,nt,ot,it,st),Nn.instances.set(tt,at)),at}stop(){this.keepAliveManager.stopAll(),this.libp2p.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2p.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2p.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"]),this.stopNetworkStatusListener()}async dropConnection(tt){try{this.keepAliveManager.stop(tt),await this.libp2p.hangUp(tt),log$j.info(`Dropped connection with peer ${tt.toString()}`)}catch(rt){log$j.error(`Error dropping connection with peer ${tt.toString()} - ${rt}`)}}async getPeersByDiscovery(){const tt=await this.libp2p.peerStore.all(),rt=this.libp2p.getConnections().map(lt=>lt.remotePeer),nt=[],ot=[],it=[],st=[],at=[],ct=[];for(const lt of tt){const dt=await this.getTagNamesForPeer(lt.id);dt.includes(Tags.BOOTSTRAP)?nt.push(lt):dt.includes(Tags.PEER_EXCHANGE)?ot.push(lt):dt.includes(Tags.LOCAL)&&it.push(lt)}for(const lt of rt){const dt=await this.libp2p.peerStore.get(lt),ht=await this.getTagNamesForPeer(lt);ht.includes(Tags.BOOTSTRAP)?st.push(dt):ht.includes(Tags.PEER_EXCHANGE)?at.push(dt):ht.includes(Tags.LOCAL)&&ct.push(dt)}return{DISCOVERED:{[Tags.BOOTSTRAP]:nt,[Tags.PEER_EXCHANGE]:ot,[Tags.LOCAL]:it},CONNECTED:{[Tags.BOOTSTRAP]:st,[Tags.PEER_EXCHANGE]:at,[Tags.LOCAL]:ct}}}async dialPeerStorePeers(){const tt=await this.libp2p.peerStore.all(),rt=[];for(const nt of tt)this.libp2p.getConnections().find(ot=>ot.remotePeer===nt.id)||rt.push(this.attemptDial(nt.id));try{await Promise.all(rt)}catch(nt){log$j.error("Unexpected error while dialing peer store peers",nt)}}async startEventListeners(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener(),this.startNetworkStatusListener()}async dialPeer(tt){this.currentActiveParallelDialCount+=1;let rt=0;for(;rt{ot.tags=Array.from(new Set([...ot.tags,...nt]))}),this.dialAttemptsForPeer.set(tt.toString(),-1),this.keepAliveManager.start(tt);break}catch(nt){nt instanceof AggregateError?log$j.error(`Error dialing peer ${tt.toString()} - ${nt.errors}`):log$j.error(`Error dialing peer ${tt.toString()} - ${nt.message}`),this.dialErrorsForPeer.set(tt.toString(),nt),rt++,this.dialAttemptsForPeer.set(tt.toString(),rt)}if(this.currentActiveParallelDialCount--,this.processDialQueue(),rt===this.options.maxDialAttemptsForPeer)try{const nt=this.dialErrorsForPeer.get(tt.toString());if(nt){let ot;nt instanceof AggregateError?nt.errors?nt.errors.length===0?log$j.warn("Errors array is empty for AggregateError"):ot=JSON.stringify(nt.errors[0]):log$j.warn("No errors array found for AggregateError"):ot=nt.message,log$j.info(`Deleting undialable peer ${tt.toString()} from peer store. Reason: ${ot}`)}this.dialErrorsForPeer.delete(tt.toString()),await this.libp2p.peerStore.delete(tt),await this.attemptDnsDiscovery()}catch(nt){throw new Error(`Error deleting undialable peer ${tt.toString()} from peer store - ${nt}`)}}async attemptDnsDiscovery(){if(this.libp2p.getConnections().length>0||(await this.libp2p.peerStore.all()).length>0)return;log$j.info("Attempting to trigger DNS discovery.");const tt=Object.values(this.libp2p.components.components).find(rt=>rt&&rt.toString?rt.toString().includes(DNS_DISCOVERY_TAG):!1);tt&&await tt.findPeers()}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveParallelDialCount{log$j.error(rt)})}}startPeerDiscoveryListener(){this.libp2p.addEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2p.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2p.addEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"])}async attemptDial(tt){if(await this.shouldDialPeer(tt)){if(this.currentActiveParallelDialCount>=this.options.maxParallelDials){this.pendingPeerDialQueue.push(tt);return}await this.dialPeer(tt)}}async shouldDialPeer(tt){if(this.libp2p.getConnections(tt).length>0)return log$j.warn(`Already connected to peer ${tt.toString()}. Not dialing.`),!1;if(!await this.isPeerTopicConfigured(tt)){const st=await this.getPeerShardInfo(tt,this.libp2p.peerStore);return log$j.warn(`Discovered peer ${tt.toString()} with ShardInfo ${st} is not part of any of the configured pubsub topics (${this.configuredPubsubTopics}). Not dialing.`),!1}return await this.isPeerDialableBasedOnBootstrapStatus(tt)?this.dialAttemptsForPeer.has(tt.toString())?(log$j.warn(`Peer ${tt.toString()} has already been attempted dial before, or already has a dial attempt in progress, skipping dial`),!1):!0:(log$j.warn(`Peer ${tt.toString()} is not dialable based on bootstrap status. Not dialing.`),!1)}async isPeerDialableBasedOnBootstrapStatus(tt){return(await this.getTagNamesForPeer(tt)).some(it=>it===Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.find(st=>st===Tags.BOOTSTRAP)).lengththis.configuredPubsubTopics.includes(it)):!0}async getPeerShardInfo(tt,rt){const ot=(await rt.get(tt)).metadata.get("shardInfo");if(ot)return decodeRelayShard(ot)}startNetworkStatusListener(){try{globalThis.addEventListener("online",this.onEventHandlers["browser:network"]),globalThis.addEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to start network listener: ${tt}`)}}stopNetworkStatusListener(){try{globalThis.removeEventListener("online",this.onEventHandlers["browser:network"]),globalThis.removeEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to stop network listener: ${tt}`)}}setP2PNetworkConnected(){this.isP2PNetworkConnected||(this.isP2PNetworkConnected=!0,this.dispatchWakuConnectionEvent())}setP2PNetworkDisconnected(){this.isP2PNetworkConnected&&this.libp2p.getConnections().length===0&&(this.isP2PNetworkConnected=!1,this.dispatchWakuConnectionEvent())}dispatchWakuConnectionEvent(){this.dispatchEvent(new CustomEvent(EConnectionStateEvents.CONNECTION_STATUS,{detail:this.isConnected()}))}};wt(Nn,"instances",new Map);let ConnectionManager=Nn;const An=class An{constructor(){wt(this,"health");this.health={overallStatus:HealthStatus.Unhealthy,protocolStatuses:new Map}}static getInstance(){return An.instance||(An.instance=new An),An.instance}getHealthStatus(){return this.health.overallStatus}getProtocolStatus(o){return this.health.protocolStatuses.get(o)}updateProtocolHealth(o,tt){const rt=this.getNameFromMulticodec(o);let nt=HealthStatus.Unhealthy;tt==1?nt=HealthStatus.MinimallyHealthy:tt>=2&&(nt=HealthStatus.SufficientlyHealthy),this.health.protocolStatuses.set(rt,{name:rt,status:nt,lastUpdate:new Date}),this.updateOverallHealth()}getNameFromMulticodec(o){let tt;if(o.includes("filter"))tt=Protocols.Filter;else if(o.includes("lightpush"))tt=Protocols.LightPush;else if(o.includes("store"))tt=Protocols.Store;else throw new Error(`Unknown protocol: ${o}`);return tt}updateOverallHealth(){const tt=[Protocols.LightPush,Protocols.Filter].map(rt=>{var nt;return(nt=this.getProtocolStatus(rt))==null?void 0:nt.status});tt.some(rt=>rt===HealthStatus.Unhealthy)?this.health.overallStatus=HealthStatus.Unhealthy:tt.some(rt=>rt===HealthStatus.MinimallyHealthy)?this.health.overallStatus=HealthStatus.MinimallyHealthy:this.health.overallStatus=HealthStatus.SufficientlyHealthy}};wt(An,"instance");let HealthManager=An;const getHealthManager=()=>HealthManager.getInstance(),log$i=new Logger$1("metadata"),MetadataCodec="/vac/waku/metadata/1.0.0";class Metadata extends BaseProtocol{constructor(tt,rt){super(MetadataCodec,rt.components,log$i,tt);wt(this,"pubsubTopics");wt(this,"libp2pComponents");wt(this,"handshakesConfirmed",new Map);this.pubsubTopics=tt,this.libp2pComponents=rt,rt.registrar.handle(MetadataCodec,nt=>{this.onRequest(nt)})}async query(tt){const rt=WakuMetadataRequest.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),nt=await this.libp2pComponents.peerStore.get(tt);if(!nt)return{shardInfo:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let ot;try{ot=await this.getStream(nt)}catch(ct){return log$i.error("Failed to get stream",ct),{shardInfo:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const it=await pipe([rt],encode$K,ot,decode$U,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);return st?{shardInfo:null,error:st}:(await this.savePeerShardInfo(tt,at),{shardInfo:at,error:null})}async confirmOrAttemptHandshake(tt){const rt=this.handshakesConfirmed.get(tt.toString());return rt?{shardInfo:rt,error:null}:await this.query(tt)}async onRequest(tt){try{const{stream:rt,connection:nt}=tt,ot=WakuMetadataResponse.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),it=await pipe([ot],encode$K,rt,decode$U,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);if(st)return;await this.savePeerShardInfo(nt.remotePeer,at)}catch(rt){log$i.error("Error handling metadata request",rt)}}decodeMetadataResponse(tt){const rt=new Uint8ArrayList;tt.forEach(ot=>{rt.append(ot)});const nt=WakuMetadataResponse.decode(rt);return nt?{shardInfo:nt,error:null}:(log$i.error("Error decoding metadata response"),{shardInfo:null,error:ProtocolError$1.DECODE_FAILED})}async savePeerShardInfo(tt,rt){await this.libp2pComponents.peerStore.merge(tt,{metadata:{shardInfo:encodeRelayShard(rt)}}),this.handshakesConfirmed.set(tt.toString(),rt)}}function wakuMetadata(et){return o=>new Metadata(et,o)}function equals$e(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$j=base$j,_brrp__multiformats_scope_baseX$i=src$j;let Encoder$j=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$j=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$k(this,o)}},ComposedDecoder$i=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$k(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$k(et,o){return new ComposedDecoder$i({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$i=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$j(o,tt,rt),this.decoder=new Decoder$j(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$l({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$i(et,o,tt,rt)}function baseX$i({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$i(tt,et);return from$l({prefix:o,name:et,encode:rt,decode:ot=>coerce$i(nt(ot))})}function decode$T(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$J(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<=INT$5;)o[tt++]=et&255|MSB$7,et/=128;for(;et&MSBALL$5;)o[tt++]=et&255|MSB$7,et>>>=7;return o[tt]=et|0,encode$I.bytes=tt-rt+1,o}var decode$S=read$6,MSB$1$5=128,REST$1$5=127;function read$6(et,rt){var tt=0,rt=rt||0,nt=0,ot=rt,it,st=et.length;do{if(ot>=st)throw read$6.bytes=0,new RangeError("Could not decode varint");it=et[ot++],tt+=nt<28?(it&REST$1$5)<=MSB$1$5);return read$6.bytes=ot-rt,tt}var N1$5=Math.pow(2,7),N2$5=Math.pow(2,14),N3$5=Math.pow(2,21),N4$5=Math.pow(2,28),N5$5=Math.pow(2,35),N6$5=Math.pow(2,42),N7$5=Math.pow(2,49),N8$5=Math.pow(2,56),N9$5=Math.pow(2,63),length$5=function(et){return et{const[dt,ht]=decode$R(o.subarray(tt));return tt+=ht,dt};let nt=rt(),ot=DAG_PB_CODE$3;if(nt===18?(nt=0,tt=0):ot=rt(),nt!==0&&nt!==1)throw new RangeError(`Invalid CID version ${nt}`);const it=tt,st=rt(),at=rt(),ct=tt+at,lt=ct-it;return{version:nt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(o,tt){const[rt,nt]=parseCIDtoBytes$3(o,tt),ot=jr.decode(nt);if(ot.version===0&&o[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache$3(ot).set(rt,o),ot}};function parseCIDtoBytes$3(et,o){switch(et[0]){case"Q":{const tt=o??base58btc$i;return[base58btc$i.prefix,tt.decode(`${base58btc$i.prefix}${et}`)]}case base58btc$i.prefix:{const tt=o??base58btc$i;return[base58btc$i.prefix,tt.decode(et)]}case base32$w.prefix:{const tt=o??base32$w;return[base32$w.prefix,tt.decode(et)]}case base36$t.prefix:{const tt=o??base36$t;return[base36$t.prefix,tt.decode(et)]}default:{if(o==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[et[0],o.decode(et)]}}}function toStringV0$3(et,o,tt){const{prefix:rt}=tt;if(rt!==base58btc$i.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const nt=o.get(rt);if(nt==null){const ot=tt.encode(et).slice(1);return o.set(rt,ot),ot}else return nt}function toStringV1$3(et,o,tt){const{prefix:rt}=tt,nt=o.get(rt);if(nt==null){const ot=tt.encode(et);return o.set(rt,ot),ot}else return nt}const DAG_PB_CODE$3=112,SHA_256_CODE$3=18;function encodeCID$3(et,o,tt){const rt=encodingLength$5(et),nt=rt+encodingLength$5(o),ot=new Uint8Array(nt+tt.byteLength);return encodeTo$3(et,ot,0),encodeTo$3(o,ot,rt),ot.set(tt,nt),ot}const cidSymbol$3=Symbol.for("@ipld/js-cid/CID");function equals$c(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;tt(et[tt]=o,et),[]),alphabetCharsToBytes$e=alphabet$e.reduce((et,o,tt)=>{const rt=o.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${o}`);return et[rt]=tt,et},[]);function encode$H(et){return et.reduce((o,tt)=>(o+=alphabetBytesToChars$e[tt],o),"")}function decode$P(et){const o=[];for(const tt of et){const rt=tt.codePointAt(0);if(rt==null)throw new Error(`Invalid character: ${tt}`);const nt=alphabetCharsToBytes$e[rt];if(nt==null)throw new Error(`Non-base256emoji character: ${tt}`);o.push(nt)}return new Uint8Array(o)}const base256emoji$s=from$l({prefix:"🚀",name:"base256emoji",encode:encode$H,decode:decode$P}),base256emoji$t=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:base256emoji$s},Symbol.toStringTag,{value:"Module"})),base64$v=rfc4648$h({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad$e=rfc4648$h({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url$f=rfc4648$h({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad$e=rfc4648$h({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$w=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$v,base64pad:base64pad$e,base64url:base64url$f,base64urlpad:base64urlpad$e},Symbol.toStringTag,{value:"Module"})),base8$s=rfc4648$h({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$t=Object.freeze(Object.defineProperty({__proto__:null,base8:base8$s},Symbol.toStringTag,{value:"Module"})),identity$g=from$l({prefix:"\0",name:"identity",encode:et=>toString$u(et),decode:et=>fromString$s(et)}),identityBase$e=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$g},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases$e={...identityBase$e,...base2$t,...base8$t,...base10$t,...base16$t,...base32$x,...base36$u,...base58$e,...base64$w,...base256emoji$t};function allocUnsafe$d(et=0){return new Uint8Array(et)}function createCodec$e(et,o,tt,rt){return{name:et,prefix:o,encoder:{name:et,prefix:o,encode:tt},decoder:{decode:rt}}}const string$i=createCodec$e("utf8","u",et=>"u"+new TextDecoder("utf8").decode(et),et=>new TextEncoder().encode(et.substring(1))),ascii$e=createCodec$e("ascii","a",et=>{let o="a";for(let tt=0;tt{et=et.substring(1);const o=allocUnsafe$d(et.length);for(let tt=0;ttnt+ot.length,0));const tt=allocUnsafe$d(o);let rt=0;for(const nt of et)tt.set(nt,rt),rt+=nt.length;return tt}class Parser{constructor(){wt(this,"index",0);wt(this,"input","")}new(o){return this.index=0,this.input=o,this}readAtomically(o){const tt=this.index,rt=o();return rt===void 0&&(this.index=tt),rt}parseWith(o){const tt=o();if(this.index===this.input.length)return tt}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(o){return this.readAtomically(()=>{const tt=this.readChar();if(tt===o)return tt})}readSeparator(o,tt,rt){return this.readAtomically(()=>{if(!(tt>0&&this.readGivenChar(o)===void 0))return rt()})}readNumber(o,tt,rt,nt){return this.readAtomically(()=>{let ot=0,it=0;const st=this.peekChar();if(st===void 0)return;const at=st==="0",ct=2**(8*nt)-1;for(;;){const lt=this.readAtomically(()=>{const dt=this.readChar();if(dt===void 0)return;const ht=Number.parseInt(dt,o);if(!Number.isNaN(ht))return ht});if(lt===void 0)break;if(ot*=o,ot+=lt,ot>ct||(it+=1,tt!==void 0&&it>tt))return}if(it!==0)return!rt&&at&&it>1?void 0:ot})}readIPv4Addr(){return this.readAtomically(()=>{const o=new Uint8Array(4);for(let tt=0;ttthis.readNumber(10,3,!1,1));if(rt===void 0)return;o[tt]=rt}return o})}readIPv6Addr(){const o=tt=>{for(let rt=0;rtthis.readIPv4Addr());if(it!==void 0)return tt[nt]=it[0],tt[nt+1]=it[1],tt[nt+2]=it[2],tt[nt+3]=it[3],[nt+4,!0]}const ot=this.readSeparator(":",rt,()=>this.readNumber(16,4,!0,2));if(ot===void 0)return[nt,!1];tt[nt]=ot>>8,tt[nt+1]=ot&255}return[tt.length,!1]};return this.readAtomically(()=>{const tt=new Uint8Array(16),[rt,nt]=o(tt);if(rt===16)return tt;if(nt||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const ot=new Uint8Array(14),it=16-(rt+2),[st]=o(ot.subarray(0,it));return tt.set(ot.subarray(0,st),16-st),tt})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(et){if(!(et.length>MAX_IPV4_LENGTH))return parser.new(et).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(et){if(et.includes("%")&&(et=et.split("%")[0]),!(et.length>MAX_IPV6_LENGTH))return parser.new(et).parseWith(()=>parser.readIPv6Addr())}function parseIP(et){if(et.includes("%")&&(et=et.split("%")[0]),!(et.length>MAX_IPV6_LENGTH))return parser.new(et).parseWith(()=>parser.readIPAddr())}function fromString$r(et,o="utf8"){const tt=BASES$e[o];if(tt==null)throw new Error(`Unsupported encoding "${o}"`);return tt.decoder.decode(`${tt.prefix}${et}`)}function isIPv4(et){return!!parseIPv4(et)}function isIPv6(et){return!!parseIPv6(et)}function isIP(et){return!!parseIP(et)}const isV4=isIPv4,isV6=isIPv6,toBytes$1=function(et){let o=0;if(et=et.toString().trim(),isV4(et)){const tt=new Uint8Array(o+4);return et.split(/\./g).forEach(rt=>{tt[o++]=parseInt(rt,10)&255}),tt}if(isV6(et)){const tt=et.split(":",8);let rt;for(rt=0;rt0;rt--)ot.push("0");tt.splice.apply(tt,ot)}const nt=new Uint8Array(o+16);for(rt=0;rt>8&255,nt[o++]=ot&255}return nt}throw new Error("invalid ip address")},toString$s=function(et,o=0,tt){o=~~o,tt=tt??et.length-o;const rt=new DataView(et.buffer);if(tt===4){const nt=[];for(let ot=0;ot{const o=createProtocol(...et);codes[o.code]=o,names[o.name]=o});function createProtocol(et,o,tt,rt,nt){return{code:et,size:o,name:tt,resolvable:!!rt,path:!!nt}}function getProtocol(et){if(typeof et=="number"){if(codes[et]!=null)return codes[et];throw new Error(`no protocol with code: ${et}`)}else if(typeof et=="string"){if(names[et]!=null)return names[et];throw new Error(`no protocol with name: ${et}`)}throw new Error(`invalid protocol id type: ${typeof et}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(et,o){switch(getProtocol(et).code){case 4:case 41:return bytes2ip(o);case 42:return bytes2str(o);case 6:case 273:case 33:case 132:return bytes2port(o).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(o);case 421:return bytes2mh(o);case 444:return bytes2onion(o);case 445:return bytes2onion(o);case 466:return bytes2mb(o);case 481:return globalThis.encodeURIComponent(bytes2str(o));default:return toString$t(o,"base16")}}function convertToBytes(et,o){switch(getProtocol(et).code){case 4:return ip2bytes(o);case 41:return ip2bytes(o);case 42:return str2bytes(o);case 6:case 273:case 33:case 132:return port2bytes(parseInt(o,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(o);case 421:return mh2bytes(o);case 444:return onion2bytes(o);case 445:return onion32bytes(o);case 466:return mb2bytes(o);case 481:return str2bytes(globalThis.decodeURIComponent(o));default:return fromString$r(o,"base16")}}const decoders=Object.values(bases$e).map(et=>et.decoder),anybaseDecoder=function(){let et=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(o=>et=et.or(o)),et}();function ip2bytes(et){if(!isIP(et))throw new Error("invalid ip address");return toBytes$1(et)}function bytes2ip(et){const o=toString$s(et,0,et.length);if(o==null)throw new Error("ipBuff is required");if(!isIP(o))throw new Error("invalid ip address");return o}function port2bytes(et){const o=new ArrayBuffer(2);return new DataView(o).setUint16(0,et),new Uint8Array(o)}function bytes2port(et){return new DataView(et.buffer).getUint16(et.byteOffset)}function str2bytes(et){const o=fromString$r(et),tt=Uint8Array.from(encode$P(o.length));return concat$3([tt,o],tt.length+o.length)}function bytes2str(et){const o=decode$Z(et);if(et=et.slice(encodingLength$6(o)),et.length!==o)throw new Error("inconsistent lengths");return toString$t(et)}function mh2bytes(et){let o;et[0]==="Q"||et[0]==="1"?o=decode$Q(base58btc$i.decode(`z${et}`)).bytes:o=CID$3.parse(et).multihash.bytes;const tt=Uint8Array.from(encode$P(o.length));return concat$3([tt,o],tt.length+o.length)}function mb2bytes(et){const o=anybaseDecoder.decode(et),tt=Uint8Array.from(encode$P(o.length));return concat$3([tt,o],tt.length+o.length)}function bytes2mb(et){const o=decode$Z(et),tt=et.slice(encodingLength$6(o));if(tt.length!==o)throw new Error("inconsistent lengths");return"u"+toString$t(tt,"base64url")}function bytes2mh(et){const o=decode$Z(et),tt=et.slice(encodingLength$6(o));if(tt.length!==o)throw new Error("inconsistent lengths");return toString$t(tt,"base58btc")}function onion2bytes(et){const o=et.split(":");if(o.length!==2)throw new Error(`failed to parse onion addr: ["'${o.join('", "')}'"]' does not contain a port number`);if(o[0].length!==16)throw new Error(`failed to parse onion addr: ${o[0]} not a Tor onion address.`);const tt=base32$w.decode("b"+o[0]),rt=parseInt(o[1],10);if(rt<1||rt>65536)throw new Error("Port number is not in range(1, 65536)");const nt=port2bytes(rt);return concat$3([tt,nt],tt.length+nt.length)}function onion32bytes(et){const o=et.split(":");if(o.length!==2)throw new Error(`failed to parse onion addr: ["'${o.join('", "')}'"]' does not contain a port number`);if(o[0].length!==56)throw new Error(`failed to parse onion addr: ${o[0]} not a Tor onion3 address.`);const tt=base32$w.decode(`b${o[0]}`),rt=parseInt(o[1],10);if(rt<1||rt>65536)throw new Error("Port number is not in range(1, 65536)");const nt=port2bytes(rt);return concat$3([tt,nt],tt.length+nt.length)}function bytes2onion(et){const o=et.slice(0,et.length-2),tt=et.slice(et.length-2),rt=toString$t(o,"base32"),nt=bytes2port(tt);return`${rt}:${nt}`}function stringToMultiaddrParts(et){et=cleanPath(et);const o=[],tt=[];let rt=null;const nt=et.split("/").slice(1);if(nt.length===1&&nt[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let ot=0;ot=nt.length)throw ParseError("invalid address: "+et);if(st.path===!0){rt=cleanPath(nt.slice(ot).join("/")),o.push([st.code,convertToBytes(st.code,rt)]),tt.push([st.code,rt]);break}const at=convertToBytes(st.code,nt[ot]);o.push([st.code,at]),tt.push([st.code,convertToString(st.code,at)])}return{string:stringTuplesToString(tt),bytes:tuplesToBytes(o),tuples:o,stringTuples:tt,path:rt}}function bytesToMultiaddrParts(et){const o=[],tt=[];let rt=null,nt=0;for(;ntet.length)throw ParseError("Invalid address Uint8Array: "+toString$t(et,"base16"));o.push([ot,ct]);const lt=convertToString(ot,ct);if(tt.push([ot,lt]),st.path===!0){rt=lt;break}}return{bytes:Uint8Array.from(et),string:stringTuplesToString(tt),tuples:o,stringTuples:tt,path:rt}}function stringTuplesToString(et){const o=[];return et.map(tt=>{const rt=getProtocol(tt[0]);return o.push(rt.name),tt.length>1&&tt[1]!=null&&o.push(tt[1]),null}),cleanPath(o.join("/"))}function tuplesToBytes(et){return concat$3(et.map(o=>{const tt=getProtocol(o[0]);let rt=Uint8Array.from(encode$P(tt.code));return o.length>1&&o[1]!=null&&(rt=concat$3([rt,o[1]])),rt}))}function sizeForAddr(et,o){if(et.size>0)return et.size/8;if(et.size===0)return 0;{const tt=decode$Z(o instanceof Uint8Array?o:Uint8Array.from(o));return tt+encodingLength$6(tt)}}function cleanPath(et){return"/"+et.trim().split("/").filter(o=>o).join("/")}function ParseError(et){return new Error("Error parsing address: "+et)}const inspect$1=Symbol.for("nodejs.util.inspect.custom"),symbol=Symbol.for("@multiformats/js-multiaddr/multiaddr"),DNS_CODES=[getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code];class NoAvailableResolverError extends Error{constructor(o="No available resolver"){super(o),this.name="NoAvailableResolverError"}}var ga,Yn,wn,lo,uo;const Dn=class Dn{constructor(o){wt(this,"bytes");fr(this,Yn);fr(this,wn);fr(this,lo);fr(this,uo);wt(this,ga,!0);o==null&&(o="");let tt;if(o instanceof Uint8Array)tt=bytesToMultiaddrParts(o);else if(typeof o=="string"){if(o.length>0&&o.charAt(0)!=="/")throw new Error(`multiaddr "${o}" must start with a "/"`);tt=stringToMultiaddrParts(o)}else if(isMultiaddr(o))tt=bytesToMultiaddrParts(o.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=tt.bytes,lr(this,Yn,tt.string),lr(this,wn,tt.tuples),lr(this,lo,tt.stringTuples),lr(this,uo,tt.path)}toString(){return Ot(this,Yn)}toJSON(){return this.toString()}toOptions(){let o,tt,rt,nt,ot="";const it=getProtocol("tcp"),st=getProtocol("udp"),at=getProtocol("ip4"),ct=getProtocol("ip6"),lt=getProtocol("dns6"),dt=getProtocol("ip6zone");for(const[mt,ft]of this.stringTuples())mt===dt.code&&(ot=`%${ft??""}`),DNS_CODES.includes(mt)&&(tt=it.name,nt=443,rt=`${ft??""}${ot}`,o=mt===lt.code?6:4),(mt===it.code||mt===st.code)&&(tt=getProtocol(mt).name,nt=parseInt(ft??"")),(mt===at.code||mt===ct.code)&&(tt=getProtocol(mt).name,rt=`${ft??""}${ot}`,o=mt===ct.code?6:4);if(o==null||tt==null||rt==null||nt==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:o,host:rt,transport:tt,port:nt}}protos(){return Ot(this,wn).map(([o])=>Object.assign({},getProtocol(o)))}protoCodes(){return Ot(this,wn).map(([o])=>o)}protoNames(){return Ot(this,wn).map(([o])=>getProtocol(o).name)}tuples(){return Ot(this,wn)}stringTuples(){return Ot(this,lo)}encapsulate(o){return o=new Dn(o),new Dn(this.toString()+o.toString())}decapsulate(o){const tt=o.toString(),rt=this.toString(),nt=rt.lastIndexOf(tt);if(nt<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${o.toString()}`);return new Dn(rt.slice(0,nt))}decapsulateCode(o){const tt=this.tuples();for(let rt=tt.length-1;rt>=0;rt--)if(tt[rt][0]===o)return new Dn(tuplesToBytes(tt.slice(0,rt)));return this}getPeerId(){try{let o=[];this.stringTuples().forEach(([rt,nt])=>{rt===names.p2p.code&&o.push([rt,nt]),rt===names["p2p-circuit"].code&&(o=[])});const tt=o.pop();if((tt==null?void 0:tt[1])!=null){const rt=tt[1];return rt[0]==="Q"||rt[0]==="1"?toString$t(base58btc$i.decode(`z${rt}`),"base58btc"):toString$t(CID$3.parse(rt).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return Ot(this,uo)}equals(o){return equals$c(this.bytes,o.bytes)}async resolve(o){const tt=this.protos().find(ot=>ot.resolvable);if(tt==null)return[this];const rt=resolvers$1.get(tt.name);if(rt==null)throw new NoAvailableResolverError(`no available resolver for ${tt.name}`);return(await rt(this,o)).map(ot=>multiaddr(ot))}nodeAddress(){const o=this.toOptions();if(o.transport!=="tcp"&&o.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${o.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:o.family,address:o.host,port:o.port}}isThinWaistAddress(o){const tt=(o??this).protos();return!(tt.length!==2||tt[0].code!==4&&tt[0].code!==41||tt[1].code!==6&&tt[1].code!==273)}[(ga=symbol,inspect$1)](){return`Multiaddr(${Ot(this,Yn)})`}};Yn=new WeakMap,wn=new WeakMap,lo=new WeakMap,uo=new WeakMap;let Multiaddr=Dn;const resolvers$1=new Map;function isMultiaddr(et){return!!(et!=null&&et[symbol])}function multiaddr(et){return new Multiaddr(et)}const E_CANCELED=new Error("request for lock canceled");var __awaiter$2=function(et,o,tt,rt){function nt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(rt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(rt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):nt(lt.value).then(st,at)}ct((rt=rt.apply(et,o||[])).next())})};class Semaphore{constructor(o,tt=E_CANCELED){this._value=o,this._cancelError=tt,this._queue=[],this._weightedWaiters=[]}acquire(o=1,tt=0){if(o<=0)throw new Error(`invalid weight ${o}: must be positive`);return new Promise((rt,nt)=>{const ot={resolve:rt,reject:nt,weight:o,priority:tt},it=findIndexFromEnd(this._queue,st=>tt<=st.priority);it===-1&&o<=this._value?this._dispatchItem(ot):this._queue.splice(it+1,0,ot)})}runExclusive(o){return __awaiter$2(this,arguments,void 0,function*(tt,rt=1,nt=0){const[ot,it]=yield this.acquire(rt,nt);try{return yield tt(ot)}finally{it()}})}waitForUnlock(o=1,tt=0){if(o<=0)throw new Error(`invalid weight ${o}: must be positive`);return this._couldLockImmediately(o,tt)?Promise.resolve():new Promise(rt=>{this._weightedWaiters[o-1]||(this._weightedWaiters[o-1]=[]),insertSorted(this._weightedWaiters[o-1],{resolve:rt,priority:tt})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(o){this._value=o,this._dispatchQueue()}release(o=1){if(o<=0)throw new Error(`invalid weight ${o}: must be positive`);this._value+=o,this._dispatchQueue()}cancel(){this._queue.forEach(o=>o.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(o){const tt=this._value;this._value-=o.weight,o.resolve([tt,this._newReleaser(o.weight)])}_newReleaser(o){let tt=!1;return()=>{tt||(tt=!0,this.release(o))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let o=this._value;o>0;o--){const tt=this._weightedWaiters[o-1];tt&&(tt.forEach(rt=>rt.resolve()),this._weightedWaiters[o-1]=[])}else{const o=this._queue[0].priority;for(let tt=this._value;tt>0;tt--){const rt=this._weightedWaiters[tt-1];if(!rt)continue;const nt=rt.findIndex(ot=>ot.priority<=o);(nt===-1?rt:rt.splice(0,nt)).forEach(ot=>ot.resolve())}}}_couldLockImmediately(o,tt){return(this._queue.length===0||this._queue[0].priorityo.priority<=rt.priority);et.splice(tt+1,0,o)}function findIndexFromEnd(et,o){for(let tt=et.length-1;tt>=0;tt--)if(o(et[tt]))return tt;return-1}var __awaiter$1=function(et,o,tt,rt){function nt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(rt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(rt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):nt(lt.value).then(st,at)}ct((rt=rt.apply(et,o||[])).next())})};class Mutex{constructor(o){this._semaphore=new Semaphore(1,o)}acquire(){return __awaiter$1(this,arguments,void 0,function*(o=0){const[,tt]=yield this._semaphore.acquire(1,o);return tt})}runExclusive(o,tt=0){return this._semaphore.runExclusive(()=>o(),1,tt)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(o=0){return this._semaphore.waitForUnlock(1,o)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class PeerManager{constructor(o,tt,rt){wt(this,"connectionManager");wt(this,"core");wt(this,"log");wt(this,"peers",new Map);wt(this,"healthManager");wt(this,"readMutex",new Mutex);wt(this,"writeMutex",new Mutex);wt(this,"writeLockHolder",null);this.connectionManager=o,this.core=tt,this.log=rt,this.healthManager=getHealthManager(),this.healthManager.updateProtocolHealth(this.core.multicodec,0)}getWriteLockHolder(){return this.writeLockHolder}getPeers(){return Array.from(this.peers.values())}async addPeer(o){return this.writeMutex.runExclusive(async()=>{this.writeLockHolder=`addPeer: ${o.id.toString()}`,await this.connectionManager.attemptDial(o.id),this.peers.set(o.id.toString(),o),this.log.info(`Added and dialed peer: ${o.id.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async removePeer(o){return this.writeMutex.runExclusive(()=>{this.writeLockHolder=`removePeer: ${o.toString()}`,this.peers.delete(o.toString()),this.log.info(`Removed peer: ${o.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async getPeerCount(){return this.readMutex.runExclusive(()=>this.peers.size)}async hasPeers(){return this.readMutex.runExclusive(()=>this.peers.size>0)}async removeExcessPeers(o){this.log.info(`Removing ${o} excess peer(s)`);const tt=Array.from(this.peers.values()).slice(0,o);for(const rt of tt)await this.removePeer(rt.id)}async findAndAddPeers(o){const tt=await this.findPeers(o);return tt.length===0?(this.log.warn("No additional peers found"),[]):this.addMultiplePeers(tt)}async findPeers(o){const tt=await this.core.getPeers();return this.readMutex.runExclusive(async()=>tt.filter(nt=>!this.peers.has(nt.id.toString())).slice(0,o))}async addMultiplePeers(o){const tt=[];for(const rt of o)await this.addPeer(rt),tt.push(rt);return tt}}const DEFAULT_NUM_PEERS_TO_USE=2,DEFAULT_MAINTAIN_PEERS_INTERVAL=3e4;class BaseProtocolSDK{constructor(o,tt,rt){wt(this,"core");wt(this,"connectionManager");wt(this,"peerManager");wt(this,"numPeersToUse");wt(this,"maintainPeersIntervalId",null);wt(this,"log");this.core=o,this.connectionManager=tt,this.log=new Logger$1(`sdk:${o.multicodec}`),this.numPeersToUse=(rt==null?void 0:rt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE;const nt=(rt==null?void 0:rt.maintainPeersInterval)??DEFAULT_MAINTAIN_PEERS_INTERVAL;this.peerManager=new PeerManager(tt,o,this.log),this.log.info(`Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${nt}ms`),this.startMaintainPeersInterval(nt)}get connectedPeers(){return this.peerManager.getPeers().slice(0,this.numPeersToUse)}async renewPeer(o){this.log.info(`Attempting to renew peer ${o}`);const tt=await this.peerManager.findPeers(1);if(tt.length===0){this.log.error("Failed to find a new peer to replace the disconnected one");return}return await this.peerManager.removePeer(o),await this.peerManager.addPeer(tt[0]),this.log.info(`Successfully renewed peer. New peer: ${tt[0].id}`),tt[0]}stopMaintainPeersInterval(){this.maintainPeersIntervalId?(clearInterval(this.maintainPeersIntervalId),this.maintainPeersIntervalId=null,this.log.info("Maintain peers interval stopped")):this.log.info("Maintain peers interval was not running")}async hasPeers(o={}){const{forceUseAllPeers:tt=!1,maxAttempts:rt=3}=o;this.log.info(`Checking for peers. forceUseAllPeers: ${tt}, maxAttempts: ${rt}`);for(let nt=0;nt0)return this.log.info(`At least one peer connected (${this.connectedPeers.length}), not forcing use of all peers`),!0;if(this.connectedPeers.length>=this.numPeersToUse)return this.log.info(`Required number of peers (${this.numPeersToUse}) reached`),!0;this.log.warn(`Found only ${this.connectedPeers.length}/${this.numPeersToUse} required peers. Retrying...`)}return this.log.error(`Failed to find required number of peers (${this.numPeersToUse}) after ${rt} attempts`),!1}async startMaintainPeersInterval(o){this.log.info(`Starting maintain peers interval with ${o}ms interval`);try{this.maintainPeersIntervalId=setInterval(()=>{this.log.info("Running scheduled peer maintenance"),this.maintainPeers().catch(tt=>{this.log.error("Error during scheduled peer maintenance:",tt)})},o),this.log.info("Maintain peers interval started successfully")}catch(tt){throw this.log.error("Error starting maintain peers interval:",tt),tt}}async maintainPeers(){try{const o=await this.peerManager.getPeerCount(),tt=this.numPeersToUse-o;if(this.log.info(`Current peer count: ${o}, target: ${this.numPeersToUse}`),tt===0){this.log.info("Peer count is at target, no maintenance required");return}tt>0?(this.log.info(`Attempting to add ${tt} peer(s)`),await this.peerManager.findAndAddPeers(tt)):(this.log.info(`Attempting to remove ${Math.abs(tt)} excess peer(s)`),await this.peerManager.removeExcessPeers(Math.abs(tt)));const rt=await this.peerManager.getPeerCount();this.log.info(`Peer maintenance completed. Initial count: ${o}, Final count: ${rt}`)}catch(o){this.log.error("Error during peer maintenance",{error:o})}}}const DEFAULT_KEEP_ALIVE=6e4,DEFAULT_LIGHT_PUSH_FILTER_CHECK=!1,DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL=1e4,DEFAULT_SUBSCRIBE_OPTIONS={keepAlive:DEFAULT_KEEP_ALIVE,enableLightPushFilterCheck:DEFAULT_LIGHT_PUSH_FILTER_CHECK};function messageHash(et,o){const tt=utf8ToBytes$1(et),rt=utf8ToBytes$1(o.contentTopic),nt=tryConvertTimestampToBytes(o.timestamp),ot=concat$5([tt,o.payload,rt,o.meta,nt].filter(isDefined));return sha256$3(ot)}function tryConvertTimestampToBytes(et){if(!et)return;let o;return typeof et=="bigint"?o=et:o=BigInt(et.valueOf())*1000000n,numberToBytes(o)}function messageHashStr(et,o){const tt=messageHash(et,o);return bytesToHex$1(tt)}const log$h=new Logger$1("sdk:receiver:reliability_monitor"),DEFAULT_MAX_PINGS=3,MESSAGE_VERIFICATION_DELAY=5e3;class ReceiverReliabilityMonitor{constructor(o,tt,rt,nt,ot,it,st){wt(this,"pubsubTopic");wt(this,"getPeers");wt(this,"renewPeer");wt(this,"getContentTopics");wt(this,"protocolSubscribe");wt(this,"addLibp2pEventListener");wt(this,"sendLightPushMessage");wt(this,"receivedMessagesFormPeer",new Set);wt(this,"receivedMessages",new Set);wt(this,"scheduledVerification",new Map);wt(this,"verifiedPeers",new Set);wt(this,"peerFailures",new Map);wt(this,"maxPingFailures",DEFAULT_MAX_PINGS);wt(this,"peerRenewalLocks",new Set);this.pubsubTopic=o,this.getPeers=tt,this.renewPeer=rt,this.getContentTopics=nt,this.protocolSubscribe=ot,this.addLibp2pEventListener=it,this.sendLightPushMessage=st,this.addLibp2pEventListener("peer:disconnect",at=>{const ct=at.detail;this.getPeers().some(lt=>lt.id.equals(ct))&&this.renewAndSubscribePeer(ct)})}setMaxPingFailures(o){o!==void 0&&(this.maxPingFailures=o)}async handlePingResult(o,tt){if(tt!=null&&tt.success){this.peerFailures.delete(o.toString());return}const rt=(this.peerFailures.get(o.toString())||0)+1;if(this.peerFailures.set(o.toString(),rt),rt>=this.maxPingFailures)try{log$h.info(`Attempting to renew ${o.toString()} due to ping failures.`),await this.renewAndSubscribePeer(o),this.peerFailures.delete(o.toString())}catch(nt){log$h.error(`Failed to renew peer ${o.toString()}: ${nt}.`)}}notifyMessageReceived(o,tt){const rt=this.buildMessageHash(tt);return this.verifiedPeers.add(o),this.receivedMessagesFormPeer.add(`${o}-${rt}`),log$h.info(`notifyMessage received debug: ephemeral:${tt.ephemeral} ${bytesToUtf8(tt.payload)}`),log$h.info(`notifyMessage received: peer:${o} message:${rt}`),this.receivedMessages.has(rt)?!0:(this.receivedMessages.add(rt),!1)}notifyMessageSent(o,tt){const rt=o.toString(),nt=this.buildMessageHash(tt);if(log$h.info(`notifyMessage sent debug: ${bytesToUtf8(tt.payload)}`),this.scheduledVerification.has(rt)){log$h.warn(`notifyMessage sent: attempting to schedule verification for pending peer:${rt} message:${nt}`);return}const ot=window.setTimeout(async()=>{const it=this.verifiedPeers.has(rt),st=this.receivedMessagesFormPeer.has(`${rt}-${nt}`);if(it||st){log$h.info(`notifyMessage sent setTimeout: verified that peer pushes filter messages, peer:${rt} message:${nt}`);return}log$h.warn(`notifyMessage sent setTimeout: peer didn't return probe message, attempting renewAndSubscribe, peer:${rt} message:${nt}`),this.scheduledVerification.delete(rt),await this.renewAndSubscribePeer(o)},MESSAGE_VERIFICATION_DELAY);this.scheduledVerification.set(rt,ot)}shouldVerifyPeer(o){const tt=o.toString(),rt=this.verifiedPeers.has(tt),nt=this.scheduledVerification.has(tt);return!(rt||nt)}buildMessageHash(o){return messageHashStr(this.pubsubTopic,o)}async renewAndSubscribePeer(o){const tt=o.toString();try{if(this.peerRenewalLocks.has(tt)){log$h.info(`Peer ${tt} is already being renewed.`);return}this.peerRenewalLocks.add(tt);const rt=await this.renewPeer(o);if(!rt){log$h.warn(`Failed to renew peer ${tt}: No new peer found.`);return}return await this.protocolSubscribe(this.pubsubTopic,rt,this.getContentTopics()),await this.sendLightPushMessage(rt),this.peerFailures.delete(tt),rt}catch(rt){log$h.error(`Failed to renew peer ${tt}: ${rt}.`);return}finally{this.peerRenewalLocks.delete(tt)}}}const Ln=class Ln{static createReceiverMonitor(o,tt,rt,nt,ot,it,st){if(Ln.receiverMonitors.has(o))return Ln.receiverMonitors.get(o);const at=new ReceiverReliabilityMonitor(o,tt,rt,nt,ot,it,st);return Ln.receiverMonitors.set(o,at),at}constructor(){}static stop(o){this.receiverMonitors.delete(o)}static stopAll(){for(const[o,tt]of this.receiverMonitors)tt.setMaxPingFailures(void 0),this.receiverMonitors.delete(o)}};wt(Ln,"receiverMonitors",new Map);let ReliabilityMonitorManager=Ln;const log$g=new Logger$1("sdk:filter:subscription_manager");class SubscriptionManager{constructor(o,tt,rt,nt,ot,it,st){wt(this,"pubsubTopic");wt(this,"protocol");wt(this,"connectionManager");wt(this,"getPeers");wt(this,"renewPeer");wt(this,"libp2p");wt(this,"lightPush");wt(this,"reliabilityMonitor");wt(this,"keepAliveTimeout",DEFAULT_KEEP_ALIVE);wt(this,"keepAliveInterval",null);wt(this,"enableLightPushFilterCheck",DEFAULT_LIGHT_PUSH_FILTER_CHECK);wt(this,"subscriptionCallbacks");this.pubsubTopic=o,this.protocol=tt,this.connectionManager=rt,this.getPeers=nt,this.renewPeer=ot,this.libp2p=it,this.lightPush=st,this.pubsubTopic=o,this.subscriptionCallbacks=new Map,this.reliabilityMonitor=ReliabilityMonitorManager.createReceiverMonitor(this.pubsubTopic,this.getPeers.bind(this),this.renewPeer.bind(this),()=>Array.from(this.subscriptionCallbacks.keys()),this.protocol.subscribe.bind(this.protocol),this.protocol.addLibp2pEventListener.bind(this.protocol),this.sendLightPushCheckMessage.bind(this))}async subscribe(o,tt,rt=DEFAULT_SUBSCRIBE_OPTIONS){this.reliabilityMonitor.setMaxPingFailures(rt.pingsBeforePeerRenewed),this.keepAliveTimeout=rt.keepAlive||DEFAULT_KEEP_ALIVE,this.enableLightPushFilterCheck=(rt==null?void 0:rt.enableLightPushFilterCheck)||DEFAULT_LIGHT_PUSH_FILTER_CHECK;const nt=Array.isArray(o)?o:[o];for(const lt of nt)if(lt.pubsubTopic!==this.pubsubTopic)return{failures:[{error:ProtocolError$1.TOPIC_DECODER_MISMATCH}],successes:[]};this.enableLightPushFilterCheck&&nt.push(createDecoder(this.buildLightPushContentTopic(),this.pubsubTopic));const ot=groupByContentTopic(nt),it=Array.from(ot.keys()),st=this.getPeers().map(async lt=>this.subscribeWithPeerVerification(lt,it)),at=await Promise.allSettled(st),ct=this.handleResult(at,"subscribe");return ot.forEach((lt,dt)=>{const ht={decoders:lt,callback:tt};dt!==this.buildLightPushContentTopic()&&this.subscriptionCallbacks.set(dt,ht)}),this.startSubscriptionsMaintenance(this.keepAliveTimeout),ct}async unsubscribe(o){const tt=this.getPeers().map(async ot=>{const it=await this.protocol.unsubscribe(this.pubsubTopic,ot,o);return o.forEach(st=>{this.subscriptionCallbacks.delete(st)}),it}),rt=await Promise.allSettled(tt),nt=this.handleResult(rt,"unsubscribe");return this.subscriptionCallbacks.size===0&&this.stopSubscriptionsMaintenance(),nt}async ping(o){log$g.info("Sending keep-alive ping");const rt=(o?[o]:this.getPeers().map(ot=>ot.id)).map(ot=>this.pingSpecificPeer(ot)),nt=await Promise.allSettled(rt);return this.handleResult(nt,"ping")}async unsubscribeAll(){const o=this.getPeers().map(async nt=>this.protocol.unsubscribeAll(this.pubsubTopic,nt)),tt=await Promise.allSettled(o);this.subscriptionCallbacks.clear();const rt=this.handleResult(tt,"unsubscribeAll");return this.stopSubscriptionsMaintenance(),rt}async processIncomingMessage(o,tt){if(this.reliabilityMonitor.notifyMessageReceived(tt,o)){log$g.info("Message already received, skipping");return}const{contentTopic:nt}=o,ot=this.subscriptionCallbacks.get(nt);if(!ot){log$g.error("No subscription callback available for ",nt);return}log$g.info("Processing message with content topic ",nt," on pubsub topic ",this.pubsubTopic),await pushMessage(ot,this.pubsubTopic,o)}async subscribeWithPeerVerification(o,tt){const rt=await this.protocol.subscribe(this.pubsubTopic,o,tt);return await this.sendLightPushCheckMessage(o),rt}handleResult(o,tt){const rt={failures:[],successes:[]};for(const nt of o)if(nt.status==="rejected")log$g.error(`Failed to resolve ${tt} promise successfully: `,nt.reason),rt.failures.push({error:ProtocolError$1.GENERIC_FAIL});else{const ot=nt.value;ot.failure?rt.failures.push(ot.failure):rt.successes.push(ot.success)}return rt}async pingSpecificPeer(o){var nt,ot;const tt=this.getPeers().find(it=>it.id.equals(o));if(!tt)return{success:null,failure:{peerId:o,error:ProtocolError$1.NO_PEER_AVAILABLE}};let rt;try{rt=await this.protocol.ping(tt)}catch{rt={success:null,failure:{peerId:o,error:ProtocolError$1.GENERIC_FAIL}}}return log$g.info(`Received result from filter ping peerId:${o.toString()} success:${(nt=rt.success)==null?void 0:nt.toString()} failure:${(ot=rt.failure)==null?void 0:ot.error}`),await this.reliabilityMonitor.handlePingResult(o,rt),rt}startSubscriptionsMaintenance(o){log$g.info("Starting subscriptions maintenance"),this.startKeepAlivePings(o),this.startConnectionListener()}stopSubscriptionsMaintenance(){log$g.info("Stopping subscriptions maintenance"),this.stopKeepAlivePings(),this.stopConnectionListener()}startConnectionListener(){this.connectionManager.addEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}stopConnectionListener(){this.connectionManager.removeEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}async connectionListener({detail:o}){if(!o){this.stopKeepAlivePings();return}try{await this.ping()}catch(tt){log$g.error(`networkStateListener failed to recover: ${tt}`)}this.startKeepAlivePings(this.keepAliveTimeout)}startKeepAlivePings(o){if(this.keepAliveInterval){log$g.info("Recurring pings already set up.");return}this.keepAliveInterval=setInterval(()=>{this.ping()},o)}stopKeepAlivePings(){if(!this.keepAliveInterval){log$g.info("Already stopped recurring pings.");return}log$g.info("Stopping recurring pings."),clearInterval(this.keepAliveInterval),this.keepAliveInterval=null}async sendLightPushCheckMessage(o){if(this.lightPush&&this.libp2p&&this.reliabilityMonitor.shouldVerifyPeer(o.id)){const tt=createEncoder({contentTopic:this.buildLightPushContentTopic(),pubsubTopic:this.pubsubTopic,ephemeral:!0}),rt={payload:new Uint8Array(1)},nt=await tt.toProtoObj(rt);setTimeout(async()=>{const ot=await this.lightPush.protocol.send(tt,rt,o);if(this.reliabilityMonitor.notifyMessageSent(o.id,nt),ot.failure){log$g.error(`failed to send lightPush ping message to peer:${o.id.toString()} ${ot.failure.error}`);return}},DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL)}}buildLightPushContentTopic(){return`/js-waku-subscription-ping/1/${this.libp2p.peerId.toString()}/utf8`}}async function pushMessage(et,o,tt){const{decoders:rt,callback:nt}=et,{contentTopic:ot}=tt;if(!ot){log$g.warn("Message has no content topic, skipping");return}try{const it=rt.map(at=>at.fromProtoObj(o,tt).then(ct=>ct||Promise.reject("Decoding failed"))),st=await Promise.any(it);await nt(st)}catch(it){log$g.error("Error decoding message",it)}}const log$f=new Logger$1("sdk:filter");class Filter extends BaseProtocolSDK{constructor(tt,rt,nt,ot){super(new FilterCore(async(it,st,at)=>{const ct=this.getActiveSubscription(it);if(!ct){log$f.error(`No subscription locally registered for topic ${it}`);return}await ct.processIncomingMessage(st,at)},tt.configuredPubsubTopics,rt),tt,{numPeersToUse:ot==null?void 0:ot.numPeersToUse});wt(this,"libp2p");wt(this,"lightPush");wt(this,"protocol");wt(this,"activeSubscriptions",new Map);this.libp2p=rt,this.lightPush=nt,this.protocol=this.core,this.activeSubscriptions=new Map}async subscribe(tt,rt,nt,ot=DEFAULT_SUBSCRIBE_OPTIONS){const it=this.getUniquePubsubTopics(tt);if(it.length!==1)return{subscription:null,error:ProtocolError$1.INVALID_DECODER_TOPICS,results:null};const st=it[0],{subscription:at,error:ct}=await this.createSubscription(st,nt);if(ct)return{subscription:null,error:ct,results:null};const{failures:lt,successes:dt}=await at.subscribe(tt,rt,ot);return{subscription:at,error:null,results:{failures:lt,successes:dt}}}async createSubscription(tt,rt){var st;rt={autoRetry:!0,...rt};const nt=typeof tt=="string"?tt:(st=shardInfoToPubsubTopics(tt))==null?void 0:st[0];return ensurePubsubTopicIsConfigured(nt,this.protocol.pubsubTopics),await this.hasPeers(rt)?(log$f.info(`Creating filter subscription with ${this.connectedPeers.length} peers: `,this.connectedPeers.map(at=>at.id.toString())),{error:null,subscription:this.getActiveSubscription(nt)??this.setActiveSubscription(nt,new SubscriptionManager(nt,this.protocol,this.connectionManager,()=>this.connectedPeers,this.renewPeer.bind(this),this.libp2p,this.lightPush))}):{error:ProtocolError$1.NO_PEER_AVAILABLE,subscription:null}}async subscribeWithUnsubscribe(tt,rt,nt=DEFAULT_SUBSCRIBE_OPTIONS){const ot=this.getUniquePubsubTopics(tt);if(ot.length===0)throw Error("Failed to subscribe: no pubsubTopic found on decoders provided.");if(ot.length>1)throw Error("Failed to subscribe: all decoders should have the same pubsub topic. Use createSubscription to be more agile.");const{subscription:it,error:st}=await this.createSubscription(ot[0]);if(st)throw Error(`Failed to create subscription: ${st}`);await it.subscribe(tt,rt,nt);const at=Array.from(groupByContentTopic(Array.isArray(tt)?tt:[tt]).keys());return async()=>{await it.unsubscribe(at)}}toSubscriptionIterator(tt){return toAsyncIterator(this,tt)}getActiveSubscription(tt){return this.activeSubscriptions.get(tt)}setActiveSubscription(tt,rt){return this.activeSubscriptions.set(tt,rt),rt}getUniquePubsubTopics(tt){return Array.isArray(tt)?tt.length===0?[]:[...new Set(tt.map(nt=>nt.pubsubTopic))]:[tt.pubsubTopic]}}function wakuFilter(et,o,tt){return rt=>new Filter(et,rt,o,tt)}const log$e=new Logger$1("sdk:light-push"),DEFAULT_MAX_ATTEMPTS=3,DEFAULT_SEND_OPTIONS={autoRetry:!1,maxAttempts:DEFAULT_MAX_ATTEMPTS};class LightPush{constructor(o,tt,rt){wt(this,"libp2p");wt(this,"numPeersToUse",DEFAULT_NUM_PEERS_TO_USE);wt(this,"protocol");this.libp2p=tt,this.numPeersToUse=(rt==null?void 0:rt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE,this.protocol=new LightPushCore(o.configuredPubsubTopics,tt)}async send(o,tt,rt=DEFAULT_SEND_OPTIONS){const nt=[],ot=[],{pubsubTopic:it}=o;try{ensurePubsubTopicIsConfigured(it,this.protocol.pubsubTopics)}catch{return log$e.error("Failed to send waku light push: pubsub topic not configured"),{successes:nt,failures:[{error:ProtocolError$1.TOPIC_NOT_CONFIGURED}]}}const st=await this.getConnectedPeers();if(st.length===0)return{successes:nt,failures:[{error:ProtocolError$1.NO_PEER_AVAILABLE}]};const at=await Promise.allSettled(st.map(ct=>this.protocol.send(o,tt,ct)));for(const ct of at){if(ct.status!=="fulfilled"){log$e.error("Failed unexpectedly while sending:",ct.reason),ot.push({error:ProtocolError$1.GENERIC_FAIL});continue}const{failure:lt,success:dt}=ct.value;if(dt){nt.push(dt);continue}lt&&(ot.push(lt),rt!=null&&rt.autoRetry&&this.attemptRetries(ht=>this.protocol.send(o,tt,ht),rt.maxAttempts))}return getHealthManager().updateProtocolHealth(this.protocol.multicodec,nt.length),{successes:nt,failures:ot}}async attemptRetries(o,tt){var nt;tt=tt||DEFAULT_MAX_ATTEMPTS;const rt=await this.getConnectedPeers();if(rt.length===0){log$e.warn("Cannot retry with no connected peers.");return}for(let ot=0;ot{try{return await this.libp2p.peerStore.get(rt)}catch{return null}}))).filter(rt=>!!rt).filter(rt=>rt.protocols.includes(LightPushCodec)).slice(0,this.numPeersToUse)}}function wakuLightPush(et,o={}){return tt=>new LightPush(et,tt,o)}const DEFAULT_NUM_PEERS=1,log$d=new Logger$1("waku:store:sdk");class Store extends BaseProtocolSDK{constructor(tt,rt,nt){super(new StoreCore(tt.configuredPubsubTopics,rt),tt,{numPeersToUse:DEFAULT_NUM_PEERS});wt(this,"peerIdStrToUse");wt(this,"protocol");this.peerIdStrToUse=nt,this.protocol=this.core}async*queryGenerator(tt,rt){const{pubsubTopic:nt,contentTopics:ot,decodersAsMap:it}=this.validateDecodersAndPubsubTopic(tt),st={pubsubTopic:nt,contentTopics:ot,includeData:!0,paginationForward:!0,...rt},at=(await this.protocol.getPeers({numPeers:this.numPeersToUse,maxBootstrapPeers:1,peerIdStr:this.peerIdStrToUse}))[0];if(!at)throw log$d.error("No peers available to query"),new Error("No peers available to query");log$d.info(`Querying store with options: ${JSON.stringify(rt)}`);const ct=this.protocol.queryPerPage(st,it,at);for await(const lt of ct)yield lt}async queryWithOrderedCallback(tt,rt,nt){log$d.info("Querying store with ordered callback");for await(const ot of this.queryGenerator(tt,nt))if(await this.processMessages(ot,rt))break}async queryWithPromiseCallback(tt,rt,nt){log$d.info("Querying store with promise callback");let ot=!1;for await(const it of this.queryGenerator(tt,nt)){const st=it.map(async at=>{ot||(ot=!!await rt(at))});if(await Promise.all(st),ot)break}}async processMessages(tt,rt){let nt=!1;const it=(await Promise.all(tt)).filter(isDefined);return await Promise.all(it.map(async st=>{st&&!nt&&(nt=!!await rt(st))})),nt}createCursor(tt){return messageHash(tt.pubsubTopic,tt)}validateDecodersAndPubsubTopic(tt){if(tt.length===0)throw log$d.error("No decoders provided"),new Error("No decoders provided");const rt=Array.from(new Set(tt.map(st=>st.pubsubTopic)));if(rt.length>1)throw log$d.error("API does not support querying multiple pubsub topics at once"),new Error("API does not support querying multiple pubsub topics at once");const nt=rt[0];ensurePubsubTopicIsConfigured(nt,this.protocol.pubsubTopics);const ot=new Map;tt.forEach(st=>{if(ot.has(st.contentTopic))throw log$d.error("API does not support different decoder per content topic"),new Error("API does not support different decoder per content topic");ot.set(st.contentTopic,st)});const it=tt.filter(st=>st.pubsubTopic===nt).map(st=>st.contentTopic);if(it.length===0)throw log$d.error(`No decoders found for topic ${nt}`),new Error("No decoders found for topic "+nt);return{pubsubTopic:nt,contentTopics:it,decodersAsMap:ot}}}function wakuStore(et,o){return tt=>new Store(et,tt,o)}const log$c=new Logger$1("wait-for-remote-peer");async function waitForRemotePeer(et,o,tt){o=o!=null&&o.length?o:getEnabledProtocols(et);const rt=et.libp2p.getConnections();if(!et.isStarted())throw Error("Waku node is not started");if(rt.length>0&&!o.includes(Protocols.Relay)&&await waitForMetadata(et,o))return;const nt=[];if(o.includes(Protocols.Relay)){if(!et.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");nt.push(et.relay.waitForPeers())}if(o.includes(Protocols.Store)){if(!et.store)throw Error("Cannot wait for Store peer: protocol not mounted");nt.push(waitForConnectedPeer(StoreCodec,et.libp2p))}if(o.includes(Protocols.LightPush)){if(!et.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");nt.push(waitForConnectedPeer(LightPushCodec,et.libp2p))}if(o.includes(Protocols.Filter)){if(!et.filter)throw new Error("Cannot wait for Filter peer: protocol not mounted");nt.push(waitForConnectedPeer(FilterCodecs.SUBSCRIBE,et.libp2p))}tt?await rejectOnTimeout(Promise.all(nt),tt,"Timed out waiting for a remote peer."):await Promise.all(nt)}async function waitForConnectedPeer(et,o){log$c.info(`Waiting for ${et} peer.`),await new Promise(tt=>{const rt=async nt=>{var ot,it;if((it=(ot=nt.detail)==null?void 0:ot.protocols)!=null&&it.includes(et)){const st=o.services.metadata;if(!st){o.removeEventListener("peer:identify",rt),tt();return}try{await st.confirmOrAttemptHandshake(nt.detail.peerId),o.removeEventListener("peer:identify",rt),tt()}catch(at){at.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error waiting for metadata: ${at}`)}}};o.addEventListener("peer:identify",rt)})}async function waitForMetadata(et,o){const tt=et.libp2p.getPeers(),rt=et.libp2p.services.metadata,nt=mapProtocolsToCodecs(o);if(!tt.length||!rt)return log$c.info(`Skipping waitForMetadata due to missing connections:${tt.length} or metadataService:${!!rt}`),!1;for(const ot of tt)try{const it=await et.libp2p.peerStore.get(ot);if(it.protocols.some(at=>nt.has(at))&&!(await rt.confirmOrAttemptHandshake(ot)).error&&(it.protocols.forEach(lt=>{nt.has(lt)&&nt.set(lt,!0)}),Array.from(nt.values()).every(lt=>lt)))return!0}catch(it){it.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error while iterating through peers: ${it}`);continue}return!1}const awaitTimeout=(et,o)=>new Promise((tt,rt)=>setTimeout(()=>rt(Error(o)),et));async function rejectOnTimeout(et,o,tt){await Promise.race([et,awaitTimeout(o,tt)])}function getEnabledProtocols(et){const o=[];return et.relay&&o.push(Protocols.Relay),et.filter&&o.push(Protocols.Filter),et.store&&o.push(Protocols.Store),et.lightPush&&o.push(Protocols.LightPush),o}function mapProtocolsToCodecs(et){const o=new Map,tt={[Protocols.Filter]:FilterCodecs.SUBSCRIBE,[Protocols.LightPush]:LightPushCodec,[Protocols.Store]:StoreCodec};for(const rt of et)tt[rt]&&o.set(tt[rt],!1);return o}const DefaultPingKeepAliveValueSecs=5*60,DefaultRelayKeepAliveValueSecs=5*60,DefaultUserAgent="js-waku",DefaultPingMaxInboundStreams=10,log$b=new Logger$1("waku");class WakuNode{constructor(o,tt,rt,nt,ot){wt(this,"pubsubTopics");wt(this,"libp2p");wt(this,"relay");wt(this,"store");wt(this,"filter");wt(this,"lightPush");wt(this,"connectionManager");wt(this,"health");var ct;this.pubsubTopics=o,this.relay=ot,this.libp2p=rt,nt={filter:!1,lightpush:!1,store:!1,...nt};const it=tt.pingKeepAlive||DefaultPingKeepAliveValueSecs,st=this.relay?tt.relayKeepAlive||DefaultRelayKeepAliveValueSecs:0,at=this.libp2p.peerId.toString();if(this.connectionManager=ConnectionManager.create(at,rt,{pingKeepAlive:it,relayKeepAlive:st},this.pubsubTopics,this.relay),this.health=getHealthManager(),nt.store){let lt;(ct=tt.nodeToUse)!=null&&ct.store&&this.dialMultiaddr(tt.nodeToUse.store,StoreCodec).catch(ht=>{log$b.error("Failed to dial store peer",ht)});const dt=wakuStore(this.connectionManager,lt);this.store=dt(rt)}if(nt.lightpush){const lt=wakuLightPush(this.connectionManager,tt);this.lightPush=lt(rt)}if(nt.filter){const lt=wakuFilter(this.connectionManager,this.lightPush,tt);this.filter=lt(rt)}log$b.info("Waku node created",at,`relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this.lightPush}, filter: ${!!this.filter}`)}get peerId(){return this.libp2p.peerId}get protocols(){return this.libp2p.getProtocols()}async dial(o,tt){const rt=tt??[],nt=this.mapToPeerIdOrMultiaddr(o);typeof tt>"u"&&(this.relay&&rt.push(Protocols.Relay),this.store&&rt.push(Protocols.Store),this.filter&&rt.push(Protocols.Filter),this.lightPush&&rt.push(Protocols.LightPush));const ot=[];return rt.includes(Protocols.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach(it=>ot.push(it)):log$b.error("Relay codec not included in dial codec: protocol not mounted locally")),rt.includes(Protocols.Store)&&(this.store?ot.push(this.store.protocol.multicodec):log$b.error("Store codec not included in dial codec: protocol not mounted locally")),rt.includes(Protocols.LightPush)&&(this.lightPush?ot.push(this.lightPush.protocol.multicodec):log$b.error("Light Push codec not included in dial codec: protocol not mounted locally")),rt.includes(Protocols.Filter)&&(this.filter?ot.push(this.filter.protocol.multicodec):log$b.error("Filter codec not included in dial codec: protocol not mounted locally")),log$b.info(`Dialing to ${nt.toString()} with protocols ${rt}`),this.libp2p.dialProtocol(nt,ot)}async start(){await this.libp2p.start()}async stop(){ReliabilityMonitorManager.stopAll(),this.connectionManager.stop(),await this.libp2p.stop()}async waitForPeers(o,tt){return waitForRemotePeer(this,o,tt)}isStarted(){return this.libp2p.status=="started"}isConnected(){return this.connectionManager.isConnected()}async dialMultiaddr(o,tt){const rt=multiaddr(o);if(!rt.getPeerId())throw new Error("Failed to dial multiaddr: missing peer ID");return await this.libp2p.dialProtocol(rt,[tt]),rt.getPeerId()}mapToPeerIdOrMultiaddr(o){return isPeerId$2(o)?o:multiaddr(o)}}var hs;let InvalidParametersError$3=(hs=class extends Error{constructor(o="Invalid parameters"){super(o),this.name="InvalidParametersError"}},wt(hs,"name","InvalidParametersError"),hs);class InvalidPublicKeyError extends Error{constructor(o="Invalid public key"){super(o),this.name="InvalidPublicKeyError"}}wt(InvalidPublicKeyError,"name","InvalidPublicKeyError");var ps;let UnsupportedKeyTypeError$1=(ps=class extends Error{constructor(o="Unsupported key type"){super(o),this.name="UnsupportedKeyTypeError"}},wt(ps,"name","UnsupportedKeyTypeError"),ps);function equals$b(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),rt=0;rt>>0,vt=new Uint8Array(xt);gt!==bt;){for(var Et=ft[gt],Ct=0,St=xt-1;(Et!==0||Ct>>0,vt[St]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=Ct,gt++}for(var At=xt-yt;At!==xt&&vt[At]===0;)At++;for(var kt=at.repeat(pt);At>>0,xt=new Uint8Array(bt);ft[pt];){var vt=tt[ft.charCodeAt(pt)];if(vt===255)return;for(var Et=0,Ct=bt-1;(vt!==0||Et>>0,xt[Ct]=vt%256>>>0,vt=vt/256>>>0;if(vt!==0)throw new Error("Non-zero carry");gt=Et,pt++}if(ft[pt]!==" "){for(var St=bt-gt;St!==bt&&xt[St]===0;)St++;for(var At=new Uint8Array(yt+(bt-St)),kt=yt;St!==bt;)At[kt++]=xt[St++];return At}}}function mt(ft){var pt=ht(ft);if(pt)return pt;throw new Error(`Non-${o} character`)}return{encode:dt,decodeUnsafe:ht,decode:mt}}var src$i=base$i,_brrp__multiformats_scope_baseX$h=src$i;let Encoder$i=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");this.name=o,this.prefix=tt,this.baseEncode=rt}encode(o){if(o instanceof Uint8Array)return`${this.prefix}${this.baseEncode(o)}`;throw Error("Unknown type, must be binary type")}},Decoder$i=class{constructor(o,tt,rt){wt(this,"name");wt(this,"prefix");wt(this,"baseDecode");wt(this,"prefixCodePoint");this.name=o,this.prefix=tt;const nt=tt.codePointAt(0);if(nt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=nt,this.baseDecode=rt}decode(o){if(typeof o=="string"){if(o.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(o)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(o.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(o){return or$j(this,o)}},ComposedDecoder$h=class{constructor(o){wt(this,"decoders");this.decoders=o}or(o){return or$j(this,o)}decode(o){const tt=o[0],rt=this.decoders[tt];if(rt!=null)return rt.decode(o);throw RangeError(`Unable to decode multibase string ${JSON.stringify(o)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function or$j(et,o){return new ComposedDecoder$h({...et.decoders??{[et.prefix]:et},...o.decoders??{[o.prefix]:o}})}let Codec$h=class{constructor(o,tt,rt,nt){wt(this,"name");wt(this,"prefix");wt(this,"baseEncode");wt(this,"baseDecode");wt(this,"encoder");wt(this,"decoder");this.name=o,this.prefix=tt,this.baseEncode=rt,this.baseDecode=nt,this.encoder=new Encoder$i(o,tt,rt),this.decoder=new Decoder$i(o,tt,nt)}encode(o){return this.encoder.encode(o)}decode(o){return this.decoder.decode(o)}};function from$k({name:et,prefix:o,encode:tt,decode:rt}){return new Codec$h(et,o,tt,rt)}function baseX$h({name:et,prefix:o,alphabet:tt}){const{encode:rt,decode:nt}=_brrp__multiformats_scope_baseX$h(tt,et);return from$k({prefix:o,name:et,encode:rt,decode:ot=>coerce$h(nt(ot))})}function decode$O(et,o,tt,rt){const nt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$G(et,o,tt){const rt=o[o.length-1]==="=",nt=(1<tt;)it-=tt,ot+=o[nt&st>>it];if(it!==0&&(ot+=o[nt&st<=INT$4;)o[tt++]=et&255|MSB$6,et/=128;for(;et&MSBALL$4;)o[tt++]=et&255|MSB$6,et>>>=7;return o[tt]=et|0,encode$F.bytes=tt-rt+1,o}var decode$N=read$5,MSB$1$4=128,REST$1$4=127;function read$5(et,rt){var tt=0,rt=rt||0,nt=0,ot=rt,it,st=et.length;do{if(ot>=st)throw read$5.bytes=0,new RangeError("Could not decode varint");it=et[ot++],tt+=nt<28?(it&REST$1$4)<=MSB$1$4);return read$5.bytes=ot-rt,tt}var N1$4=Math.pow(2,7),N2$4=Math.pow(2,14),N3$4=Math.pow(2,21),N4$4=Math.pow(2,28),N5$4=Math.pow(2,35),N6$4=Math.pow(2,42),N7$4=Math.pow(2,49),N8$4=Math.pow(2,56),N9$4=Math.pow(2,63),length$4=function(et){return et{const[dt,ht]=decode$M(o.subarray(tt));return tt+=ht,dt};let nt=rt(),ot=DAG_PB_CODE$2;if(nt===18?(nt=0,tt=0):ot=rt(),nt!==0&&nt!==1)throw new RangeError(`Invalid CID version ${nt}`);const it=tt,st=rt(),at=rt(),ct=tt+at,lt=ct-it;return{version:nt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(o,tt){const[rt,nt]=parseCIDtoBytes$2(o,tt),ot=Nr.decode(nt);if(ot.version===0&&o[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache$2(ot).set(rt,o),ot}};function parseCIDtoBytes$2(et,o){switch(et[0]){case"Q":{const tt=o??base58btc$h;return[base58btc$h.prefix,tt.decode(`${base58btc$h.prefix}${et}`)]}case base58btc$h.prefix:{const tt=o??base58btc$h;return[base58btc$h.prefix,tt.decode(et)]}case base32$u.prefix:{const tt=o??base32$u;return[base32$u.prefix,tt.decode(et)]}case base36$r.prefix:{const tt=o??base36$r;return[base36$r.prefix,tt.decode(et)]}default:{if(o==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[et[0],o.decode(et)]}}}function toStringV0$2(et,o,tt){const{prefix:rt}=tt;if(rt!==base58btc$h.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const nt=o.get(rt);if(nt==null){const ot=tt.encode(et).slice(1);return o.set(rt,ot),ot}else return nt}function toStringV1$2(et,o,tt){const{prefix:rt}=tt,nt=o.get(rt);if(nt==null){const ot=tt.encode(et);return o.set(rt,ot),ot}else return nt}const DAG_PB_CODE$2=112,SHA_256_CODE$2=18;function encodeCID$2(et,o,tt){const rt=encodingLength$4(et),nt=rt+encodingLength$4(o),ot=new Uint8Array(nt+tt.byteLength);return encodeTo$2(et,ot,0),encodeTo$2(o,ot,rt),ot.set(tt,nt),ot}const cidSymbol$2=Symbol.for("@ipld/js-cid/CID"),code$2=0,name$4="identity",encode$E=coerce$h;function digest$1(et){return create$5(code$2,encode$E(et))}const identity$f={code:code$2,name:name$4,encode:encode$E,digest:digest$1};function equals$9(et,o){if(et===o)return!0;if(et.byteLength!==o.byteLength)return!1;for(let tt=0;ttBigInt(et))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:o,Al:tt,Bh:rt,Bl:nt,Ch:ot,Cl:it,Dh:st,Dl:at,Eh:ct,El:lt,Fh:dt,Fl:ht,Gh:mt,Gl:ft,Hh:pt,Hl:yt}=this;return[o,tt,rt,nt,ot,it,st,at,ct,lt,dt,ht,mt,ft,pt,yt]}set(o,tt,rt,nt,ot,it,st,at,ct,lt,dt,ht,mt,ft,pt,yt){this.Ah=o|0,this.Al=tt|0,this.Bh=rt|0,this.Bl=nt|0,this.Ch=ot|0,this.Cl=it|0,this.Dh=st|0,this.Dl=at|0,this.Eh=ct|0,this.El=lt|0,this.Fh=dt|0,this.Fl=ht|0,this.Gh=mt|0,this.Gl=ft|0,this.Hh=pt|0,this.Hl=yt|0}process(o,tt){for(let xt=0;xt<16;xt++,tt+=4)SHA512_W_H[xt]=o.getUint32(tt),SHA512_W_L[xt]=o.getUint32(tt+=4);for(let xt=16;xt<80;xt++){const vt=SHA512_W_H[xt-15]|0,Et=SHA512_W_L[xt-15]|0,Ct=u64.rotrSH(vt,Et,1)^u64.rotrSH(vt,Et,8)^u64.shrSH(vt,Et,7),St=u64.rotrSL(vt,Et,1)^u64.rotrSL(vt,Et,8)^u64.shrSL(vt,Et,7),At=SHA512_W_H[xt-2]|0,kt=SHA512_W_L[xt-2]|0,It=u64.rotrSH(At,kt,19)^u64.rotrBH(At,kt,61)^u64.shrSH(At,kt,6),Nt=u64.rotrSL(At,kt,19)^u64.rotrBL(At,kt,61)^u64.shrSL(At,kt,6),Lt=u64.add4L(St,Nt,SHA512_W_L[xt-7],SHA512_W_L[xt-16]),Mt=u64.add4H(Lt,Ct,It,SHA512_W_H[xt-7],SHA512_W_H[xt-16]);SHA512_W_H[xt]=Mt|0,SHA512_W_L[xt]=Lt|0}let{Ah:rt,Al:nt,Bh:ot,Bl:it,Ch:st,Cl:at,Dh:ct,Dl:lt,Eh:dt,El:ht,Fh:mt,Fl:ft,Gh:pt,Gl:yt,Hh:gt,Hl:bt}=this;for(let xt=0;xt<80;xt++){const vt=u64.rotrSH(dt,ht,14)^u64.rotrSH(dt,ht,18)^u64.rotrBH(dt,ht,41),Et=u64.rotrSL(dt,ht,14)^u64.rotrSL(dt,ht,18)^u64.rotrBL(dt,ht,41),Ct=dt&mt^~dt&pt,St=ht&ft^~ht&yt,At=u64.add5L(bt,Et,St,SHA512_Kl[xt],SHA512_W_L[xt]),kt=u64.add5H(At,gt,vt,Ct,SHA512_Kh[xt],SHA512_W_H[xt]),It=At|0,Nt=u64.rotrSH(rt,nt,28)^u64.rotrBH(rt,nt,34)^u64.rotrBH(rt,nt,39),Lt=u64.rotrSL(rt,nt,28)^u64.rotrBL(rt,nt,34)^u64.rotrBL(rt,nt,39),Mt=rt&ot^rt&st^ot&st,zt=nt&it^nt&at^it&at;gt=pt|0,bt=yt|0,pt=mt|0,yt=ft|0,mt=dt|0,ft=ht|0,{h:dt,l:ht}=u64.add(ct|0,lt|0,kt|0,It|0),ct=st|0,lt=at|0,st=ot|0,at=it|0,ot=rt|0,it=nt|0;const Ut=u64.add3L(It,Lt,zt);rt=u64.add3H(Ut,kt,Nt,Mt),nt=Ut|0}({h:rt,l:nt}=u64.add(this.Ah|0,this.Al|0,rt|0,nt|0)),{h:ot,l:it}=u64.add(this.Bh|0,this.Bl|0,ot|0,it|0),{h:st,l:at}=u64.add(this.Ch|0,this.Cl|0,st|0,at|0),{h:ct,l:lt}=u64.add(this.Dh|0,this.Dl|0,ct|0,lt|0),{h:dt,l:ht}=u64.add(this.Eh|0,this.El|0,dt|0,ht|0),{h:mt,l:ft}=u64.add(this.Fh|0,this.Fl|0,mt|0,ft|0),{h:pt,l:yt}=u64.add(this.Gh|0,this.Gl|0,pt|0,yt|0),{h:gt,l:bt}=u64.add(this.Hh|0,this.Hl|0,gt|0,bt|0),this.set(rt,nt,ot,it,st,at,ct,lt,dt,ht,mt,ft,pt,yt,gt,bt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1),_2n$2=BigInt(2),_8n$2=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts$1(et){const o=validateBasic(et);return validateObject(et,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...o})}function twistedEdwards(et){const o=validateOpts$1(et),{Fp:tt,n:rt,prehash:nt,hash:ot,randomBytes:it,nByteLength:st,h:at}=o,ct=_2n$2<{try{return{isValid:!0,value:tt.sqrt(Xt*tt.inv(Wt))}}catch{return{isValid:!1,value:_0n$2}}}),mt=o.adjustScalarBytes||(Xt=>Xt),ft=o.domain||((Xt,Wt,Ft)=>{if(abool("phflag",Ft),Wt.length||Ft)throw new Error("Contexts/pre-hash are not supported");return Xt});function pt(Xt,Wt){aInRange("coordinate "+Xt,Wt,_0n$2,ct)}function yt(Xt){if(!(Xt instanceof xt))throw new Error("ExtendedPoint expected")}const gt=memoized((Xt,Wt)=>{const{ex:Ft,ey:qt,ez:Pt}=Xt,Yt=Xt.is0();Wt==null&&(Wt=Yt?_8n$2:tt.inv(Pt));const Qt=lt(Ft*Wt),jt=lt(qt*Wt),Gt=lt(Pt*Wt);if(Yt)return{x:_0n$2,y:_1n$3};if(Gt!==_1n$3)throw new Error("invZ was invalid");return{x:Qt,y:jt}}),bt=memoized(Xt=>{const{a:Wt,d:Ft}=o;if(Xt.is0())throw new Error("bad point: ZERO");const{ex:qt,ey:Pt,ez:Yt,et:Qt}=Xt,jt=lt(qt*qt),Gt=lt(Pt*Pt),rr=lt(Yt*Yt),Ht=lt(rr*rr),dr=lt(jt*Wt),Zt=lt(rr*lt(dr+Gt)),Jt=lt(Ht+lt(Ft*lt(jt*Gt)));if(Zt!==Jt)throw new Error("bad point: equation left != right (1)");const tr=lt(qt*Pt),_t=lt(Yt*Qt);if(tr!==_t)throw new Error("bad point: equation left != right (2)");return!0});class xt{constructor(Wt,Ft,qt,Pt){this.ex=Wt,this.ey=Ft,this.ez=qt,this.et=Pt,pt("x",Wt),pt("y",Ft),pt("z",qt),pt("t",Pt),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Wt){if(Wt instanceof xt)throw new Error("extended point not allowed");const{x:Ft,y:qt}=Wt||{};return pt("x",Ft),pt("y",qt),new xt(Ft,qt,_1n$3,lt(Ft*qt))}static normalizeZ(Wt){const Ft=tt.invertBatch(Wt.map(qt=>qt.ez));return Wt.map((qt,Pt)=>qt.toAffine(Ft[Pt])).map(xt.fromAffine)}static msm(Wt,Ft){return pippenger(xt,dt,Wt,Ft)}_setWindowSize(Wt){Ct.setWindowSize(this,Wt)}assertValidity(){bt(this)}equals(Wt){yt(Wt);const{ex:Ft,ey:qt,ez:Pt}=this,{ex:Yt,ey:Qt,ez:jt}=Wt,Gt=lt(Ft*jt),rr=lt(Yt*Pt),Ht=lt(qt*jt),dr=lt(Qt*Pt);return Gt===rr&&Ht===dr}is0(){return this.equals(xt.ZERO)}negate(){return new xt(lt(-this.ex),this.ey,this.ez,lt(-this.et))}double(){const{a:Wt}=o,{ex:Ft,ey:qt,ez:Pt}=this,Yt=lt(Ft*Ft),Qt=lt(qt*qt),jt=lt(_2n$2*lt(Pt*Pt)),Gt=lt(Wt*Yt),rr=Ft+qt,Ht=lt(lt(rr*rr)-Yt-Qt),dr=Gt+Qt,Zt=dr-jt,Jt=Gt-Qt,tr=lt(Ht*Zt),_t=lt(dr*Jt),Bt=lt(Ht*Jt),Vt=lt(Zt*dr);return new xt(tr,_t,Vt,Bt)}add(Wt){yt(Wt);const{a:Ft,d:qt}=o,{ex:Pt,ey:Yt,ez:Qt,et:jt}=this,{ex:Gt,ey:rr,ez:Ht,et:dr}=Wt;if(Ft===BigInt(-1)){const pr=lt((Yt-Pt)*(rr+Gt)),wr=lt((Yt+Pt)*(rr-Gt)),_r=lt(wr-pr);if(_r===_0n$2)return this.double();const Tr=lt(Qt*_2n$2*dr),gr=lt(jt*_2n$2*Ht),vr=gr+Tr,ir=wr+pr,Tt=gr-Tr,$t=lt(vr*_r),Rt=lt(ir*Tt),Dt=lt(vr*Tt),Kt=lt(_r*ir);return new xt($t,Rt,Kt,Dt)}const Zt=lt(Pt*Gt),Jt=lt(Yt*rr),tr=lt(jt*qt*dr),_t=lt(Qt*Ht),Bt=lt((Pt+Yt)*(Gt+rr)-Zt-Jt),Vt=_t-tr,er=_t+tr,ar=lt(Jt-Ft*Zt),ur=lt(Bt*Vt),cr=lt(er*ar),hr=lt(Bt*ar),Sr=lt(Vt*er);return new xt(ur,cr,Sr,hr)}subtract(Wt){return this.add(Wt.negate())}wNAF(Wt){return Ct.wNAFCached(this,Wt,xt.normalizeZ)}multiply(Wt){const Ft=Wt;aInRange("scalar",Ft,_1n$3,rt);const{p:qt,f:Pt}=this.wNAF(Ft);return xt.normalizeZ([qt,Pt])[0]}multiplyUnsafe(Wt){const Ft=Wt;return aInRange("scalar",Ft,_0n$2,rt),Ft===_0n$2?Et:this.equals(Et)||Ft===_1n$3?this:this.equals(vt)?this.wNAF(Ft).p:Ct.unsafeLadder(this,Ft)}isSmallOrder(){return this.multiplyUnsafe(at).is0()}isTorsionFree(){return Ct.unsafeLadder(this,rt).is0()}toAffine(Wt){return gt(this,Wt)}clearCofactor(){const{h:Wt}=o;return Wt===_1n$3?this:this.multiplyUnsafe(Wt)}static fromHex(Wt,Ft=!1){const{d:qt,a:Pt}=o,Yt=tt.BYTES;Wt=ensureBytes$1("pointHex",Wt,Yt),abool("zip215",Ft);const Qt=Wt.slice(),jt=Wt[Yt-1];Qt[Yt-1]=jt&-129;const Gt=bytesToNumberLE(Qt),rr=Ft?ct:tt.ORDER;aInRange("pointHex.y",Gt,_0n$2,rr);const Ht=lt(Gt*Gt),dr=lt(Ht-_1n$3),Zt=lt(qt*Ht-Pt);let{isValid:Jt,value:tr}=ht(dr,Zt);if(!Jt)throw new Error("Point.fromHex: invalid y coordinate");const _t=(tr&_1n$3)===_1n$3,Bt=(jt&128)!==0;if(!Ft&&tr===_0n$2&&Bt)throw new Error("Point.fromHex: x=0 and x_0=1");return Bt!==_t&&(tr=lt(-tr)),xt.fromAffine({x:tr,y:Gt})}static fromPrivateKey(Wt){return kt(Wt).point}toRawBytes(){const{x:Wt,y:Ft}=this.toAffine(),qt=numberToBytesLE(Ft,tt.BYTES);return qt[qt.length-1]|=Wt&_1n$3?128:0,qt}toHex(){return bytesToHex$2(this.toRawBytes())}}xt.BASE=new xt(o.Gx,o.Gy,_1n$3,lt(o.Gx*o.Gy)),xt.ZERO=new xt(_0n$2,_1n$3,_1n$3,_0n$2);const{BASE:vt,ZERO:Et}=xt,Ct=wNAF(xt,st*8);function St(Xt){return mod$1(Xt,rt)}function At(Xt){return St(bytesToNumberLE(Xt))}function kt(Xt){const Wt=st;Xt=ensureBytes$1("private key",Xt,Wt);const Ft=ensureBytes$1("hashed private key",ot(Xt),2*Wt),qt=mt(Ft.slice(0,Wt)),Pt=Ft.slice(Wt,2*Wt),Yt=At(qt),Qt=vt.multiply(Yt),jt=Qt.toRawBytes();return{head:qt,prefix:Pt,scalar:Yt,point:Qt,pointBytes:jt}}function It(Xt){return kt(Xt).pointBytes}function Nt(Xt=new Uint8Array,...Wt){const Ft=concatBytes$1(...Wt);return At(ot(ft(Ft,ensureBytes$1("context",Xt),!!nt)))}function Lt(Xt,Wt,Ft={}){Xt=ensureBytes$1("message",Xt),nt&&(Xt=nt(Xt));const{prefix:qt,scalar:Pt,pointBytes:Yt}=kt(Wt),Qt=Nt(Ft.context,qt,Xt),jt=vt.multiply(Qt).toRawBytes(),Gt=Nt(Ft.context,jt,Yt,Xt),rr=St(Qt+Gt*Pt);aInRange("signature.s",rr,_0n$2,rt);const Ht=concatBytes$1(jt,numberToBytesLE(rr,tt.BYTES));return ensureBytes$1("result",Ht,st*2)}const Mt=VERIFY_DEFAULT;function zt(Xt,Wt,Ft,qt=Mt){const{context:Pt,zip215:Yt}=qt,Qt=tt.BYTES;Xt=ensureBytes$1("signature",Xt,2*Qt),Wt=ensureBytes$1("message",Wt),Yt!==void 0&&abool("zip215",Yt),nt&&(Wt=nt(Wt));const jt=bytesToNumberLE(Xt.slice(Qt,2*Qt));let Gt,rr,Ht;try{Gt=xt.fromHex(Ft,Yt),rr=xt.fromHex(Xt.slice(0,Qt),Yt),Ht=vt.multiplyUnsafe(jt)}catch{return!1}if(!Yt&&Gt.isSmallOrder())return!1;const dr=Nt(Pt,rr.toRawBytes(),Gt.toRawBytes(),Wt);return rr.add(Gt.multiplyUnsafe(dr)).subtract(Ht).clearCofactor().equals(xt.ZERO)}return vt._setWindowSize(8),{CURVE:o,getPublicKey:It,sign:Lt,verify:zt,ExtendedPoint:xt,utils:{getExtendedPublicKey:kt,randomPrivateKey:()=>it(tt.BYTES),precompute(Xt=8,Wt=xt.BASE){return Wt._setWindowSize(Xt),Wt.multiply(BigInt(3)),Wt}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function validateOpts(et){return validateObject(et,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...et})}function montgomery(et){const o=validateOpts(et),{P:tt}=o,rt=bt=>mod$1(bt,tt),nt=o.montgomeryBits,ot=Math.ceil(nt/8),it=o.nByteLength,st=o.adjustScalarBytes||(bt=>bt),at=o.powPminus2||(bt=>pow(bt,tt-BigInt(2),tt));function ct(bt,xt,vt){const Et=rt(bt*(xt-vt));return xt=rt(xt-Et),vt=rt(vt+Et),[xt,vt]}const lt=(o.a-BigInt(2))/BigInt(4);function dt(bt,xt){aInRange("u",bt,_0n$1,tt),aInRange("scalar",xt,_0n$1,tt);const vt=xt,Et=bt;let Ct=_1n$2,St=_0n$1,At=bt,kt=_1n$2,It=_0n$1,Nt;for(let Mt=BigInt(nt-1);Mt>=_0n$1;Mt--){const zt=vt>>Mt&_1n$2;It^=zt,Nt=ct(It,Ct,At),Ct=Nt[0],At=Nt[1],Nt=ct(It,St,kt),St=Nt[0],kt=Nt[1],It=zt;const Ut=Ct+St,Xt=rt(Ut*Ut),Wt=Ct-St,Ft=rt(Wt*Wt),qt=Xt-Ft,Pt=At+kt,Yt=At-kt,Qt=rt(Yt*Ut),jt=rt(Pt*Wt),Gt=Qt+jt,rr=Qt-jt;At=rt(Gt*Gt),kt=rt(Et*rt(rr*rr)),Ct=rt(Xt*Ft),St=rt(qt*(Xt+rt(lt*qt)))}Nt=ct(It,Ct,At),Ct=Nt[0],At=Nt[1],Nt=ct(It,St,kt),St=Nt[0],kt=Nt[1];const Lt=at(St);return rt(Ct*Lt)}function ht(bt){return numberToBytesLE(rt(bt),ot)}function mt(bt){const xt=ensureBytes$1("u coordinate",bt,ot);return it===32&&(xt[31]&=127),bytesToNumberLE(xt)}function ft(bt){const xt=ensureBytes$1("scalar",bt),vt=xt.length;if(vt!==ot&&vt!==it)throw new Error(`Expected ${ot} or ${it} bytes, got ${vt}`);return bytesToNumberLE(st(xt))}function pt(bt,xt){const vt=mt(xt),Et=ft(bt),Ct=dt(vt,Et);if(Ct===_0n$1)throw new Error("Invalid private or public key received");return ht(Ct)}const yt=ht(o.Gu);function gt(bt){return pt(bt,yt)}return{scalarMult:pt,scalarMultBase:gt,getSharedSecret:(bt,xt)=>pt(bt,xt),getPublicKey:bt=>gt(bt),utils:{randomPrivateKey:()=>o.randomBytes(o.nByteLength)},GuBytes:yt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$1=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3),_5n=BigInt(5),_8n$1=BigInt(8);function ed25519_pow_2_252_3(et){const o=BigInt(10),tt=BigInt(20),rt=BigInt(40),nt=BigInt(80),ot=ED25519_P,st=et*et%ot*et%ot,at=pow2$1(st,_2n$1,ot)*st%ot,ct=pow2$1(at,_1n$1,ot)*et%ot,lt=pow2$1(ct,_5n,ot)*ct%ot,dt=pow2$1(lt,o,ot)*lt%ot,ht=pow2$1(dt,tt,ot)*dt%ot,mt=pow2$1(ht,rt,ot)*ht%ot,ft=pow2$1(mt,nt,ot)*mt%ot,pt=pow2$1(ft,nt,ot)*mt%ot,yt=pow2$1(pt,o,ot)*lt%ot;return{pow_p_5_8:pow2$1(yt,_2n$1,ot)*et%ot,b2:st}}function adjustScalarBytes(et){return et[0]&=248,et[31]&=127,et[31]|=64,et}function uvRatio(et,o){const tt=ED25519_P,rt=mod$1(o*o*o,tt),nt=mod$1(rt*rt*o,tt),ot=ed25519_pow_2_252_3(et*nt).pow_p_5_8;let it=mod$1(et*rt*ot,tt);const st=mod$1(o*it*it,tt),at=it,ct=mod$1(it*ED25519_SQRT_M1,tt),lt=st===et,dt=st===mod$1(-et,tt),ht=st===mod$1(-et*ED25519_SQRT_M1,tt);return lt&&(it=at),(dt||ht)&&(it=ct),isNegativeLE(it,tt)&&(it=mod$1(-it,tt)),{isValid:lt||dt,value:it}}const Fp=Field$1(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n$1,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512,randomBytes:randomBytes$1,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults),x25519=montgomery({P:ED25519_P,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:et=>{const o=ED25519_P,{pow_p_5_8:tt,b2:rt}=ed25519_pow_2_252_3(et);return mod$1(pow2$1(tt,_3n$1,o)*rt,o)},adjustScalarBytes,randomBytes:randomBytes$1}),PUBLIC_KEY_BYTE_LENGTH=32,PRIVATE_KEY_BYTE_LENGTH=64,KEYS_BYTE_LENGTH=32;function generateKey(){const et=ed25519.utils.randomPrivateKey(),o=ed25519.getPublicKey(et);return{privateKey:concatKeys(et,o),publicKey:o}}function hashAndSign(et,o){const tt=et.subarray(0,KEYS_BYTE_LENGTH);return ed25519.sign(o instanceof Uint8Array?o:o.subarray(),tt)}function hashAndVerify$2(et,o,tt){return ed25519.verify(o,tt instanceof Uint8Array?tt:tt.subarray(),et)}function concatKeys(et,o){const tt=new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);for(let rt=0;rtenumeration(__KeyTypeValues)})(KeyType||(KeyType={}));var PublicKey;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.Type!=null&&(rt.uint32(8),KeyType.codec().encode(tt.Type,rt)),tt.Data!=null&&(rt.uint32(18),rt.bytes(tt.Data)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PublicKey||(PublicKey={}));var PrivateKey;(function(et){let o;et.codec=()=>(o==null&&(o=message$1((tt,rt,nt={})=>{nt.lengthDelimited!==!1&&rt.fork(),tt.Type!=null&&(rt.uint32(8),KeyType.codec().encode(tt.Type,rt)),tt.Data!=null&&(rt.uint32(18),rt.bytes(tt.Data)),nt.lengthDelimited!==!1&&rt.ldelim()},(tt,rt,nt={})=>{const ot={},it=rt==null?tt.len:tt.pos+rt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),o),et.encode=tt=>encodeMessage(tt,et.codec()),et.decode=(tt,rt)=>decodeMessage(tt,et.codec(),rt)})(PrivateKey||(PrivateKey={}));/*! @@ -4082,7 +4082,7 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LoaderCircle=createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Header=({wakuStatus:et})=>{const{address:o,isConnected:tt}=useAccount(),{disconnect:rt}=useDisconnect(),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:o});reactExports.useEffect(()=>{if(it){const ht=()=>{at(it.libp2p.getConnections().length)};return ht(),it.libp2p.addEventListener("peer:connect",ht),it.libp2p.addEventListener("peer:disconnect",ht),()=>{it.libp2p.removeEventListener("peer:connect",ht),it.libp2p.removeEventListener("peer:disconnect",ht)}}},[it]);const dt=ht=>{switch(ht){case"success":return"bg-green-500";case"in-progress":return"bg-yellow-500";case"error":return"bg-red-500"}};return jsxRuntimeExports.jsx("header",{className:"border-b",children:jsxRuntimeExports.jsx("div",{className:"container mx-auto px-4 py-4",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center space-y-2 md:space-y-0",children:[jsxRuntimeExports.jsxs("div",{className:"flex flex-col md:flex-row items-center space-y-2 md:space-y-0 md:space-x-4 w-full md:w-auto",children:[jsxRuntimeExports.jsx("h1",{className:"text-xl md:text-2xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsx("nav",{className:"w-full md:w-auto",children:jsxRuntimeExports.jsxs("ul",{className:"flex justify-center md:justify-start space-x-4",children:[jsxRuntimeExports.jsx("li",{children:jsxRuntimeExports.jsx(Link,{to:"create",className:`text-sm ${ct.pathname.endsWith("/create")?"text-primary font-semibold":"text-muted-foreground"}`,children:"Create Chain"})}),jsxRuntimeExports.jsx("li",{children:jsxRuntimeExports.jsx(Link,{to:"view",className:`text-sm ${ct.pathname.endsWith("/view")?"text-primary font-semibold":"text-muted-foreground"}`,children:"View Chains"})}),jsxRuntimeExports.jsx("li",{children:jsxRuntimeExports.jsx(Link,{to:"telemetry",className:`text-sm ${ct.pathname.endsWith("/telemetry")?"text-primary font-semibold":"text-muted-foreground"}`,children:"Telemetry"})})]})})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-wrap justify-center md:justify-end items-center gap-2 w-full md:w-auto",children:[jsxRuntimeExports.jsx("div",{className:"flex items-center space-x-2 text-xs md:text-sm",children:nt?jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}),jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Connecting..."})]}):ot?jsxRuntimeExports.jsx("span",{className:"text-destructive",children:"Network Error"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Filter:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(et.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Store:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(et.store)}`})]}),jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-muted-foreground hidden md:inline",children:st>0?`${st} peer${st===1?"":"s"}`:"Connecting..."})]})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[nt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-red-500",children:"Waku Error"}):jsxRuntimeExports.jsxs("span",{className:"text-xs md:text-sm text-muted-foreground hidden md:inline",children:["Waku Connections: ",st]}),tt?jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-muted-foreground truncate max-w-[120px] md:max-w-none",children:lt||(o?`${o.slice(0,6)}...${o.slice(-4)}`:"")}),jsxRuntimeExports.jsx(Button,{variant:"outline",size:"sm",onClick:()=>rt(),children:"Logout"})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})]})]})]})})})},Input=reactExports.forwardRef(({className:et,type:o,...tt},rt)=>jsxRuntimeExports.jsx("input",{type:o,className:cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",et),ref:rt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("textarea",{className:cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",et),ref:tt,...o}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((et,o)=>{const tt=reactExports.forwardRef((rt,nt)=>{const{asChild:ot,...it}=rt,st=ot?Slot:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:nt})});return tt.displayName=`Primitive.${o}`,{...et,[o]:tt}},{});function dispatchDiscreteCustomEvent(et,o){et&&reactDomExports.flushSync(()=>et.dispatchEvent(o))}var NAME="Label",Label$1=reactExports.forwardRef((et,o)=>jsxRuntimeExports.jsx(Primitive.label,{...et,ref:o,onMouseDown:tt=>{var nt;tt.target.closest("button, input, select, textarea")||((nt=et.onMouseDown)==null||nt.call(et,tt),!tt.defaultPrevented&&tt.detail>1&&tt.preventDefault())}}));Label$1.displayName=NAME;var Root$3=Label$1;const labelVariants=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Label=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),et),...o}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("rounded-lg border bg-card text-card-foreground shadow-sm p-4 md:p-6",et),...o}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",et),...o}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",et),...o}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",et),...o}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",et),...o}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",et),...o}));CardFooter.displayName="CardFooter";function composeEventHandlers(et,o,{checkForDefaultPrevented:tt=!0}={}){return function(nt){if(et==null||et(nt),tt===!1||!nt.defaultPrevented)return o==null?void 0:o(nt)}}function createContext2(et,o){const tt=reactExports.createContext(o),rt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};rt.displayName=et+"Provider";function nt(ot){const it=reactExports.useContext(tt);if(it)return it;if(o!==void 0)return o;throw new Error(`\`${ot}\` must be used within \`${et}\``)}return[rt,nt]}function createContextScope(et,o=[]){let tt=[];function rt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:mt,...ft}=dt,pt=((gt=ht==null?void 0:ht[et])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>ft,Object.values(ft));return jsxRuntimeExports.jsx(pt.Provider,{value:yt,children:mt})};ct.displayName=ot+"Provider";function lt(dt,ht){var pt;const mt=((pt=ht==null?void 0:ht[et])==null?void 0:pt[at])||st,ft=reactExports.useContext(mt);if(ft)return ft;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const nt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[et])||ot;return reactExports.useMemo(()=>({[`__scope${et}`]:{...st,[et]:at}}),[st,at])}};return nt.scopeName=et,[rt,composeContextScopes(nt,...o)]}function composeContextScopes(...et){const o=et[0];if(et.length===1)return o;const tt=()=>{const rt=et.map(nt=>({useScope:nt(),scopeName:nt.scopeName}));return function(ot){const it=rt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${o.scopeName}`]:it}),[it])}};return tt.scopeName=o.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(et){const[o,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{et||tt(rt=>rt??String(count$1++))},[et]),et||(o?`radix-${o}`:"")}function useCallbackRef$1(et){const o=reactExports.useRef(et);return reactExports.useEffect(()=>{o.current=et}),reactExports.useMemo(()=>(...tt)=>{var rt;return(rt=o.current)==null?void 0:rt.call(o,...tt)},[])}function useControllableState({prop:et,defaultProp:o,onChange:tt=()=>{}}){const[rt,nt]=useUncontrolledState({defaultProp:o,onChange:tt}),ot=et!==void 0,it=ot?et:rt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(et):ct;dt!==et&&st(dt)}else nt(ct)},[ot,et,nt,st]);return[it,at]}function useUncontrolledState({defaultProp:et,onChange:o}){const tt=reactExports.useState(et),[rt]=tt,nt=reactExports.useRef(rt),ot=useCallbackRef$1(o);return reactExports.useEffect(()=>{nt.current!==rt&&(ot(rt),nt.current=rt)},[rt,nt,ot]),tt}function useEscapeKeydown(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et);reactExports.useEffect(()=>{const rt=nt=>{nt.key==="Escape"&&tt(nt)};return o.addEventListener("keydown",rt,{capture:!0}),()=>o.removeEventListener("keydown",rt,{capture:!0})},[tt,o])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=reactExports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=reactExports.forwardRef((et,o)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:rt,onPointerDownOutside:nt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=et,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,mt]=reactExports.useState({}),ft=useComposedRefs(o,St=>dt(St)),pt=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=pt.indexOf(yt),bt=lt?pt.indexOf(lt):-1,xt=ct.layersWithOutsidePointerEventsDisabled.size>0,vt=bt>=gt,Et=usePointerDownOutside(St=>{const At=St.target,kt=[...ct.branches].some(It=>It.contains(At));!vt||kt||(nt==null||nt(St),it==null||it(St),St.defaultPrevented||st==null||st())},ht),Ct=useFocusOutside(St=>{const At=St.target;[...ct.branches].some(It=>It.contains(At))||(ot==null||ot(St),it==null||it(St),St.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(St=>{bt===ct.layers.size-1&&(rt==null||rt(St),!St.defaultPrevented&&st&&(St.preventDefault(),st()))},ht),reactExports.useEffect(()=>{if(lt)return tt&&(ct.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=ht.body.style.pointerEvents,ht.body.style.pointerEvents="none"),ct.layersWithOutsidePointerEventsDisabled.add(lt)),ct.layers.add(lt),dispatchUpdate(),()=>{tt&&ct.layersWithOutsidePointerEventsDisabled.size===1&&(ht.body.style.pointerEvents=originalBodyPointerEvents)}},[lt,ht,tt,ct]),reactExports.useEffect(()=>()=>{lt&&(ct.layers.delete(lt),ct.layersWithOutsidePointerEventsDisabled.delete(lt),dispatchUpdate())},[lt,ct]),reactExports.useEffect(()=>{const St=()=>mt({});return document.addEventListener(CONTEXT_UPDATE,St),()=>document.removeEventListener(CONTEXT_UPDATE,St)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:ft,style:{pointerEvents:xt?vt?"auto":"none":void 0,...et.style},onFocusCapture:composeEventHandlers(et.onFocusCapture,Ct.onFocusCapture),onBlurCapture:composeEventHandlers(et.onBlurCapture,Ct.onBlurCapture),onPointerDownCapture:composeEventHandlers(et.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((et,o)=>{const tt=reactExports.useContext(DismissableLayerContext),rt=reactExports.useRef(null),nt=useComposedRefs(o,rt);return reactExports.useEffect(()=>{const ot=rt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...et,ref:nt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et),rt=reactExports.useRef(!1),nt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!rt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(o.removeEventListener("click",nt.current),nt.current=at,o.addEventListener("click",nt.current,{once:!0})):at()}else o.removeEventListener("click",nt.current);rt.current=!1},it=window.setTimeout(()=>{o.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),o.removeEventListener("pointerdown",ot),o.removeEventListener("click",nt.current)}},[o,tt]),{onPointerDownCapture:()=>rt.current=!0}}function useFocusOutside(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et),rt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const nt=ot=>{ot.target&&!rt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return o.addEventListener("focusin",nt),()=>o.removeEventListener("focusin",nt)},[o,tt]),{onFocusCapture:()=>rt.current=!0,onBlurCapture:()=>rt.current=!1}}function dispatchUpdate(){const et=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(et)}function handleAndDispatchCustomEvent(et,o,tt,{discrete:rt}){const nt=tt.originalEvent.target,ot=new CustomEvent(et,{bubbles:!1,cancelable:!0,detail:tt});o&&nt.addEventListener(et,o,{once:!0}),rt?dispatchDiscreteCustomEvent(nt,ot):nt.dispatchEvent(ot)}var AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=reactExports.forwardRef((et,o)=>{const{loop:tt=!1,trapped:rt=!1,onMountAutoFocus:nt,onUnmountAutoFocus:ot,...it}=et,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(nt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(o,pt=>at(pt)),mt=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(rt){let pt=function(xt){if(mt.paused||!st)return;const vt=xt.target;st.contains(vt)?dt.current=vt:focus(dt.current,{select:!0})},yt=function(xt){if(mt.paused||!st)return;const vt=xt.relatedTarget;vt!==null&&(st.contains(vt)||focus(dt.current,{select:!0}))},gt=function(xt){if(document.activeElement===document.body)for(const Et of xt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",pt),document.addEventListener("focusout",yt);const bt=new MutationObserver(gt);return st&&bt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",pt),document.removeEventListener("focusout",yt),bt.disconnect()}}},[rt,st,mt.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(mt);const pt=document.activeElement;if(!st.contains(pt)){const gt=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_MOUNT,ct),st.dispatchEvent(gt),gt.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(st)),{select:!0}),document.activeElement===pt&&focus(st))}return()=>{st.removeEventListener(AUTOFOCUS_ON_MOUNT,ct),setTimeout(()=>{const gt=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_UNMOUNT,lt),st.dispatchEvent(gt),gt.defaultPrevented||focus(pt??document.body,{select:!0}),st.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lt),focusScopesStack.remove(mt)},0)}}},[st,ct,lt,mt]);const ft=reactExports.useCallback(pt=>{if(!tt&&!rt||mt.paused)return;const yt=pt.key==="Tab"&&!pt.altKey&&!pt.ctrlKey&&!pt.metaKey,gt=document.activeElement;if(yt&>){const bt=pt.currentTarget,[xt,vt]=getTabbableEdges(bt);xt&&vt?!pt.shiftKey&>===vt?(pt.preventDefault(),tt&&focus(xt,{select:!0})):pt.shiftKey&>===xt&&(pt.preventDefault(),tt&&focus(vt,{select:!0})):gt===bt&&pt.preventDefault()}},[tt,rt,mt.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:ft})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(et,{select:o=!1}={}){const tt=document.activeElement;for(const rt of et)if(focus(rt,{select:o}),document.activeElement!==tt)return}function getTabbableEdges(et){const o=getTabbableCandidates(et),tt=findVisible(o,et),rt=findVisible(o.reverse(),et);return[tt,rt]}function getTabbableCandidates(et){const o=[],tt=document.createTreeWalker(et,NodeFilter.SHOW_ELEMENT,{acceptNode:rt=>{const nt=rt.tagName==="INPUT"&&rt.type==="hidden";return rt.disabled||rt.hidden||nt?NodeFilter.FILTER_SKIP:rt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)o.push(tt.currentNode);return o}function findVisible(et,o){for(const tt of et)if(!isHidden(tt,{upTo:o}))return tt}function isHidden(et,{upTo:o}){if(getComputedStyle(et).visibility==="hidden")return!0;for(;et;){if(o!==void 0&&et===o)return!1;if(getComputedStyle(et).display==="none")return!0;et=et.parentElement}return!1}function isSelectableInput(et){return et instanceof HTMLInputElement&&"select"in et}function focus(et,{select:o=!1}={}){if(et&&et.focus){const tt=document.activeElement;et.focus({preventScroll:!0}),et!==tt&&isSelectableInput(et)&&o&&et.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let et=[];return{add(o){const tt=et[0];o!==tt&&(tt==null||tt.pause()),et=arrayRemove(et,o),et.unshift(o)},remove(o){var tt;et=arrayRemove(et,o),(tt=et[0])==null||tt.resume()}}}function arrayRemove(et,o){const tt=[...et],rt=tt.indexOf(o);return rt!==-1&&tt.splice(rt,1),tt}function removeLinks(et){return et.filter(o=>o.tagName!=="A")}var PORTAL_NAME$1="Portal",Portal$1=reactExports.forwardRef((et,o)=>{var st;const{container:tt,...rt}=et,[nt,ot]=reactExports.useState(!1);useLayoutEffect2(()=>ot(!0),[]);const it=tt||nt&&((st=globalThis==null?void 0:globalThis.document)==null?void 0:st.body);return it?ReactDOM.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...rt,ref:o}),it):null});Portal$1.displayName=PORTAL_NAME$1;function useStateMachine$1(et,o){return reactExports.useReducer((tt,rt)=>o[tt][rt]??tt,et)}var Presence=et=>{const{present:o,children:tt}=et,rt=usePresence(o),nt=typeof tt=="function"?tt({present:rt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(rt.ref,getElementRef(nt));return typeof tt=="function"||rt.isPresent?reactExports.cloneElement(nt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(et){const[o,tt]=reactExports.useState(),rt=reactExports.useRef({}),nt=reactExports.useRef(et),ot=reactExports.useRef("none"),it=et?"mounted":"unmounted",[st,at]=useStateMachine$1(it,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return reactExports.useEffect(()=>{const ct=getAnimationName(rt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=rt.current,lt=nt.current;if(lt!==et){const ht=ot.current,mt=getAnimationName(ct);et?at("MOUNT"):mt==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==mt?"ANIMATION_OUT":"UNMOUNT"),nt.current=et}},[et,at]),useLayoutEffect2(()=>{if(o){let ct;const lt=o.ownerDocument.defaultView??window,dt=mt=>{const pt=getAnimationName(rt.current).includes(mt.animationName);if(mt.target===o&&pt&&(at("ANIMATION_END"),!nt.current)){const yt=o.style.animationFillMode;o.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=yt)})}},ht=mt=>{mt.target===o&&(ot.current=getAnimationName(rt.current))};return o.addEventListener("animationstart",ht),o.addEventListener("animationcancel",dt),o.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),o.removeEventListener("animationstart",ht),o.removeEventListener("animationcancel",dt),o.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[o,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(rt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(et){return(et==null?void 0:et.animationName)||"none"}function getElementRef(et){var rt,nt;let o=(rt=Object.getOwnPropertyDescriptor(et.props,"ref"))==null?void 0:rt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning;return tt?et.ref:(o=(nt=Object.getOwnPropertyDescriptor(et,"ref"))==null?void 0:nt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning,tt?et.props.ref:et.props.ref||et.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const et=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",et[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",et[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(o=>o.remove()),count--}},[])}function createFocusGuard(){const et=document.createElement("span");return et.setAttribute("data-radix-focus-guard",""),et.tabIndex=0,et.style.outline="none",et.style.opacity="0",et.style.position="fixed",et.style.pointerEvents="none",et}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(et,o){return typeof et=="function"?et(o):et&&(et.current=o),et}function useCallbackRef(et,o){var tt=reactExports.useState(function(){return{value:et,callback:o,facade:{get current(){return tt.value},set current(rt){var nt=tt.value;nt!==rt&&(tt.value=rt,tt.callback(rt,nt))}}}})[0];return tt.callback=o,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(et,o){var tt=useCallbackRef(null,function(rt){return et.forEach(function(nt){return assignRef(nt,rt)})});return useIsomorphicLayoutEffect(function(){var rt=currentValues.get(tt);if(rt){var nt=new Set(rt),ot=new Set(et),it=tt.current;nt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){nt.has(st)||assignRef(st,it)})}currentValues.set(tt,et)},[et]),tt}function ItoI(et){return et}function innerCreateMedium(et,o){o===void 0&&(o=ItoI);var tt=[],rt=!1,nt={read:function(){if(rt)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return tt.length?tt[tt.length-1]:et},useMedium:function(ot){var it=o(ot,rt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(rt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){rt=!0;var it=[];if(tt.length){var st=tt;tt=[],st.forEach(ot),it=tt}var at=function(){var lt=it;it=[],lt.forEach(ot)},ct=function(){return Promise.resolve().then(at)};ct(),tt={push:function(lt){it.push(lt),ct()},filter:function(lt){return it=it.filter(lt),tt}}}};return nt}function createSidecarMedium(et){et===void 0&&(et={});var o=innerCreateMedium(null);return o.options=__assign({async:!0,ssr:!1},et),o}var SideCar$1=function(et){var o=et.sideCar,tt=__rest(et,["sideCar"]);if(!o)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var rt=o.read();if(!rt)throw new Error("Sidecar medium not found");return reactExports.createElement(rt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(et,o){return et.useMedium(o),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(et,o){var tt=reactExports.useRef(null),rt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),nt=rt[0],ot=rt[1],it=et.forwardProps,st=et.children,at=et.className,ct=et.removeScrollBar,lt=et.enabled,dt=et.shards,ht=et.sideCar,mt=et.noIsolation,ft=et.inert,pt=et.allowPinchZoom,yt=et.as,gt=yt===void 0?"div":yt,bt=et.gapMode,xt=__rest(et,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),vt=ht,Et=useMergeRefs([tt,o]),Ct=__assign(__assign({},xt),nt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(vt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:mt,inert:ft,setCallbacks:ot,allowPinchZoom:!!pt,lockRef:tt,gapMode:bt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},Ct),{ref:Et})):reactExports.createElement(gt,__assign({},Ct,{className:at,ref:Et}),st))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var et=document.createElement("style");et.type="text/css";var o=getNonce();return o&&et.setAttribute("nonce",o),et}function injectStyles(et,o){et.styleSheet?et.styleSheet.cssText=o:et.appendChild(document.createTextNode(o))}function insertStyleTag(et){var o=document.head||document.getElementsByTagName("head")[0];o.appendChild(et)}var stylesheetSingleton=function(){var et=0,o=null;return{add:function(tt){et==0&&(o=makeStyleTag())&&(injectStyles(o,tt),insertStyleTag(o)),et++},remove:function(){et--,!et&&o&&(o.parentNode&&o.parentNode.removeChild(o),o=null)}}},styleHookSingleton=function(){var et=stylesheetSingleton();return function(o,tt){reactExports.useEffect(function(){return et.add(o),function(){et.remove()}},[o&&tt])}},styleSingleton=function(){var et=styleHookSingleton(),o=function(tt){var rt=tt.styles,nt=tt.dynamic;return et(rt,nt),null};return o},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(et){return parseInt(et||"",10)||0},getOffset=function(et){var o=window.getComputedStyle(document.body),tt=o[et==="padding"?"paddingLeft":"marginLeft"],rt=o[et==="padding"?"paddingTop":"marginTop"],nt=o[et==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(rt),parse$2(nt)]},getGapWidth=function(et){if(et===void 0&&(et="margin"),typeof window>"u")return zeroGap;var o=getOffset(et),tt=document.documentElement.clientWidth,rt=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,rt-tt+o[2]-o[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(et,o,tt,rt){var nt=et.left,ot=et.top,it=et.right,st=et.gap;return tt===void 0&&(tt="margin"),` + */const LoaderCircle=createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Header=({wakuStatus:et})=>{const{address:o,isConnected:tt}=useAccount(),{disconnect:rt}=useDisconnect(),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:o});reactExports.useEffect(()=>{if(it){const ht=()=>{at(it.libp2p.getConnections().length)};return ht(),it.libp2p.addEventListener("peer:connect",ht),it.libp2p.addEventListener("peer:disconnect",ht),()=>{it.libp2p.removeEventListener("peer:connect",ht),it.libp2p.removeEventListener("peer:disconnect",ht)}}},[it]);const dt=ht=>{switch(ht){case"success":return"bg-green-500";case"in-progress":return"bg-yellow-500";case"error":return"bg-red-500"}};return jsxRuntimeExports.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:jsxRuntimeExports.jsx("div",{className:"container",children:jsxRuntimeExports.jsx("div",{className:"h-14",children:jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between gap-4",children:[jsxRuntimeExports.jsxs("nav",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx(Link,{to:"",className:`text-sm font-medium ${ct.pathname===""?"text-foreground":"text-muted-foreground"}`,children:"Home"}),jsxRuntimeExports.jsx(Link,{to:"create",className:`text-sm font-medium ${ct.pathname==="/create"?"text-foreground":"text-muted-foreground"}`,children:"Create"}),jsxRuntimeExports.jsx(Link,{to:"view",className:`text-sm font-medium ${ct.pathname==="/view"?"text-foreground":"text-muted-foreground"}`,children:"View"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx("div",{className:"hidden md:flex items-center gap-2",children:!nt&&!ot&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Filter:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(et.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Store:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(et.store)}`})]})]})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[nt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("span",{className:"text-xs text-red-500",children:"Error"}):jsxRuntimeExports.jsx("div",{className:`w-2 h-2 rounded-full ${st>0?"bg-green-500":"bg-yellow-500"}`}),tt?jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-muted-foreground truncate max-w-[80px] md:max-w-[120px]",children:lt||(o?`${o.slice(0,4)}...${o.slice(-4)}`:"")}),jsxRuntimeExports.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>rt(),children:[jsxRuntimeExports.jsx("span",{className:"md:hidden",children:"×"}),jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:"Logout"})]})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})]})]})]})})})})},Input=reactExports.forwardRef(({className:et,type:o,...tt},rt)=>jsxRuntimeExports.jsx("input",{type:o,className:cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base md:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation min-h-[44px] md:min-h-[36px]",et),ref:rt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("textarea",{className:cn("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base md:text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation resize-y",et),ref:tt,...o}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((et,o)=>{const tt=reactExports.forwardRef((rt,nt)=>{const{asChild:ot,...it}=rt,st=ot?Slot:o;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:nt})});return tt.displayName=`Primitive.${o}`,{...et,[o]:tt}},{});function dispatchDiscreteCustomEvent(et,o){et&&reactDomExports.flushSync(()=>et.dispatchEvent(o))}var NAME="Label",Label$1=reactExports.forwardRef((et,o)=>jsxRuntimeExports.jsx(Primitive.label,{...et,ref:o,onMouseDown:tt=>{var nt;tt.target.closest("button, input, select, textarea")||((nt=et.onMouseDown)==null||nt.call(et,tt),!tt.defaultPrevented&&tt.detail>1&&tt.preventDefault())}}));Label$1.displayName=NAME;var Root$3=Label$1;const labelVariants=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Label=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),et),...o}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("rounded-lg border bg-card text-card-foreground shadow-sm p-4 md:p-6 w-full max-w-[95vw] mx-auto",et),...o}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",et),...o}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",et),...o}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",et),...o}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",et),...o}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",et),...o}));CardFooter.displayName="CardFooter";function composeEventHandlers(et,o,{checkForDefaultPrevented:tt=!0}={}){return function(nt){if(et==null||et(nt),tt===!1||!nt.defaultPrevented)return o==null?void 0:o(nt)}}function createContext2(et,o){const tt=reactExports.createContext(o),rt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};rt.displayName=et+"Provider";function nt(ot){const it=reactExports.useContext(tt);if(it)return it;if(o!==void 0)return o;throw new Error(`\`${ot}\` must be used within \`${et}\``)}return[rt,nt]}function createContextScope(et,o=[]){let tt=[];function rt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:mt,...ft}=dt,pt=((gt=ht==null?void 0:ht[et])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>ft,Object.values(ft));return jsxRuntimeExports.jsx(pt.Provider,{value:yt,children:mt})};ct.displayName=ot+"Provider";function lt(dt,ht){var pt;const mt=((pt=ht==null?void 0:ht[et])==null?void 0:pt[at])||st,ft=reactExports.useContext(mt);if(ft)return ft;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const nt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[et])||ot;return reactExports.useMemo(()=>({[`__scope${et}`]:{...st,[et]:at}}),[st,at])}};return nt.scopeName=et,[rt,composeContextScopes(nt,...o)]}function composeContextScopes(...et){const o=et[0];if(et.length===1)return o;const tt=()=>{const rt=et.map(nt=>({useScope:nt(),scopeName:nt.scopeName}));return function(ot){const it=rt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${o.scopeName}`]:it}),[it])}};return tt.scopeName=o.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(et){const[o,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{et||tt(rt=>rt??String(count$1++))},[et]),et||(o?`radix-${o}`:"")}function useCallbackRef$1(et){const o=reactExports.useRef(et);return reactExports.useEffect(()=>{o.current=et}),reactExports.useMemo(()=>(...tt)=>{var rt;return(rt=o.current)==null?void 0:rt.call(o,...tt)},[])}function useControllableState({prop:et,defaultProp:o,onChange:tt=()=>{}}){const[rt,nt]=useUncontrolledState({defaultProp:o,onChange:tt}),ot=et!==void 0,it=ot?et:rt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(et):ct;dt!==et&&st(dt)}else nt(ct)},[ot,et,nt,st]);return[it,at]}function useUncontrolledState({defaultProp:et,onChange:o}){const tt=reactExports.useState(et),[rt]=tt,nt=reactExports.useRef(rt),ot=useCallbackRef$1(o);return reactExports.useEffect(()=>{nt.current!==rt&&(ot(rt),nt.current=rt)},[rt,nt,ot]),tt}function useEscapeKeydown(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et);reactExports.useEffect(()=>{const rt=nt=>{nt.key==="Escape"&&tt(nt)};return o.addEventListener("keydown",rt,{capture:!0}),()=>o.removeEventListener("keydown",rt,{capture:!0})},[tt,o])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=reactExports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=reactExports.forwardRef((et,o)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:rt,onPointerDownOutside:nt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=et,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,mt]=reactExports.useState({}),ft=useComposedRefs(o,St=>dt(St)),pt=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=pt.indexOf(yt),bt=lt?pt.indexOf(lt):-1,xt=ct.layersWithOutsidePointerEventsDisabled.size>0,vt=bt>=gt,Et=usePointerDownOutside(St=>{const At=St.target,kt=[...ct.branches].some(It=>It.contains(At));!vt||kt||(nt==null||nt(St),it==null||it(St),St.defaultPrevented||st==null||st())},ht),Ct=useFocusOutside(St=>{const At=St.target;[...ct.branches].some(It=>It.contains(At))||(ot==null||ot(St),it==null||it(St),St.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(St=>{bt===ct.layers.size-1&&(rt==null||rt(St),!St.defaultPrevented&&st&&(St.preventDefault(),st()))},ht),reactExports.useEffect(()=>{if(lt)return tt&&(ct.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=ht.body.style.pointerEvents,ht.body.style.pointerEvents="none"),ct.layersWithOutsidePointerEventsDisabled.add(lt)),ct.layers.add(lt),dispatchUpdate(),()=>{tt&&ct.layersWithOutsidePointerEventsDisabled.size===1&&(ht.body.style.pointerEvents=originalBodyPointerEvents)}},[lt,ht,tt,ct]),reactExports.useEffect(()=>()=>{lt&&(ct.layers.delete(lt),ct.layersWithOutsidePointerEventsDisabled.delete(lt),dispatchUpdate())},[lt,ct]),reactExports.useEffect(()=>{const St=()=>mt({});return document.addEventListener(CONTEXT_UPDATE,St),()=>document.removeEventListener(CONTEXT_UPDATE,St)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:ft,style:{pointerEvents:xt?vt?"auto":"none":void 0,...et.style},onFocusCapture:composeEventHandlers(et.onFocusCapture,Ct.onFocusCapture),onBlurCapture:composeEventHandlers(et.onBlurCapture,Ct.onBlurCapture),onPointerDownCapture:composeEventHandlers(et.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((et,o)=>{const tt=reactExports.useContext(DismissableLayerContext),rt=reactExports.useRef(null),nt=useComposedRefs(o,rt);return reactExports.useEffect(()=>{const ot=rt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...et,ref:nt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et),rt=reactExports.useRef(!1),nt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!rt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(o.removeEventListener("click",nt.current),nt.current=at,o.addEventListener("click",nt.current,{once:!0})):at()}else o.removeEventListener("click",nt.current);rt.current=!1},it=window.setTimeout(()=>{o.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),o.removeEventListener("pointerdown",ot),o.removeEventListener("click",nt.current)}},[o,tt]),{onPointerDownCapture:()=>rt.current=!0}}function useFocusOutside(et,o=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(et),rt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const nt=ot=>{ot.target&&!rt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return o.addEventListener("focusin",nt),()=>o.removeEventListener("focusin",nt)},[o,tt]),{onFocusCapture:()=>rt.current=!0,onBlurCapture:()=>rt.current=!1}}function dispatchUpdate(){const et=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(et)}function handleAndDispatchCustomEvent(et,o,tt,{discrete:rt}){const nt=tt.originalEvent.target,ot=new CustomEvent(et,{bubbles:!1,cancelable:!0,detail:tt});o&&nt.addEventListener(et,o,{once:!0}),rt?dispatchDiscreteCustomEvent(nt,ot):nt.dispatchEvent(ot)}var AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=reactExports.forwardRef((et,o)=>{const{loop:tt=!1,trapped:rt=!1,onMountAutoFocus:nt,onUnmountAutoFocus:ot,...it}=et,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(nt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(o,pt=>at(pt)),mt=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(rt){let pt=function(xt){if(mt.paused||!st)return;const vt=xt.target;st.contains(vt)?dt.current=vt:focus(dt.current,{select:!0})},yt=function(xt){if(mt.paused||!st)return;const vt=xt.relatedTarget;vt!==null&&(st.contains(vt)||focus(dt.current,{select:!0}))},gt=function(xt){if(document.activeElement===document.body)for(const Et of xt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",pt),document.addEventListener("focusout",yt);const bt=new MutationObserver(gt);return st&&bt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",pt),document.removeEventListener("focusout",yt),bt.disconnect()}}},[rt,st,mt.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(mt);const pt=document.activeElement;if(!st.contains(pt)){const gt=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_MOUNT,ct),st.dispatchEvent(gt),gt.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(st)),{select:!0}),document.activeElement===pt&&focus(st))}return()=>{st.removeEventListener(AUTOFOCUS_ON_MOUNT,ct),setTimeout(()=>{const gt=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_UNMOUNT,lt),st.dispatchEvent(gt),gt.defaultPrevented||focus(pt??document.body,{select:!0}),st.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lt),focusScopesStack.remove(mt)},0)}}},[st,ct,lt,mt]);const ft=reactExports.useCallback(pt=>{if(!tt&&!rt||mt.paused)return;const yt=pt.key==="Tab"&&!pt.altKey&&!pt.ctrlKey&&!pt.metaKey,gt=document.activeElement;if(yt&>){const bt=pt.currentTarget,[xt,vt]=getTabbableEdges(bt);xt&&vt?!pt.shiftKey&>===vt?(pt.preventDefault(),tt&&focus(xt,{select:!0})):pt.shiftKey&>===xt&&(pt.preventDefault(),tt&&focus(vt,{select:!0})):gt===bt&&pt.preventDefault()}},[tt,rt,mt.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:ft})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(et,{select:o=!1}={}){const tt=document.activeElement;for(const rt of et)if(focus(rt,{select:o}),document.activeElement!==tt)return}function getTabbableEdges(et){const o=getTabbableCandidates(et),tt=findVisible(o,et),rt=findVisible(o.reverse(),et);return[tt,rt]}function getTabbableCandidates(et){const o=[],tt=document.createTreeWalker(et,NodeFilter.SHOW_ELEMENT,{acceptNode:rt=>{const nt=rt.tagName==="INPUT"&&rt.type==="hidden";return rt.disabled||rt.hidden||nt?NodeFilter.FILTER_SKIP:rt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)o.push(tt.currentNode);return o}function findVisible(et,o){for(const tt of et)if(!isHidden(tt,{upTo:o}))return tt}function isHidden(et,{upTo:o}){if(getComputedStyle(et).visibility==="hidden")return!0;for(;et;){if(o!==void 0&&et===o)return!1;if(getComputedStyle(et).display==="none")return!0;et=et.parentElement}return!1}function isSelectableInput(et){return et instanceof HTMLInputElement&&"select"in et}function focus(et,{select:o=!1}={}){if(et&&et.focus){const tt=document.activeElement;et.focus({preventScroll:!0}),et!==tt&&isSelectableInput(et)&&o&&et.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let et=[];return{add(o){const tt=et[0];o!==tt&&(tt==null||tt.pause()),et=arrayRemove(et,o),et.unshift(o)},remove(o){var tt;et=arrayRemove(et,o),(tt=et[0])==null||tt.resume()}}}function arrayRemove(et,o){const tt=[...et],rt=tt.indexOf(o);return rt!==-1&&tt.splice(rt,1),tt}function removeLinks(et){return et.filter(o=>o.tagName!=="A")}function useStateMachine$1(et,o){return reactExports.useReducer((tt,rt)=>o[tt][rt]??tt,et)}var Presence=et=>{const{present:o,children:tt}=et,rt=usePresence(o),nt=typeof tt=="function"?tt({present:rt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(rt.ref,getElementRef(nt));return typeof tt=="function"||rt.isPresent?reactExports.cloneElement(nt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(et){const[o,tt]=reactExports.useState(),rt=reactExports.useRef({}),nt=reactExports.useRef(et),ot=reactExports.useRef("none"),it=et?"mounted":"unmounted",[st,at]=useStateMachine$1(it,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return reactExports.useEffect(()=>{const ct=getAnimationName(rt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=rt.current,lt=nt.current;if(lt!==et){const ht=ot.current,mt=getAnimationName(ct);et?at("MOUNT"):mt==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==mt?"ANIMATION_OUT":"UNMOUNT"),nt.current=et}},[et,at]),useLayoutEffect2(()=>{if(o){let ct;const lt=o.ownerDocument.defaultView??window,dt=mt=>{const pt=getAnimationName(rt.current).includes(mt.animationName);if(mt.target===o&&pt&&(at("ANIMATION_END"),!nt.current)){const yt=o.style.animationFillMode;o.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{o.style.animationFillMode==="forwards"&&(o.style.animationFillMode=yt)})}},ht=mt=>{mt.target===o&&(ot.current=getAnimationName(rt.current))};return o.addEventListener("animationstart",ht),o.addEventListener("animationcancel",dt),o.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),o.removeEventListener("animationstart",ht),o.removeEventListener("animationcancel",dt),o.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[o,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(rt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(et){return(et==null?void 0:et.animationName)||"none"}function getElementRef(et){var rt,nt;let o=(rt=Object.getOwnPropertyDescriptor(et.props,"ref"))==null?void 0:rt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning;return tt?et.ref:(o=(nt=Object.getOwnPropertyDescriptor(et,"ref"))==null?void 0:nt.get,tt=o&&"isReactWarning"in o&&o.isReactWarning,tt?et.props.ref:et.props.ref||et.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const et=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",et[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",et[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(o=>o.remove()),count--}},[])}function createFocusGuard(){const et=document.createElement("span");return et.setAttribute("data-radix-focus-guard",""),et.tabIndex=0,et.style.outline="none",et.style.opacity="0",et.style.position="fixed",et.style.pointerEvents="none",et}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(et,o){return typeof et=="function"?et(o):et&&(et.current=o),et}function useCallbackRef(et,o){var tt=reactExports.useState(function(){return{value:et,callback:o,facade:{get current(){return tt.value},set current(rt){var nt=tt.value;nt!==rt&&(tt.value=rt,tt.callback(rt,nt))}}}})[0];return tt.callback=o,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(et,o){var tt=useCallbackRef(null,function(rt){return et.forEach(function(nt){return assignRef(nt,rt)})});return useIsomorphicLayoutEffect(function(){var rt=currentValues.get(tt);if(rt){var nt=new Set(rt),ot=new Set(et),it=tt.current;nt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){nt.has(st)||assignRef(st,it)})}currentValues.set(tt,et)},[et]),tt}function ItoI(et){return et}function innerCreateMedium(et,o){o===void 0&&(o=ItoI);var tt=[],rt=!1,nt={read:function(){if(rt)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return tt.length?tt[tt.length-1]:et},useMedium:function(ot){var it=o(ot,rt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(rt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){rt=!0;var it=[];if(tt.length){var st=tt;tt=[],st.forEach(ot),it=tt}var at=function(){var lt=it;it=[],lt.forEach(ot)},ct=function(){return Promise.resolve().then(at)};ct(),tt={push:function(lt){it.push(lt),ct()},filter:function(lt){return it=it.filter(lt),tt}}}};return nt}function createSidecarMedium(et){et===void 0&&(et={});var o=innerCreateMedium(null);return o.options=__assign({async:!0,ssr:!1},et),o}var SideCar$1=function(et){var o=et.sideCar,tt=__rest(et,["sideCar"]);if(!o)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var rt=o.read();if(!rt)throw new Error("Sidecar medium not found");return reactExports.createElement(rt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(et,o){return et.useMedium(o),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(et,o){var tt=reactExports.useRef(null),rt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),nt=rt[0],ot=rt[1],it=et.forwardProps,st=et.children,at=et.className,ct=et.removeScrollBar,lt=et.enabled,dt=et.shards,ht=et.sideCar,mt=et.noIsolation,ft=et.inert,pt=et.allowPinchZoom,yt=et.as,gt=yt===void 0?"div":yt,bt=et.gapMode,xt=__rest(et,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),vt=ht,Et=useMergeRefs([tt,o]),Ct=__assign(__assign({},xt),nt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(vt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:mt,inert:ft,setCallbacks:ot,allowPinchZoom:!!pt,lockRef:tt,gapMode:bt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},Ct),{ref:Et})):reactExports.createElement(gt,__assign({},Ct,{className:at,ref:Et}),st))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var et=document.createElement("style");et.type="text/css";var o=getNonce();return o&&et.setAttribute("nonce",o),et}function injectStyles(et,o){et.styleSheet?et.styleSheet.cssText=o:et.appendChild(document.createTextNode(o))}function insertStyleTag(et){var o=document.head||document.getElementsByTagName("head")[0];o.appendChild(et)}var stylesheetSingleton=function(){var et=0,o=null;return{add:function(tt){et==0&&(o=makeStyleTag())&&(injectStyles(o,tt),insertStyleTag(o)),et++},remove:function(){et--,!et&&o&&(o.parentNode&&o.parentNode.removeChild(o),o=null)}}},styleHookSingleton=function(){var et=stylesheetSingleton();return function(o,tt){reactExports.useEffect(function(){return et.add(o),function(){et.remove()}},[o&&tt])}},styleSingleton=function(){var et=styleHookSingleton(),o=function(tt){var rt=tt.styles,nt=tt.dynamic;return et(rt,nt),null};return o},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(et){return parseInt(et||"",10)||0},getOffset=function(et){var o=window.getComputedStyle(document.body),tt=o[et==="padding"?"paddingLeft":"marginLeft"],rt=o[et==="padding"?"paddingTop":"marginTop"],nt=o[et==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(rt),parse$2(nt)]},getGapWidth=function(et){if(et===void 0&&(et="margin"),typeof window>"u")return zeroGap;var o=getOffset(et),tt=document.documentElement.clientWidth,rt=window.innerWidth;return{left:o[0],top:o[1],right:o[2],gap:Math.max(0,rt-tt+o[2]-o[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(et,o,tt,rt){var nt=et.left,ot=et.top,it=et.right,st=et.gap;return tt===void 0&&(tt="margin"),` .`.concat(noScrollbarsClassName,` { overflow: hidden `).concat(rt,`; padding-right: `).concat(st,"px ").concat(rt,`; @@ -4122,11 +4122,11 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 `)},getCurrentUseCounter=function(){var et=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(et)?et:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var et=getCurrentUseCounter()-1;et<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,et.toString())}},[])},RemoveScrollBar=function(et){var o=et.noRelative,tt=et.noImportant,rt=et.gapMode,nt=rt===void 0?"margin":rt;useLockAttribute();var ot=reactExports.useMemo(function(){return getGapWidth(nt)},[nt]);return reactExports.createElement(Style,{styles:getStyles(ot,!o,nt,tt?"":"!important")})},passiveSupported=!1;if(typeof window<"u")try{var options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch{passiveSupported=!1}var nonPassive=passiveSupported?{passive:!1}:!1,alwaysContainsScroll=function(et){return et.tagName==="TEXTAREA"},elementCanBeScrolled=function(et,o){if(!(et instanceof Element))return!1;var tt=window.getComputedStyle(et);return tt[o]!=="hidden"&&!(tt.overflowY===tt.overflowX&&!alwaysContainsScroll(et)&&tt[o]==="visible")},elementCouldBeVScrolled=function(et){return elementCanBeScrolled(et,"overflowY")},elementCouldBeHScrolled=function(et){return elementCanBeScrolled(et,"overflowX")},locationCouldBeScrolled=function(et,o){var tt=o.ownerDocument,rt=o;do{typeof ShadowRoot<"u"&&rt instanceof ShadowRoot&&(rt=rt.host);var nt=elementCouldBeScrolled(et,rt);if(nt){var ot=getScrollVariables(et,rt),it=ot[1],st=ot[2];if(it>st)return!0}rt=rt.parentNode}while(rt&&rt!==tt.body);return!1},getVScrollVariables=function(et){var o=et.scrollTop,tt=et.scrollHeight,rt=et.clientHeight;return[o,tt,rt]},getHScrollVariables=function(et){var o=et.scrollLeft,tt=et.scrollWidth,rt=et.clientWidth;return[o,tt,rt]},elementCouldBeScrolled=function(et,o){return et==="v"?elementCouldBeVScrolled(o):elementCouldBeHScrolled(o)},getScrollVariables=function(et,o){return et==="v"?getVScrollVariables(o):getHScrollVariables(o)},getDirectionFactor=function(et,o){return et==="h"&&o==="rtl"?-1:1},handleScroll=function(et,o,tt,rt,nt){var ot=getDirectionFactor(et,window.getComputedStyle(o).direction),it=ot*rt,st=tt.target,at=o.contains(st),ct=!1,lt=it>0,dt=0,ht=0;do{var mt=getScrollVariables(et,st),ft=mt[0],pt=mt[1],yt=mt[2],gt=pt-yt-ot*ft;(ft||gt)&&elementCouldBeScrolled(et,st)&&(dt+=gt,ht+=ft),st instanceof ShadowRoot?st=st.host:st=st.parentNode}while(!at&&st!==document.body||at&&(o.contains(st)||o===st));return(lt&&(Math.abs(dt)<1||!nt)||!lt&&(Math.abs(ht)<1||!nt))&&(ct=!0),ct},getTouchXY=function(et){return"changedTouches"in et?[et.changedTouches[0].clientX,et.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(et){return[et.deltaX,et.deltaY]},extractRef=function(et){return et&&"current"in et?et.current:et},deltaCompare=function(et,o){return et[0]===o[0]&&et[1]===o[1]},generateStyle=function(et){return` .block-interactivity-`.concat(et,` {pointer-events: none;} .allow-interactivity-`).concat(et,` {pointer-events: all;} -`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(et){var o=reactExports.useRef([]),tt=reactExports.useRef([0,0]),rt=reactExports.useRef(),nt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(et);reactExports.useEffect(function(){it.current=et},[et]),reactExports.useEffect(function(){if(et.inert){document.body.classList.add("block-interactivity-".concat(nt));var pt=__spreadArray([et.lockRef.current],(et.shards||[]).map(extractRef),!0).filter(Boolean);return pt.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(nt))}),function(){document.body.classList.remove("block-interactivity-".concat(nt)),pt.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(nt))})}}},[et.inert,et.lockRef.current,et.shards]);var st=reactExports.useCallback(function(pt,yt){if("touches"in pt&&pt.touches.length===2||pt.type==="wheel"&&pt.ctrlKey)return!it.current.allowPinchZoom;var gt=getTouchXY(pt),bt=tt.current,xt="deltaX"in pt?pt.deltaX:bt[0]-gt[0],vt="deltaY"in pt?pt.deltaY:bt[1]-gt[1],Et,Ct=pt.target,St=Math.abs(xt)>Math.abs(vt)?"h":"v";if("touches"in pt&&St==="h"&&Ct.type==="range")return!1;var At=locationCouldBeScrolled(St,Ct);if(!At)return!0;if(At?Et=St:(Et=St==="v"?"h":"v",At=locationCouldBeScrolled(St,Ct)),!At)return!1;if(!rt.current&&"changedTouches"in pt&&(xt||vt)&&(rt.current=Et),!Et)return!0;var kt=rt.current||Et;return handleScroll(kt,yt,pt,kt==="h"?xt:vt,!0)},[]),at=reactExports.useCallback(function(pt){var yt=pt;if(!(!lockStack.length||lockStack[lockStack.length-1]!==ot)){var gt="deltaY"in yt?getDeltaXY(yt):getTouchXY(yt),bt=o.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(bt&&bt.should){yt.cancelable&&yt.preventDefault();return}if(!bt){var xt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),vt=xt.length>0?st(yt,xt[0]):!it.current.noIsolation;vt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(pt,yt,gt,bt){var xt={name:pt,delta:yt,target:gt,should:bt,shadowParent:getOutermostShadowParent(gt)};o.current.push(xt),setTimeout(function(){o.current=o.current.filter(function(vt){return vt!==xt})},1)},[]),lt=reactExports.useCallback(function(pt){tt.current=getTouchXY(pt),rt.current=void 0},[]),dt=reactExports.useCallback(function(pt){ct(pt.type,getDeltaXY(pt),pt.target,st(pt,et.lockRef.current))},[]),ht=reactExports.useCallback(function(pt){ct(pt.type,getTouchXY(pt),pt.target,st(pt,et.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),et.setCallbacks({onScrollCapture:dt,onWheelCapture:dt,onTouchMoveCapture:ht}),document.addEventListener("wheel",at,nonPassive),document.addEventListener("touchmove",at,nonPassive),document.addEventListener("touchstart",lt,nonPassive),function(){lockStack=lockStack.filter(function(pt){return pt!==ot}),document.removeEventListener("wheel",at,nonPassive),document.removeEventListener("touchmove",at,nonPassive),document.removeEventListener("touchstart",lt,nonPassive)}},[]);var mt=et.removeScrollBar,ft=et.inert;return reactExports.createElement(reactExports.Fragment,null,ft?reactExports.createElement(ot,{styles:generateStyle(nt)}):null,mt?reactExports.createElement(RemoveScrollBar,{gapMode:et.gapMode}):null)}function getOutermostShadowParent(et){for(var o=null;et!==null;)et instanceof ShadowRoot&&(o=et.host,et=et.host),et=et.parentNode;return o}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(et,o){return reactExports.createElement(RemoveScroll,__assign({},et,{ref:o,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(et){if(typeof document>"u")return null;var o=Array.isArray(et)?et[0]:et;return o.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(et){return et&&(et.host||unwrapHost(et.parentNode))},correctTargets=function(et,o){return o.map(function(tt){if(et.contains(tt))return tt;var rt=unwrapHost(tt);return rt&&et.contains(rt)?rt:(console.error("aria-hidden",tt,"in not contained inside",et,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(et,o,tt,rt){var nt=correctTargets(o,Array.isArray(et)?et:[et]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(nt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};nt.forEach(ct);var lt=function(dt){!dt||at.has(dt)||Array.prototype.forEach.call(dt.children,function(ht){if(st.has(ht))lt(ht);else try{var mt=ht.getAttribute(rt),ft=mt!==null&&mt!=="false",pt=(counterMap.get(ht)||0)+1,yt=(ot.get(ht)||0)+1;counterMap.set(ht,pt),ot.set(ht,yt),it.push(ht),pt===1&&ft&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),ft||ht.setAttribute(rt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(o),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,mt=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,mt),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(rt),uncontrolledNodes.delete(dt)),mt||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(et,o,tt){tt===void 0&&(tt="data-aria-hidden");var rt=Array.from(Array.isArray(et)?et:[et]),nt=getDefaultParent(et);return nt?(rt.push.apply(rt,Array.from(nt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(rt,nt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=et=>{const{__scopeDialog:o,children:tt,open:rt,defaultOpen:nt,onOpenChange:ot,modal:it=!0}=et,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:rt,defaultProp:nt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:o,triggerRef:st,contentRef:at,contentId:useId(),titleId:useId(),descriptionId:useId(),open:ct,onOpenChange:lt,onOpenToggle:reactExports.useCallback(()=>lt(dt=>!dt),[lt]),modal:it,children:tt})};Dialog$1.displayName=DIALOG_NAME;var TRIGGER_NAME="DialogTrigger",DialogTrigger$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(o,nt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":nt.open,"aria-controls":nt.contentId,"data-state":getState(nt.open),...rt,ref:ot,onClick:composeEventHandlers(et.onClick,nt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),DialogPortal$1=et=>{const{__scopeDialog:o,forceMount:tt,children:rt,container:nt}=et,ot=useDialogContext(PORTAL_NAME,o);return jsxRuntimeExports.jsx(PortalProvider,{scope:o,forceMount:tt,children:reactExports.Children.map(rt,it=>jsxRuntimeExports.jsx(Presence,{present:tt||ot.open,children:jsxRuntimeExports.jsx(Portal$1,{asChild:!0,container:nt,children:it})}))})};DialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((et,o)=>{const tt=usePortalContext(OVERLAY_NAME,et.__scopeDialog),{forceMount:rt=tt.forceMount,...nt}=et,ot=useDialogContext(OVERLAY_NAME,et.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:rt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...nt,ref:o})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[nt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(nt.open),...rt,ref:o,style:{pointerEvents:"auto",...rt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((et,o)=>{const tt=usePortalContext(CONTENT_NAME,et.__scopeDialog),{forceMount:rt=tt.forceMount,...nt}=et,ot=useDialogContext(CONTENT_NAME,et.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:rt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...nt,ref:o}):jsxRuntimeExports.jsx(DialogContentNonModal,{...nt,ref:o})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((et,o)=>{const tt=useDialogContext(CONTENT_NAME,et.__scopeDialog),rt=reactExports.useRef(null),nt=useComposedRefs(o,tt.contentRef,rt);return reactExports.useEffect(()=>{const ot=rt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...et,ref:nt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(et.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(et.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(et.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((et,o)=>{const tt=useDialogContext(CONTENT_NAME,et.__scopeDialog),rt=reactExports.useRef(!1),nt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...et,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=et.onCloseAutoFocus)==null||it.call(et,ot),ot.defaultPrevented||(rt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),rt.current=!1,nt.current=!1},onInteractOutside:ot=>{var at,ct;(at=et.onInteractOutside)==null||at.call(et,ot),ot.defaultPrevented||(rt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(nt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&nt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,trapFocus:rt,onOpenAutoFocus:nt,onCloseAutoFocus:ot,...it}=et,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(o,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:rt,onMountAutoFocus:nt,onUnmountAutoFocus:ot,children:jsxRuntimeExports.jsx(DismissableLayer,{role:"dialog",id:st.contentId,"aria-describedby":st.descriptionId,"aria-labelledby":st.titleId,"data-state":getState(st.open),...it,ref:ct,onDismiss:()=>st.onOpenChange(!1)})}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TitleWarning,{titleId:st.titleId}),jsxRuntimeExports.jsx(DescriptionWarning,{contentRef:at,descriptionId:st.descriptionId})]})]})}),TITLE_NAME="DialogTitle",DialogTitle$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:nt.titleId,...rt,ref:o})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:nt.descriptionId,...rt,ref:o})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...rt,ref:o,onClick:composeEventHandlers(et.onClick,()=>nt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(et){return et?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:et})=>{const o=useWarningContext(TITLE_WARNING_NAME),tt=`\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users. +`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(et){var o=reactExports.useRef([]),tt=reactExports.useRef([0,0]),rt=reactExports.useRef(),nt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(et);reactExports.useEffect(function(){it.current=et},[et]),reactExports.useEffect(function(){if(et.inert){document.body.classList.add("block-interactivity-".concat(nt));var pt=__spreadArray([et.lockRef.current],(et.shards||[]).map(extractRef),!0).filter(Boolean);return pt.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(nt))}),function(){document.body.classList.remove("block-interactivity-".concat(nt)),pt.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(nt))})}}},[et.inert,et.lockRef.current,et.shards]);var st=reactExports.useCallback(function(pt,yt){if("touches"in pt&&pt.touches.length===2||pt.type==="wheel"&&pt.ctrlKey)return!it.current.allowPinchZoom;var gt=getTouchXY(pt),bt=tt.current,xt="deltaX"in pt?pt.deltaX:bt[0]-gt[0],vt="deltaY"in pt?pt.deltaY:bt[1]-gt[1],Et,Ct=pt.target,St=Math.abs(xt)>Math.abs(vt)?"h":"v";if("touches"in pt&&St==="h"&&Ct.type==="range")return!1;var At=locationCouldBeScrolled(St,Ct);if(!At)return!0;if(At?Et=St:(Et=St==="v"?"h":"v",At=locationCouldBeScrolled(St,Ct)),!At)return!1;if(!rt.current&&"changedTouches"in pt&&(xt||vt)&&(rt.current=Et),!Et)return!0;var kt=rt.current||Et;return handleScroll(kt,yt,pt,kt==="h"?xt:vt,!0)},[]),at=reactExports.useCallback(function(pt){var yt=pt;if(!(!lockStack.length||lockStack[lockStack.length-1]!==ot)){var gt="deltaY"in yt?getDeltaXY(yt):getTouchXY(yt),bt=o.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(bt&&bt.should){yt.cancelable&&yt.preventDefault();return}if(!bt){var xt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),vt=xt.length>0?st(yt,xt[0]):!it.current.noIsolation;vt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(pt,yt,gt,bt){var xt={name:pt,delta:yt,target:gt,should:bt,shadowParent:getOutermostShadowParent(gt)};o.current.push(xt),setTimeout(function(){o.current=o.current.filter(function(vt){return vt!==xt})},1)},[]),lt=reactExports.useCallback(function(pt){tt.current=getTouchXY(pt),rt.current=void 0},[]),dt=reactExports.useCallback(function(pt){ct(pt.type,getDeltaXY(pt),pt.target,st(pt,et.lockRef.current))},[]),ht=reactExports.useCallback(function(pt){ct(pt.type,getTouchXY(pt),pt.target,st(pt,et.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),et.setCallbacks({onScrollCapture:dt,onWheelCapture:dt,onTouchMoveCapture:ht}),document.addEventListener("wheel",at,nonPassive),document.addEventListener("touchmove",at,nonPassive),document.addEventListener("touchstart",lt,nonPassive),function(){lockStack=lockStack.filter(function(pt){return pt!==ot}),document.removeEventListener("wheel",at,nonPassive),document.removeEventListener("touchmove",at,nonPassive),document.removeEventListener("touchstart",lt,nonPassive)}},[]);var mt=et.removeScrollBar,ft=et.inert;return reactExports.createElement(reactExports.Fragment,null,ft?reactExports.createElement(ot,{styles:generateStyle(nt)}):null,mt?reactExports.createElement(RemoveScrollBar,{gapMode:et.gapMode}):null)}function getOutermostShadowParent(et){for(var o=null;et!==null;)et instanceof ShadowRoot&&(o=et.host,et=et.host),et=et.parentNode;return o}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(et,o){return reactExports.createElement(RemoveScroll,__assign({},et,{ref:o,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(et){if(typeof document>"u")return null;var o=Array.isArray(et)?et[0]:et;return o.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(et){return et&&(et.host||unwrapHost(et.parentNode))},correctTargets=function(et,o){return o.map(function(tt){if(et.contains(tt))return tt;var rt=unwrapHost(tt);return rt&&et.contains(rt)?rt:(console.error("aria-hidden",tt,"in not contained inside",et,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(et,o,tt,rt){var nt=correctTargets(o,Array.isArray(et)?et:[et]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(nt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};nt.forEach(ct);var lt=function(dt){!dt||at.has(dt)||Array.prototype.forEach.call(dt.children,function(ht){if(st.has(ht))lt(ht);else try{var mt=ht.getAttribute(rt),ft=mt!==null&&mt!=="false",pt=(counterMap.get(ht)||0)+1,yt=(ot.get(ht)||0)+1;counterMap.set(ht,pt),ot.set(ht,yt),it.push(ht),pt===1&&ft&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),ft||ht.setAttribute(rt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(o),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,mt=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,mt),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(rt),uncontrolledNodes.delete(dt)),mt||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(et,o,tt){tt===void 0&&(tt="data-aria-hidden");var rt=Array.from(Array.isArray(et)?et:[et]),nt=getDefaultParent(et);return nt?(rt.push.apply(rt,Array.from(nt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(rt,nt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=et=>{const{__scopeDialog:o,children:tt,open:rt,defaultOpen:nt,onOpenChange:ot,modal:it=!0}=et,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:rt,defaultProp:nt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:o,triggerRef:st,contentRef:at,contentId:useId(),titleId:useId(),descriptionId:useId(),open:ct,onOpenChange:lt,onOpenToggle:reactExports.useCallback(()=>lt(dt=>!dt),[lt]),modal:it,children:tt})};Dialog$1.displayName=DIALOG_NAME;var TRIGGER_NAME="DialogTrigger",DialogTrigger$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(o,nt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":nt.open,"aria-controls":nt.contentId,"data-state":getState(nt.open),...rt,ref:ot,onClick:composeEventHandlers(et.onClick,nt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((et,o)=>{const tt=usePortalContext(OVERLAY_NAME,et.__scopeDialog),{forceMount:rt=tt.forceMount,...nt}=et,ot=useDialogContext(OVERLAY_NAME,et.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:rt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...nt,ref:o})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[nt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(nt.open),...rt,ref:o,style:{pointerEvents:"auto",...rt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((et,o)=>{const tt=usePortalContext(CONTENT_NAME,et.__scopeDialog),{forceMount:rt=tt.forceMount,...nt}=et,ot=useDialogContext(CONTENT_NAME,et.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:rt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...nt,ref:o}):jsxRuntimeExports.jsx(DialogContentNonModal,{...nt,ref:o})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((et,o)=>{const tt=useDialogContext(CONTENT_NAME,et.__scopeDialog),rt=reactExports.useRef(null),nt=useComposedRefs(o,tt.contentRef,rt);return reactExports.useEffect(()=>{const ot=rt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...et,ref:nt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(et.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(et.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(et.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((et,o)=>{const tt=useDialogContext(CONTENT_NAME,et.__scopeDialog),rt=reactExports.useRef(!1),nt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...et,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=et.onCloseAutoFocus)==null||it.call(et,ot),ot.defaultPrevented||(rt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),rt.current=!1,nt.current=!1},onInteractOutside:ot=>{var at,ct;(at=et.onInteractOutside)==null||at.call(et,ot),ot.defaultPrevented||(rt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(nt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&nt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,trapFocus:rt,onOpenAutoFocus:nt,onCloseAutoFocus:ot,...it}=et,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(o,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:rt,onMountAutoFocus:nt,onUnmountAutoFocus:ot,children:jsxRuntimeExports.jsx(DismissableLayer,{role:"dialog",id:st.contentId,"aria-describedby":st.descriptionId,"aria-labelledby":st.titleId,"data-state":getState(st.open),...it,ref:ct,onDismiss:()=>st.onOpenChange(!1)})}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TitleWarning,{titleId:st.titleId}),jsxRuntimeExports.jsx(DescriptionWarning,{contentRef:at,descriptionId:st.descriptionId})]})]})}),TITLE_NAME="DialogTitle",DialogTitle$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:nt.titleId,...rt,ref:o})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:nt.descriptionId,...rt,ref:o})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((et,o)=>{const{__scopeDialog:tt,...rt}=et,nt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...rt,ref:o,onClick:composeEventHandlers(et.onClick,()=>nt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(et){return et?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:et})=>{const o=useWarningContext(TITLE_WARNING_NAME),tt=`\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${o.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return reactExports.useEffect(()=>{et&&(document.getElementById(et)||console.error(tt))},[tt,et]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning=({contentRef:et,descriptionId:o})=>{const rt=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return reactExports.useEffect(()=>{var ot;const nt=(ot=et.current)==null?void 0:ot.getAttribute("aria-describedby");o&&nt&&(document.getElementById(o)||console.warn(rt))},[rt,et,o]),null},Root$2=Dialog$1,Trigger=DialogTrigger$1,Portal=DialogPortal$1,Overlay=DialogOverlay$1,Content=DialogContent$1,Title=DialogTitle$1,Description=DialogDescription$1,Close=DialogClose;function _objectWithoutPropertiesLoose(et,o){if(et==null)return{};var tt={},rt=Object.keys(et),nt,ot;for(ot=0;ot=0)&&(tt[nt]=et[nt]);return tt}var _excluded$1r=["color"],Cross2Icon=reactExports.forwardRef(function(et,o){var tt=et.color,rt=tt===void 0?"currentColor":tt,nt=_objectWithoutPropertiesLoose(et,_excluded$1r);return reactExports.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},nt,{ref:o}),reactExports.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:rt,fillRule:"evenodd",clipRule:"evenodd"}))});const Dialog=Root$2,DialogTrigger=Trigger,DialogPortal=Portal,DialogOverlay=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Overlay,{ref:tt,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",et),...o}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=reactExports.forwardRef(({className:et,children:o,...tt},rt)=>jsxRuntimeExports.jsxs(DialogPortal,{children:[jsxRuntimeExports.jsx(DialogOverlay,{}),jsxRuntimeExports.jsxs(Content,{ref:rt,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",et),...tt,children:[o,jsxRuntimeExports.jsxs(Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[jsxRuntimeExports.jsx(Cross2Icon,{className:"h-4 w-4"}),jsxRuntimeExports.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));DialogContent.displayName=Content.displayName;const DialogHeader=({className:et,...o})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",et),...o});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:et,...o})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",et),...o});DialogFooter.displayName="DialogFooter";const DialogTitle=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Title,{ref:tt,className:cn("text-lg font-semibold leading-none tracking-tight",et),...o}));DialogTitle.displayName=Title.displayName;const DialogDescription=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Description,{ref:tt,className:cn("text-sm text-muted-foreground",et),...o}));DialogDescription.displayName=Description.displayName;var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(et,o,tt)=>o in et?__defProp(et,o,{enumerable:!0,configurable:!0,writable:!0,value:tt}):et[o]=tt,__spreadValues=(et,o)=>{for(var tt in o||(o={}))__hasOwnProp.call(o,tt)&&__defNormalProp(et,tt,o[tt]);if(__getOwnPropSymbols)for(var tt of __getOwnPropSymbols(o))__propIsEnum.call(o,tt)&&__defNormalProp(et,tt,o[tt]);return et},__objRest=(et,o)=>{var tt={};for(var rt in et)__hasOwnProp.call(et,rt)&&o.indexOf(rt)<0&&(tt[rt]=et[rt]);if(et!=null&&__getOwnPropSymbols)for(var rt of __getOwnPropSymbols(et))o.indexOf(rt)<0&&__propIsEnum.call(et,rt)&&(tt[rt]=et[rt]);return tt};/** +For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return reactExports.useEffect(()=>{et&&(document.getElementById(et)||console.error(tt))},[tt,et]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning=({contentRef:et,descriptionId:o})=>{const rt=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return reactExports.useEffect(()=>{var ot;const nt=(ot=et.current)==null?void 0:ot.getAttribute("aria-describedby");o&&nt&&(document.getElementById(o)||console.warn(rt))},[rt,et,o]),null},Root$2=Dialog$1,Trigger=DialogTrigger$1,Overlay=DialogOverlay$1,Content=DialogContent$1,Title=DialogTitle$1,Description=DialogDescription$1;const Dialog=Root$2,DialogTrigger=Trigger,DialogOverlay=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Overlay,{ref:tt,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",et),...o}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Content,{ref:tt,className:cn("fixed z-50 grid w-full gap-4 rounded-b-lg border bg-background p-6 shadow-lg animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0","max-h-[85vh] overflow-y-auto",et),...o}));DialogContent.displayName=Content.displayName;const DialogHeader=({className:et,...o})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",et),...o});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:et,...o})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",et),...o});DialogFooter.displayName="DialogFooter";const DialogTitle=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Title,{ref:tt,className:cn("text-lg font-semibold leading-none tracking-tight",et),...o}));DialogTitle.displayName=Title.displayName;const DialogDescription=reactExports.forwardRef(({className:et,...o},tt)=>jsxRuntimeExports.jsx(Description,{ref:tt,className:cn("text-sm text-muted-foreground",et),...o}));DialogDescription.displayName=Description.displayName;var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(et,o,tt)=>o in et?__defProp(et,o,{enumerable:!0,configurable:!0,writable:!0,value:tt}):et[o]=tt,__spreadValues=(et,o)=>{for(var tt in o||(o={}))__hasOwnProp.call(o,tt)&&__defNormalProp(et,tt,o[tt]);if(__getOwnPropSymbols)for(var tt of __getOwnPropSymbols(o))__propIsEnum.call(o,tt)&&__defNormalProp(et,tt,o[tt]);return et},__objRest=(et,o)=>{var tt={};for(var rt in et)__hasOwnProp.call(et,rt)&&o.indexOf(rt)<0&&(tt[rt]=et[rt]);if(et!=null&&__getOwnPropSymbols)for(var rt of __getOwnPropSymbols(et))o.indexOf(rt)<0&&__propIsEnum.call(et,rt)&&(tt[rt]=et[rt]);return tt};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT @@ -4134,7 +4134,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${o.do * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC - */var ERROR_LEVEL_MAP={L:qrcodegen_default.QrCode.Ecc.LOW,M:qrcodegen_default.QrCode.Ecc.MEDIUM,Q:qrcodegen_default.QrCode.Ecc.QUARTILE,H:qrcodegen_default.QrCode.Ecc.HIGH},DEFAULT_SIZE=128,DEFAULT_LEVEL="L",DEFAULT_BGCOLOR="#FFFFFF",DEFAULT_FGCOLOR="#000000",DEFAULT_INCLUDEMARGIN=!1,DEFAULT_MINVERSION=1,SPEC_MARGIN_SIZE=4,DEFAULT_MARGIN_SIZE=0,DEFAULT_IMG_SCALE=.1;function generatePath(et,o=0){const tt=[];return et.forEach(function(rt,nt){let ot=null;rt.forEach(function(it,st){if(!it&&ot!==null){tt.push(`M${ot+o} ${nt+o}h${st-ot}v1H${ot+o}z`),ot=null;return}if(st===rt.length-1){if(!it)return;ot===null?tt.push(`M${st+o},${nt+o} h1v1H${st+o}z`):tt.push(`M${ot+o},${nt+o} h${st+1-ot}v1H${ot+o}z`);return}it&&ot===null&&(ot=st)})}),tt.join("")}function excavateModules(et,o){return et.slice().map((tt,rt)=>rt=o.y+o.h?tt:tt.map((nt,ot)=>ot=o.x+o.w?nt:!1))}function getImageSettings(et,o,tt,rt){if(rt==null)return null;const nt=et.length+tt*2,ot=Math.floor(o*DEFAULT_IMG_SCALE),it=nt/o,st=(rt.width||ot)*it,at=(rt.height||ot)*it,ct=rt.x==null?et.length/2-st/2:rt.x*it,lt=rt.y==null?et.length/2-at/2:rt.y*it,dt=rt.opacity==null?1:rt.opacity;let ht=null;if(rt.excavate){let ft=Math.floor(ct),pt=Math.floor(lt),yt=Math.ceil(st+ct-ft),gt=Math.ceil(at+lt-pt);ht={x:ft,y:pt,w:yt,h:gt}}const mt=rt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:mt}}function getMarginSize(et,o){return o!=null?Math.max(Math.floor(o),0):et?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:et,level:o,minVersion:tt,includeMargin:rt,marginSize:nt,imageSettings:ot,size:it}){let st=React.useMemo(()=>{const ht=qrcodegen_default.QrSegment.makeSegments(et);return qrcodegen_default.QrCode.encodeSegments(ht,ERROR_LEVEL_MAP[o],tt)},[et,o,tt]);const{cells:at,margin:ct,numCells:lt,calculatedImageSettings:dt}=React.useMemo(()=>{let ht=st.getModules();const mt=getMarginSize(rt,nt),ft=ht.length+mt*2,pt=getImageSettings(ht,it,mt,ot);return{cells:ht,margin:mt,numCells:ft,calculatedImageSettings:pt}},[st,it,ot,rt,nt]);return{qrcode:st,margin:ct,cells:at,numCells:lt,calculatedImageSettings:dt}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(o,tt){const rt=o,{value:nt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,marginSize:dt,imageSettings:ht}=rt,ft=__objRest(rt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","marginSize","imageSettings"]),{style:pt}=ft,yt=__objRest(ft,["style"]),gt=ht==null?void 0:ht.src,bt=React.useRef(null),xt=React.useRef(null),vt=React.useCallback(Mt=>{bt.current=Mt,typeof tt=="function"?tt(Mt):tt&&(tt.current=Mt)},[tt]),[Et,Ct]=React.useState(!1),{margin:St,cells:At,numCells:kt,calculatedImageSettings:It}=useQRCode({value:nt,level:it,minVersion:lt,includeMargin:ct,marginSize:dt,imageSettings:ht,size:ot});React.useEffect(()=>{if(bt.current!=null){const Mt=bt.current,zt=Mt.getContext("2d");if(!zt)return;let Ut=At;const Xt=xt.current,Wt=It!=null&&Xt!==null&&Xt.complete&&Xt.naturalHeight!==0&&Xt.naturalWidth!==0;Wt&&It.excavation!=null&&(Ut=excavateModules(At,It.excavation));const Ft=window.devicePixelRatio||1;Mt.height=Mt.width=ot*Ft;const qt=ot/kt*Ft;zt.scale(qt,qt),zt.fillStyle=st,zt.fillRect(0,0,kt,kt),zt.fillStyle=at,SUPPORTS_PATH2D?zt.fill(new Path2D(generatePath(Ut,St))):At.forEach(function(Pt,Yt){Pt.forEach(function(Qt,jt){Qt&&zt.fillRect(jt+St,Yt+St,1,1)})}),It&&(zt.globalAlpha=It.opacity),Wt&&zt.drawImage(Xt,It.x+St,It.y+St,It.w,It.h)}}),React.useEffect(()=>{Ct(!1)},[gt]);const Nt=__spreadValues({height:ot,width:ot},pt);let Lt=null;return gt!=null&&(Lt=React.createElement("img",{src:gt,key:gt,style:{display:"none"},onLoad:()=>{Ct(!0)},ref:xt,crossOrigin:It==null?void 0:It.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Nt,height:ot,width:ot,ref:vt,role:"img"},yt)),Lt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(o,tt){const rt=o,{value:nt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,title:dt,marginSize:ht,imageSettings:mt}=rt,ft=__objRest(rt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","title","marginSize","imageSettings"]),{margin:pt,cells:yt,numCells:gt,calculatedImageSettings:bt}=useQRCode({value:nt,level:it,minVersion:lt,includeMargin:ct,marginSize:ht,imageSettings:mt,size:ot});let xt=yt,vt=null;mt!=null&&bt!=null&&(bt.excavation!=null&&(xt=excavateModules(yt,bt.excavation)),vt=React.createElement("image",{href:mt.src,height:bt.h,width:bt.w,x:bt.x+pt,y:bt.y+pt,preserveAspectRatio:"none",opacity:bt.opacity,crossOrigin:bt.crossOrigin}));const Et=generatePath(xt,pt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${gt} ${gt}`,ref:tt,role:"img"},ft),!!dt&&React.createElement("title",null,dt),React.createElement("path",{fill:st,d:`M0,0 h${gt}v${gt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:Et,shapeRendering:"crispEdges"}),vt)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:et,width:o=256,height:tt=256})=>{const[rt,nt]=reactExports.useState(!1),ot=async()=>{await navigator.clipboard.writeText(et),nt(!0),setTimeout(()=>nt(!1),2e3)};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCodeSVG,{value:et,size:Math.min(o,tt)}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("input",{type:"text",value:et,readOnly:!0,className:"flex-1 px-3 py-2 text-sm border rounded-md bg-muted"}),jsxRuntimeExports.jsx(Button,{variant:"outline",size:"icon",onClick:ot,children:rt?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(et,o=0){return(byteToHex[et[o+0]]+byteToHex[et[o+1]]+byteToHex[et[o+2]]+byteToHex[et[o+3]]+"-"+byteToHex[et[o+4]]+byteToHex[et[o+5]]+"-"+byteToHex[et[o+6]]+byteToHex[et[o+7]]+"-"+byteToHex[et[o+8]]+byteToHex[et[o+9]]+"-"+byteToHex[et[o+10]]+byteToHex[et[o+11]]+byteToHex[et[o+12]]+byteToHex[et[o+13]]+byteToHex[et[o+14]]+byteToHex[et[o+15]]).toLowerCase()}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native={randomUUID};function v4(et,o,tt){if(native.randomUUID&&!o&&!et)return native.randomUUID();et=et||{};var rt=et.random||(et.rng||rng)();return rt[6]=rt[6]&15|64,rt[8]=rt[8]&63|128,unsafeStringify(rt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(et,o){for(var tt=new Array(arguments.length-1),rt=0,nt=2,ot=!0;nt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),rt=new Array(123),nt=0;nt<64;)rt[tt[nt]=nt<26?nt+65:nt<52?nt+71:nt<62?nt-4:nt-59|43]=nt++;o.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,mt=0,ft;at>2],ft=(pt&3)<<4,mt=1;break;case 1:dt[ht++]=tt[ft|pt>>4],ft=(pt&15)<<2,mt=2;break;case 2:dt[ht++]=tt[ft|pt>>6],dt[ht++]=tt[pt&63],mt=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return mt&&(dt[ht++]=tt[ft],dt[ht++]=61,mt===1&&(dt[ht++]=61)),lt?(ht&<.push(String.fromCharCode.apply(String,dt.slice(0,ht))),lt.join("")):String.fromCharCode.apply(String,dt.slice(0,ht))};var ot="invalid encoding";o.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,mt=0;mt1)break;if((ft=rt[ft])===void 0)throw Error(ot);switch(dt){case 0:ht=ft,dt=1;break;case 1:at[ct++]=ht<<2|(ft&48)>>4,ht=ft,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(ft&60)>>2,ht=ft,dt=3;break;case 3:at[ct++]=(ht&3)<<6|ft,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},o.test=function(st){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(st)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(o,tt,rt){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:tt,ctx:rt||this}),this};EventEmitter.prototype.off=function(o,tt){if(o===void 0)this._listeners={};else if(tt===void 0)this._listeners[o]=[];else for(var rt=this._listeners[o],nt=0;nt0?0:2147483648,ot,it);else if(isNaN(nt))rt(2143289344,ot,it);else if(nt>34028234663852886e22)rt((st<<31|2139095040)>>>0,ot,it);else if(nt<11754943508222875e-54)rt((st<<31|Math.round(nt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(nt)/Math.LN2),ct=Math.round(nt*Math.pow(2,-at)*8388608)&8388607;rt((st<<31|at+127<<23|ct)>>>0,ot,it)}}et.writeFloatLE=o.bind(null,writeUintLE),et.writeFloatBE=o.bind(null,writeUintBE);function tt(rt,nt,ot){var it=rt(nt,ot),st=(it>>31)*2+1,at=it>>>23&255,ct=it&8388607;return at===255?ct?NaN:st*(1/0):at===0?st*1401298464324817e-60*ct:st*Math.pow(2,at-150)*(ct+8388608)}et.readFloatLE=tt.bind(null,readUintLE),et.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var o=new Float64Array([-0]),tt=new Uint8Array(o.buffer),rt=tt[7]===128;function nt(at,ct,lt){o[0]=at,ct[lt]=tt[0],ct[lt+1]=tt[1],ct[lt+2]=tt[2],ct[lt+3]=tt[3],ct[lt+4]=tt[4],ct[lt+5]=tt[5],ct[lt+6]=tt[6],ct[lt+7]=tt[7]}function ot(at,ct,lt){o[0]=at,ct[lt]=tt[7],ct[lt+1]=tt[6],ct[lt+2]=tt[5],ct[lt+3]=tt[4],ct[lt+4]=tt[3],ct[lt+5]=tt[2],ct[lt+6]=tt[1],ct[lt+7]=tt[0]}et.writeDoubleLE=rt?nt:ot,et.writeDoubleBE=rt?ot:nt;function it(at,ct){return tt[0]=at[ct],tt[1]=at[ct+1],tt[2]=at[ct+2],tt[3]=at[ct+3],tt[4]=at[ct+4],tt[5]=at[ct+5],tt[6]=at[ct+6],tt[7]=at[ct+7],o[0]}function st(at,ct){return tt[7]=at[ct],tt[6]=at[ct+1],tt[5]=at[ct+2],tt[4]=at[ct+3],tt[3]=at[ct+4],tt[2]=at[ct+5],tt[1]=at[ct+6],tt[0]=at[ct+7],o[0]}et.readDoubleLE=rt?it:st,et.readDoubleBE=rt?st:it}():function(){function o(rt,nt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)rt(0,st,at+nt),rt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))rt(0,st,at+nt),rt(2146959360,st,at+ot);else if(it>17976931348623157e292)rt(0,st,at+nt),rt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,rt(lt>>>0,st,at+nt),rt((ct<<31|lt/4294967296)>>>0,st,at+ot);else{var dt=Math.floor(Math.log(it)/Math.LN2);dt===1024&&(dt=1023),lt=it*Math.pow(2,-dt),rt(lt*4503599627370496>>>0,st,at+nt),rt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}et.writeDoubleLE=o.bind(null,writeUintLE,0,4),et.writeDoubleBE=o.bind(null,writeUintBE,4,0);function tt(rt,nt,ot,it,st){var at=rt(it,st+nt),ct=rt(it,st+ot),lt=(ct>>31)*2+1,dt=ct>>>20&2047,ht=4294967296*(ct&1048575)+at;return dt===2047?ht?NaN:lt*(1/0):dt===0?lt*5e-324*ht:lt*Math.pow(2,dt-1075)*(ht+4503599627370496)}et.readDoubleLE=tt.bind(null,readUintLE,0,4),et.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),et}function writeUintLE(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}function writeUintBE(et,o,tt){o[tt]=et>>>24,o[tt+1]=et>>>16&255,o[tt+2]=et>>>8&255,o[tt+3]=et&255}function readUintLE(et,o){return(et[o]|et[o+1]<<8|et[o+2]<<16|et[o+3]<<24)>>>0}function readUintBE(et,o){return(et[o]<<24|et[o+1]<<16|et[o+2]<<8|et[o+3])>>>0}var inquire_1=inquire$1;function inquire$1(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(et){}return null}var utf8$2={};(function(et){var o=et;o.length=function(rt){for(var nt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|rt[nt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(rt[nt++]&63)<<12|(rt[nt++]&63)<<6|rt[nt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(rt[nt++]&63)<<6|rt[nt++]&63,ct>8191&&((st||(st=[])).push(String.fromCharCode.apply(String,at)),ct=0);return st?(ct&&st.push(String.fromCharCode.apply(String,at.slice(0,ct))),st.join("")):String.fromCharCode.apply(String,at.slice(0,ct))},o.write=function(rt,nt,ot){for(var it=ot,st,at,ct=0;ct>6|192,nt[ot++]=st&63|128):(st&64512)===55296&&((at=rt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,nt[ot++]=st>>18|240,nt[ot++]=st>>12&63|128,nt[ot++]=st>>6&63|128,nt[ot++]=st&63|128):(nt[ot++]=st>>12|224,nt[ot++]=st>>6&63|128,nt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(et,o,tt){var rt=tt||8192,nt=rt>>>1,ot=null,it=rt;return function(at){if(at<1||at>nt)return et(at);it+at>rt&&(ot=et(rt),it=0);var ct=o.call(ot,it,it+=at);return it&7&&(it=(it|7)+1),ct}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=o;var et=requireMinimal();function o(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=o.zero=new o(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var rt=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(it){if(it===0)return tt;var st=it<0;st&&(it=-it);var at=it>>>0,ct=(it-at)/4294967296>>>0;return st&&(ct=~ct>>>0,at=~at>>>0,++at>4294967295&&(at=0,++ct>4294967295&&(ct=0))),new o(at,ct)},o.from=function(it){if(typeof it=="number")return o.fromNumber(it);if(et.isString(it))if(et.Long)it=et.Long.fromString(it);else return o.fromNumber(parseInt(it,10));return it.low||it.high?new o(it.low>>>0,it.high>>>0):tt},o.prototype.toNumber=function(it){if(!it&&this.hi>>>31){var st=~this.lo+1>>>0,at=~this.hi>>>0;return st||(at=at+1>>>0),-(st+at*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(it){return et.Long?new et.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var nt=String.prototype.charCodeAt;return o.fromHash=function(it){return it===rt?tt:new o((nt.call(it,0)|nt.call(it,1)<<8|nt.call(it,2)<<16|nt.call(it,3)<<24)>>>0,(nt.call(it,4)|nt.call(it,5)<<8|nt.call(it,6)<<16|nt.call(it,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var it=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^it)>>>0,this.lo=(this.lo<<1^it)>>>0,this},o.prototype.zzDecode=function(){var it=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^it)>>>0,this.hi=(this.hi>>>1^it)>>>0,this},o.prototype.length=function(){var it=this.lo,st=(this.lo>>>28|this.hi<<4)>>>0,at=this.hi>>>24;return at===0?st===0?it<16384?it<128?1:2:it<2097152?3:4:st<16384?st<128?5:6:st<2097152?7:8:at<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(et){var o=et;o.asPromise=aspromise,o.base64=base64$1,o.EventEmitter=eventemitter,o.float=float,o.inquire=inquire_1,o.utf8=utf8$2,o.pool=pool_1,o.LongBits=requireLongbits(),o.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),o.global=o.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},o.isString=function(ot){return typeof ot=="string"||ot instanceof String},o.isObject=function(ot){return ot&&typeof ot=="object"},o.isset=o.isSet=function(ot,it){var st=ot[it];return st!=null&&ot.hasOwnProperty(it)?typeof st!="object"||(Array.isArray(st)?st.length:Object.keys(st).length)>0:!1},o.Buffer=function(){try{var nt=o.inquire("buffer").Buffer;return nt.prototype.utf8Write?nt:null}catch{return null}}(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=function(ot){return typeof ot=="number"?o.Buffer?o._Buffer_allocUnsafe(ot):new o.Array(ot):o.Buffer?o._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=o.global.dcodeIO&&o.global.dcodeIO.Long||o.global.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=function(ot){return ot?o.LongBits.from(ot).toHash():o.LongBits.zeroHash},o.longFromHash=function(ot,it){var st=o.LongBits.fromHash(ot);return o.Long?o.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(nt,ot,it){for(var st=Object.keys(ot),at=0;at-1;--ct)if(it[at[ct]]===1&&this[at[ct]]!==void 0&&this[at[ct]]!==null)return at[ct]}},o.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)o[tt++]=et&127|128,et>>>=7;o[tt]=et}function VarintOp(et,o){this.len=et,this.next=void 0,this.val=o}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function et(o){return this.len+=(this.tail=this.tail.next=new VarintOp((o=o>>>0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this};Writer$1.prototype.int32=function et(o){return o<0?this._push(writeVarint64,10,LongBits$1.fromNumber(o)):this.uint32(o)};Writer$1.prototype.sint32=function et(o){return this.uint32((o<<1^o>>31)>>>0)};function writeVarint64(et,o,tt){for(;et.hi;)o[tt++]=et.lo&127|128,et.lo=(et.lo>>>7|et.hi<<25)>>>0,et.hi>>>=7;for(;et.lo>127;)o[tt++]=et.lo&127|128,et.lo=et.lo>>>7;o[tt++]=et.lo}Writer$1.prototype.uint64=function et(o){var tt=LongBits$1.from(o);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function et(o){var tt=LongBits$1.from(o).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function et(o){return this._push(writeByte,1,o?1:0)};function writeFixed32(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}Writer$1.prototype.fixed32=function et(o){return this._push(writeFixed32,4,o>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function et(o){var tt=LongBits$1.from(o);return this._push(writeFixed32,4,tt.lo)._push(writeFixed32,4,tt.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function et(o){return this._push(util$7.float.writeFloatLE,4,o)};Writer$1.prototype.double=function et(o){return this._push(util$7.float.writeDoubleLE,8,o)};var writeBytes=util$7.Array.prototype.set?function et(o,tt,rt){tt.set(o,rt)}:function et(o,tt,rt){for(var nt=0;nt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(o)){var rt=Writer$1.alloc(tt=base64.length(o));base64.decode(o,rt,0),o=rt}return this.uint32(tt)._push(writeBytes,tt,o)};Writer$1.prototype.string=function et(o){var tt=utf8$1.length(o);return tt?this.uint32(tt)._push(utf8$1.write,tt,o):this._push(writeByte,1,0)};Writer$1.prototype.fork=function et(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function et(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function et(){var o=this.head,tt=this.tail,rt=this.len;return this.reset().uint32(rt),rt&&(this.tail.next=o.next,this.tail=tt,this.len+=rt),this};Writer$1.prototype.finish=function et(){for(var o=this.head.next,tt=this.constructor.alloc(this.len),rt=0;o;)o.fn(o.val,tt,rt),rt+=o.len,o=o.next;return tt};Writer$1._configure=function(et){BufferWriter$1=et,Writer$1.create=create$2(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$6=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$6._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$6.Buffer&&util$6.Buffer.prototype instanceof Uint8Array&&util$6.Buffer.prototype.set.name==="set"?function(o,tt,rt){tt.set(o,rt)}:function(o,tt,rt){if(o.copy)o.copy(tt,rt,0,o.length);else for(var nt=0;nt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,o),this};function writeStringBuffer(et,o,tt){et.length<40?util$6.utf8.write(et,o,tt):o.utf8Write?o.utf8Write(et,tt):o.write(et,tt)}BufferWriter.prototype.string=function et(o){var tt=util$6.Buffer.byteLength(o);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,o),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(et,o){return RangeError("index out of range: "+et.pos+" + "+(o||1)+" > "+et.len)}function Reader$1(et){this.buf=et,this.pos=0,this.len=et.length}var create_array=typeof Uint8Array<"u"?function et(o){if(o instanceof Uint8Array||Array.isArray(o))return new Reader$1(o);throw Error("illegal buffer")}:function et(o){if(Array.isArray(o))return new Reader$1(o);throw Error("illegal buffer")},create$1=function et(){return util$5.Buffer?function(tt){return(Reader$1.create=function(nt){return util$5.Buffer.isBuffer(nt)?new BufferReader$1(nt):create_array(nt)})(tt)}:create_array};Reader$1.create=create$1();Reader$1.prototype._slice=util$5.Array.prototype.subarray||util$5.Array.prototype.slice;Reader$1.prototype.uint32=function et(){var o=4294967295;return function(){if(o=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(o=(o|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return o;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return o}}();Reader$1.prototype.int32=function et(){return this.uint32()|0};Reader$1.prototype.sint32=function et(){var o=this.uint32();return o>>>1^-(o&1)|0};function readLongVarint(){var et=new LongBits(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et;if(et.lo=(et.lo|(this.buf[this.pos]&127)<<28)>>>0,et.hi=(et.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return et;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw indexOutOfRange(this);if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}return et.lo=(et.lo|(this.buf[this.pos++]&127)<>>0,et}if(this.len-this.pos>4){for(;o<5;++o)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;o<5;++o){if(this.pos>=this.len)throw indexOutOfRange(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function et(){return this.uint32()!==0};function readFixed32_end(et,o){return(et[o-4]|et[o-3]<<8|et[o-2]<<16|et[o-1]<<24)>>>0}Reader$1.prototype.fixed32=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var o=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o};Reader$1.prototype.double=function et(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var o=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o};Reader$1.prototype.bytes=function et(){var o=this.uint32(),tt=this.pos,rt=this.pos+o;if(rt>this.len)throw indexOutOfRange(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(tt,rt);if(tt===rt){var nt=util$5.Buffer;return nt?nt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,rt)};Reader$1.prototype.string=function et(){var o=this.bytes();return utf8.read(o,0,o.length)};Reader$1.prototype.skip=function et(o){if(typeof o=="number"){if(this.pos+o>this.len)throw indexOutOfRange(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(et){switch(et){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(et=this.uint32()&7)!==4;)this.skipType(et);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+et+" at offset "+this.pos)}return this};Reader$1._configure=function(et){BufferReader$1=et,Reader$1.create=create$1(),BufferReader$1._configure();var o=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[o](!1)},uint64:function(){return readLongVarint.call(this)[o](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[o](!1)},fixed64:function(){return readFixed64.call(this)[o](!0)},sfixed64:function(){return readFixed64.call(this)[o](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(et){Reader.call(this,et)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function et(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))};BufferReader._configure();var rpc={},service$1=Service$1,util$3=requireMinimal();(Service$1.prototype=Object.create(util$3.EventEmitter.prototype)).constructor=Service$1;function Service$1(et,o,tt){if(typeof et!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=et,this.requestDelimited=!!o,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function et(o,tt,rt,nt,ot){if(!nt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(et,it,o,tt,rt,nt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(o,tt[it.requestDelimited?"encodeDelimited":"encode"](nt).finish(),function(at,ct){if(at)return it.emit("error",at,o),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof rt))try{ct=rt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,o),ot(lt)}return it.emit("data",ct,o),ot(null,ct)})}catch(st){it.emit("error",st,o),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function et(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(et){var o=et;o.Service=service$1})(rpc);var roots={};(function(et){var o=et;o.build="minimal",o.Writer=writer,o.BufferWriter=writer_buffer,o.Reader=reader,o.BufferReader=reader_buffer,o.util=requireMinimal(),o.rpc=rpc,o.roots=roots,o.configure=tt;function tt(){o.util._configure(),o.Writer._configure(o.BufferWriter),o.Reader._configure(o.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(et,o){typeof et=="string"&&(o=et,et=void 0);var tt=[];function rt(ot){if(typeof ot!="string"){var it=nt();if(codegen.verbose&&console.log("codegen: "+it),it="return "+it,ot){for(var st=Object.keys(ot),at=new Array(st.length+1),ct=new Array(st.length),lt=0;ltrt=o.y+o.h?tt:tt.map((nt,ot)=>ot=o.x+o.w?nt:!1))}function getImageSettings(et,o,tt,rt){if(rt==null)return null;const nt=et.length+tt*2,ot=Math.floor(o*DEFAULT_IMG_SCALE),it=nt/o,st=(rt.width||ot)*it,at=(rt.height||ot)*it,ct=rt.x==null?et.length/2-st/2:rt.x*it,lt=rt.y==null?et.length/2-at/2:rt.y*it,dt=rt.opacity==null?1:rt.opacity;let ht=null;if(rt.excavate){let ft=Math.floor(ct),pt=Math.floor(lt),yt=Math.ceil(st+ct-ft),gt=Math.ceil(at+lt-pt);ht={x:ft,y:pt,w:yt,h:gt}}const mt=rt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:mt}}function getMarginSize(et,o){return o!=null?Math.max(Math.floor(o),0):et?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:et,level:o,minVersion:tt,includeMargin:rt,marginSize:nt,imageSettings:ot,size:it}){let st=React.useMemo(()=>{const ht=qrcodegen_default.QrSegment.makeSegments(et);return qrcodegen_default.QrCode.encodeSegments(ht,ERROR_LEVEL_MAP[o],tt)},[et,o,tt]);const{cells:at,margin:ct,numCells:lt,calculatedImageSettings:dt}=React.useMemo(()=>{let ht=st.getModules();const mt=getMarginSize(rt,nt),ft=ht.length+mt*2,pt=getImageSettings(ht,it,mt,ot);return{cells:ht,margin:mt,numCells:ft,calculatedImageSettings:pt}},[st,it,ot,rt,nt]);return{qrcode:st,margin:ct,cells:at,numCells:lt,calculatedImageSettings:dt}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(o,tt){const rt=o,{value:nt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,marginSize:dt,imageSettings:ht}=rt,ft=__objRest(rt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","marginSize","imageSettings"]),{style:pt}=ft,yt=__objRest(ft,["style"]),gt=ht==null?void 0:ht.src,bt=React.useRef(null),xt=React.useRef(null),vt=React.useCallback(Mt=>{bt.current=Mt,typeof tt=="function"?tt(Mt):tt&&(tt.current=Mt)},[tt]),[Et,Ct]=React.useState(!1),{margin:St,cells:At,numCells:kt,calculatedImageSettings:It}=useQRCode({value:nt,level:it,minVersion:lt,includeMargin:ct,marginSize:dt,imageSettings:ht,size:ot});React.useEffect(()=>{if(bt.current!=null){const Mt=bt.current,zt=Mt.getContext("2d");if(!zt)return;let Ut=At;const Xt=xt.current,Wt=It!=null&&Xt!==null&&Xt.complete&&Xt.naturalHeight!==0&&Xt.naturalWidth!==0;Wt&&It.excavation!=null&&(Ut=excavateModules(At,It.excavation));const Ft=window.devicePixelRatio||1;Mt.height=Mt.width=ot*Ft;const qt=ot/kt*Ft;zt.scale(qt,qt),zt.fillStyle=st,zt.fillRect(0,0,kt,kt),zt.fillStyle=at,SUPPORTS_PATH2D?zt.fill(new Path2D(generatePath(Ut,St))):At.forEach(function(Pt,Yt){Pt.forEach(function(Qt,jt){Qt&&zt.fillRect(jt+St,Yt+St,1,1)})}),It&&(zt.globalAlpha=It.opacity),Wt&&zt.drawImage(Xt,It.x+St,It.y+St,It.w,It.h)}}),React.useEffect(()=>{Ct(!1)},[gt]);const Nt=__spreadValues({height:ot,width:ot},pt);let Lt=null;return gt!=null&&(Lt=React.createElement("img",{src:gt,key:gt,style:{display:"none"},onLoad:()=>{Ct(!0)},ref:xt,crossOrigin:It==null?void 0:It.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Nt,height:ot,width:ot,ref:vt,role:"img"},yt)),Lt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(o,tt){const rt=o,{value:nt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,title:dt,marginSize:ht,imageSettings:mt}=rt,ft=__objRest(rt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","title","marginSize","imageSettings"]),{margin:pt,cells:yt,numCells:gt,calculatedImageSettings:bt}=useQRCode({value:nt,level:it,minVersion:lt,includeMargin:ct,marginSize:ht,imageSettings:mt,size:ot});let xt=yt,vt=null;mt!=null&&bt!=null&&(bt.excavation!=null&&(xt=excavateModules(yt,bt.excavation)),vt=React.createElement("image",{href:mt.src,height:bt.h,width:bt.w,x:bt.x+pt,y:bt.y+pt,preserveAspectRatio:"none",opacity:bt.opacity,crossOrigin:bt.crossOrigin}));const Et=generatePath(xt,pt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${gt} ${gt}`,ref:tt,role:"img"},ft),!!dt&&React.createElement("title",null,dt),React.createElement("path",{fill:st,d:`M0,0 h${gt}v${gt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:Et,shapeRendering:"crispEdges"}),vt)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:et,width:o=256,height:tt=256})=>{const[rt,nt]=reactExports.useState(!1),ot=window.innerWidth<640,it=async()=>{await navigator.clipboard.writeText(et),nt(!0),setTimeout(()=>nt(!1),2e3)};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCodeSVG,{value:et,size:ot?Math.min(o*.8,window.innerWidth-64):Math.min(o,tt)}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 w-full max-w-[300px]",children:[jsxRuntimeExports.jsx("input",{type:"text",value:et,readOnly:!0,className:"flex-1 px-3 py-2 text-xs sm:text-sm border rounded-md bg-muted truncate"}),jsxRuntimeExports.jsx(Button,{variant:"outline",size:"icon",onClick:it,className:"shrink-0",children:rt?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(et,o=0){return(byteToHex[et[o+0]]+byteToHex[et[o+1]]+byteToHex[et[o+2]]+byteToHex[et[o+3]]+"-"+byteToHex[et[o+4]]+byteToHex[et[o+5]]+"-"+byteToHex[et[o+6]]+byteToHex[et[o+7]]+"-"+byteToHex[et[o+8]]+byteToHex[et[o+9]]+"-"+byteToHex[et[o+10]]+byteToHex[et[o+11]]+byteToHex[et[o+12]]+byteToHex[et[o+13]]+byteToHex[et[o+14]]+byteToHex[et[o+15]]).toLowerCase()}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native={randomUUID};function v4(et,o,tt){if(native.randomUUID&&!o&&!et)return native.randomUUID();et=et||{};var rt=et.random||(et.rng||rng)();return rt[6]=rt[6]&15|64,rt[8]=rt[8]&63|128,unsafeStringify(rt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(et,o){for(var tt=new Array(arguments.length-1),rt=0,nt=2,ot=!0;nt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),rt=new Array(123),nt=0;nt<64;)rt[tt[nt]=nt<26?nt+65:nt<52?nt+71:nt<62?nt-4:nt-59|43]=nt++;o.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,mt=0,ft;at>2],ft=(pt&3)<<4,mt=1;break;case 1:dt[ht++]=tt[ft|pt>>4],ft=(pt&15)<<2,mt=2;break;case 2:dt[ht++]=tt[ft|pt>>6],dt[ht++]=tt[pt&63],mt=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return mt&&(dt[ht++]=tt[ft],dt[ht++]=61,mt===1&&(dt[ht++]=61)),lt?(ht&<.push(String.fromCharCode.apply(String,dt.slice(0,ht))),lt.join("")):String.fromCharCode.apply(String,dt.slice(0,ht))};var ot="invalid encoding";o.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,mt=0;mt1)break;if((ft=rt[ft])===void 0)throw Error(ot);switch(dt){case 0:ht=ft,dt=1;break;case 1:at[ct++]=ht<<2|(ft&48)>>4,ht=ft,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(ft&60)>>2,ht=ft,dt=3;break;case 3:at[ct++]=(ht&3)<<6|ft,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},o.test=function(st){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(st)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(o,tt,rt){return(this._listeners[o]||(this._listeners[o]=[])).push({fn:tt,ctx:rt||this}),this};EventEmitter.prototype.off=function(o,tt){if(o===void 0)this._listeners={};else if(tt===void 0)this._listeners[o]=[];else for(var rt=this._listeners[o],nt=0;nt0?0:2147483648,ot,it);else if(isNaN(nt))rt(2143289344,ot,it);else if(nt>34028234663852886e22)rt((st<<31|2139095040)>>>0,ot,it);else if(nt<11754943508222875e-54)rt((st<<31|Math.round(nt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(nt)/Math.LN2),ct=Math.round(nt*Math.pow(2,-at)*8388608)&8388607;rt((st<<31|at+127<<23|ct)>>>0,ot,it)}}et.writeFloatLE=o.bind(null,writeUintLE),et.writeFloatBE=o.bind(null,writeUintBE);function tt(rt,nt,ot){var it=rt(nt,ot),st=(it>>31)*2+1,at=it>>>23&255,ct=it&8388607;return at===255?ct?NaN:st*(1/0):at===0?st*1401298464324817e-60*ct:st*Math.pow(2,at-150)*(ct+8388608)}et.readFloatLE=tt.bind(null,readUintLE),et.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var o=new Float64Array([-0]),tt=new Uint8Array(o.buffer),rt=tt[7]===128;function nt(at,ct,lt){o[0]=at,ct[lt]=tt[0],ct[lt+1]=tt[1],ct[lt+2]=tt[2],ct[lt+3]=tt[3],ct[lt+4]=tt[4],ct[lt+5]=tt[5],ct[lt+6]=tt[6],ct[lt+7]=tt[7]}function ot(at,ct,lt){o[0]=at,ct[lt]=tt[7],ct[lt+1]=tt[6],ct[lt+2]=tt[5],ct[lt+3]=tt[4],ct[lt+4]=tt[3],ct[lt+5]=tt[2],ct[lt+6]=tt[1],ct[lt+7]=tt[0]}et.writeDoubleLE=rt?nt:ot,et.writeDoubleBE=rt?ot:nt;function it(at,ct){return tt[0]=at[ct],tt[1]=at[ct+1],tt[2]=at[ct+2],tt[3]=at[ct+3],tt[4]=at[ct+4],tt[5]=at[ct+5],tt[6]=at[ct+6],tt[7]=at[ct+7],o[0]}function st(at,ct){return tt[7]=at[ct],tt[6]=at[ct+1],tt[5]=at[ct+2],tt[4]=at[ct+3],tt[3]=at[ct+4],tt[2]=at[ct+5],tt[1]=at[ct+6],tt[0]=at[ct+7],o[0]}et.readDoubleLE=rt?it:st,et.readDoubleBE=rt?st:it}():function(){function o(rt,nt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)rt(0,st,at+nt),rt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))rt(0,st,at+nt),rt(2146959360,st,at+ot);else if(it>17976931348623157e292)rt(0,st,at+nt),rt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,rt(lt>>>0,st,at+nt),rt((ct<<31|lt/4294967296)>>>0,st,at+ot);else{var dt=Math.floor(Math.log(it)/Math.LN2);dt===1024&&(dt=1023),lt=it*Math.pow(2,-dt),rt(lt*4503599627370496>>>0,st,at+nt),rt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}et.writeDoubleLE=o.bind(null,writeUintLE,0,4),et.writeDoubleBE=o.bind(null,writeUintBE,4,0);function tt(rt,nt,ot,it,st){var at=rt(it,st+nt),ct=rt(it,st+ot),lt=(ct>>31)*2+1,dt=ct>>>20&2047,ht=4294967296*(ct&1048575)+at;return dt===2047?ht?NaN:lt*(1/0):dt===0?lt*5e-324*ht:lt*Math.pow(2,dt-1075)*(ht+4503599627370496)}et.readDoubleLE=tt.bind(null,readUintLE,0,4),et.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),et}function writeUintLE(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}function writeUintBE(et,o,tt){o[tt]=et>>>24,o[tt+1]=et>>>16&255,o[tt+2]=et>>>8&255,o[tt+3]=et&255}function readUintLE(et,o){return(et[o]|et[o+1]<<8|et[o+2]<<16|et[o+3]<<24)>>>0}function readUintBE(et,o){return(et[o]<<24|et[o+1]<<16|et[o+2]<<8|et[o+3])>>>0}var inquire_1=inquire$1;function inquire$1(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(et){}return null}var utf8$2={};(function(et){var o=et;o.length=function(rt){for(var nt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|rt[nt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(rt[nt++]&63)<<12|(rt[nt++]&63)<<6|rt[nt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(rt[nt++]&63)<<6|rt[nt++]&63,ct>8191&&((st||(st=[])).push(String.fromCharCode.apply(String,at)),ct=0);return st?(ct&&st.push(String.fromCharCode.apply(String,at.slice(0,ct))),st.join("")):String.fromCharCode.apply(String,at.slice(0,ct))},o.write=function(rt,nt,ot){for(var it=ot,st,at,ct=0;ct>6|192,nt[ot++]=st&63|128):(st&64512)===55296&&((at=rt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,nt[ot++]=st>>18|240,nt[ot++]=st>>12&63|128,nt[ot++]=st>>6&63|128,nt[ot++]=st&63|128):(nt[ot++]=st>>12|224,nt[ot++]=st>>6&63|128,nt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(et,o,tt){var rt=tt||8192,nt=rt>>>1,ot=null,it=rt;return function(at){if(at<1||at>nt)return et(at);it+at>rt&&(ot=et(rt),it=0);var ct=o.call(ot,it,it+=at);return it&7&&(it=(it|7)+1),ct}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=o;var et=requireMinimal();function o(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=o.zero=new o(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var rt=o.zeroHash="\0\0\0\0\0\0\0\0";o.fromNumber=function(it){if(it===0)return tt;var st=it<0;st&&(it=-it);var at=it>>>0,ct=(it-at)/4294967296>>>0;return st&&(ct=~ct>>>0,at=~at>>>0,++at>4294967295&&(at=0,++ct>4294967295&&(ct=0))),new o(at,ct)},o.from=function(it){if(typeof it=="number")return o.fromNumber(it);if(et.isString(it))if(et.Long)it=et.Long.fromString(it);else return o.fromNumber(parseInt(it,10));return it.low||it.high?new o(it.low>>>0,it.high>>>0):tt},o.prototype.toNumber=function(it){if(!it&&this.hi>>>31){var st=~this.lo+1>>>0,at=~this.hi>>>0;return st||(at=at+1>>>0),-(st+at*4294967296)}return this.lo+this.hi*4294967296},o.prototype.toLong=function(it){return et.Long?new et.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var nt=String.prototype.charCodeAt;return o.fromHash=function(it){return it===rt?tt:new o((nt.call(it,0)|nt.call(it,1)<<8|nt.call(it,2)<<16|nt.call(it,3)<<24)>>>0,(nt.call(it,4)|nt.call(it,5)<<8|nt.call(it,6)<<16|nt.call(it,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var it=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^it)>>>0,this.lo=(this.lo<<1^it)>>>0,this},o.prototype.zzDecode=function(){var it=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^it)>>>0,this.hi=(this.hi>>>1^it)>>>0,this},o.prototype.length=function(){var it=this.lo,st=(this.lo>>>28|this.hi<<4)>>>0,at=this.hi>>>24;return at===0?st===0?it<16384?it<128?1:2:it<2097152?3:4:st<16384?st<128?5:6:st<2097152?7:8:at<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(et){var o=et;o.asPromise=aspromise,o.base64=base64$1,o.EventEmitter=eventemitter,o.float=float,o.inquire=inquire_1,o.utf8=utf8$2,o.pool=pool_1,o.LongBits=requireLongbits(),o.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),o.global=o.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,o.emptyArray=Object.freeze?Object.freeze([]):[],o.emptyObject=Object.freeze?Object.freeze({}):{},o.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},o.isString=function(ot){return typeof ot=="string"||ot instanceof String},o.isObject=function(ot){return ot&&typeof ot=="object"},o.isset=o.isSet=function(ot,it){var st=ot[it];return st!=null&&ot.hasOwnProperty(it)?typeof st!="object"||(Array.isArray(st)?st.length:Object.keys(st).length)>0:!1},o.Buffer=function(){try{var nt=o.inquire("buffer").Buffer;return nt.prototype.utf8Write?nt:null}catch{return null}}(),o._Buffer_from=null,o._Buffer_allocUnsafe=null,o.newBuffer=function(ot){return typeof ot=="number"?o.Buffer?o._Buffer_allocUnsafe(ot):new o.Array(ot):o.Buffer?o._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},o.Array=typeof Uint8Array<"u"?Uint8Array:Array,o.Long=o.global.dcodeIO&&o.global.dcodeIO.Long||o.global.Long||o.inquire("long"),o.key2Re=/^true|false|0|1$/,o.key32Re=/^-?(?:0|[1-9][0-9]*)$/,o.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,o.longToHash=function(ot){return ot?o.LongBits.from(ot).toHash():o.LongBits.zeroHash},o.longFromHash=function(ot,it){var st=o.LongBits.fromHash(ot);return o.Long?o.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(nt,ot,it){for(var st=Object.keys(ot),at=0;at-1;--ct)if(it[at[ct]]===1&&this[at[ct]]!==void 0&&this[at[ct]]!==null)return at[ct]}},o.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)o[tt++]=et&127|128,et>>>=7;o[tt]=et}function VarintOp(et,o){this.len=et,this.next=void 0,this.val=o}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function et(o){return this.len+=(this.tail=this.tail.next=new VarintOp((o=o>>>0)<128?1:o<16384?2:o<2097152?3:o<268435456?4:5,o)).len,this};Writer$1.prototype.int32=function et(o){return o<0?this._push(writeVarint64,10,LongBits$1.fromNumber(o)):this.uint32(o)};Writer$1.prototype.sint32=function et(o){return this.uint32((o<<1^o>>31)>>>0)};function writeVarint64(et,o,tt){for(;et.hi;)o[tt++]=et.lo&127|128,et.lo=(et.lo>>>7|et.hi<<25)>>>0,et.hi>>>=7;for(;et.lo>127;)o[tt++]=et.lo&127|128,et.lo=et.lo>>>7;o[tt++]=et.lo}Writer$1.prototype.uint64=function et(o){var tt=LongBits$1.from(o);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function et(o){var tt=LongBits$1.from(o).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function et(o){return this._push(writeByte,1,o?1:0)};function writeFixed32(et,o,tt){o[tt]=et&255,o[tt+1]=et>>>8&255,o[tt+2]=et>>>16&255,o[tt+3]=et>>>24}Writer$1.prototype.fixed32=function et(o){return this._push(writeFixed32,4,o>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function et(o){var tt=LongBits$1.from(o);return this._push(writeFixed32,4,tt.lo)._push(writeFixed32,4,tt.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function et(o){return this._push(util$7.float.writeFloatLE,4,o)};Writer$1.prototype.double=function et(o){return this._push(util$7.float.writeDoubleLE,8,o)};var writeBytes=util$7.Array.prototype.set?function et(o,tt,rt){tt.set(o,rt)}:function et(o,tt,rt){for(var nt=0;nt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(o)){var rt=Writer$1.alloc(tt=base64.length(o));base64.decode(o,rt,0),o=rt}return this.uint32(tt)._push(writeBytes,tt,o)};Writer$1.prototype.string=function et(o){var tt=utf8$1.length(o);return tt?this.uint32(tt)._push(utf8$1.write,tt,o):this._push(writeByte,1,0)};Writer$1.prototype.fork=function et(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function et(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function et(){var o=this.head,tt=this.tail,rt=this.len;return this.reset().uint32(rt),rt&&(this.tail.next=o.next,this.tail=tt,this.len+=rt),this};Writer$1.prototype.finish=function et(){for(var o=this.head.next,tt=this.constructor.alloc(this.len),rt=0;o;)o.fn(o.val,tt,rt),rt+=o.len,o=o.next;return tt};Writer$1._configure=function(et){BufferWriter$1=et,Writer$1.create=create$2(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$6=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$6._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$6.Buffer&&util$6.Buffer.prototype instanceof Uint8Array&&util$6.Buffer.prototype.set.name==="set"?function(o,tt,rt){tt.set(o,rt)}:function(o,tt,rt){if(o.copy)o.copy(tt,rt,0,o.length);else for(var nt=0;nt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,o),this};function writeStringBuffer(et,o,tt){et.length<40?util$6.utf8.write(et,o,tt):o.utf8Write?o.utf8Write(et,tt):o.write(et,tt)}BufferWriter.prototype.string=function et(o){var tt=util$6.Buffer.byteLength(o);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,o),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(et,o){return RangeError("index out of range: "+et.pos+" + "+(o||1)+" > "+et.len)}function Reader$1(et){this.buf=et,this.pos=0,this.len=et.length}var create_array=typeof Uint8Array<"u"?function et(o){if(o instanceof Uint8Array||Array.isArray(o))return new Reader$1(o);throw Error("illegal buffer")}:function et(o){if(Array.isArray(o))return new Reader$1(o);throw Error("illegal buffer")},create$1=function et(){return util$5.Buffer?function(tt){return(Reader$1.create=function(nt){return util$5.Buffer.isBuffer(nt)?new BufferReader$1(nt):create_array(nt)})(tt)}:create_array};Reader$1.create=create$1();Reader$1.prototype._slice=util$5.Array.prototype.subarray||util$5.Array.prototype.slice;Reader$1.prototype.uint32=function et(){var o=4294967295;return function(){if(o=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(o=(o|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(o=(o|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return o;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return o}}();Reader$1.prototype.int32=function et(){return this.uint32()|0};Reader$1.prototype.sint32=function et(){var o=this.uint32();return o>>>1^-(o&1)|0};function readLongVarint(){var et=new LongBits(0,0),o=0;if(this.len-this.pos>4){for(;o<4;++o)if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et;if(et.lo=(et.lo|(this.buf[this.pos]&127)<<28)>>>0,et.hi=(et.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return et;o=0}else{for(;o<3;++o){if(this.pos>=this.len)throw indexOutOfRange(this);if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}return et.lo=(et.lo|(this.buf[this.pos++]&127)<>>0,et}if(this.len-this.pos>4){for(;o<5;++o)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;o<5;++o){if(this.pos>=this.len)throw indexOutOfRange(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function et(){return this.uint32()!==0};function readFixed32_end(et,o){return(et[o-4]|et[o-3]<<8|et[o-2]<<16|et[o-1]<<24)>>>0}Reader$1.prototype.fixed32=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function et(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var o=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,o};Reader$1.prototype.double=function et(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var o=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,o};Reader$1.prototype.bytes=function et(){var o=this.uint32(),tt=this.pos,rt=this.pos+o;if(rt>this.len)throw indexOutOfRange(this,o);if(this.pos+=o,Array.isArray(this.buf))return this.buf.slice(tt,rt);if(tt===rt){var nt=util$5.Buffer;return nt?nt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,rt)};Reader$1.prototype.string=function et(){var o=this.bytes();return utf8.read(o,0,o.length)};Reader$1.prototype.skip=function et(o){if(typeof o=="number"){if(this.pos+o>this.len)throw indexOutOfRange(this,o);this.pos+=o}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(et){switch(et){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(et=this.uint32()&7)!==4;)this.skipType(et);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+et+" at offset "+this.pos)}return this};Reader$1._configure=function(et){BufferReader$1=et,Reader$1.create=create$1(),BufferReader$1._configure();var o=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[o](!1)},uint64:function(){return readLongVarint.call(this)[o](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[o](!1)},fixed64:function(){return readFixed64.call(this)[o](!0)},sfixed64:function(){return readFixed64.call(this)[o](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(et){Reader.call(this,et)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function et(){var o=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+o,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+o,this.len))};BufferReader._configure();var rpc={},service$1=Service$1,util$3=requireMinimal();(Service$1.prototype=Object.create(util$3.EventEmitter.prototype)).constructor=Service$1;function Service$1(et,o,tt){if(typeof et!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=et,this.requestDelimited=!!o,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function et(o,tt,rt,nt,ot){if(!nt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(et,it,o,tt,rt,nt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(o,tt[it.requestDelimited?"encodeDelimited":"encode"](nt).finish(),function(at,ct){if(at)return it.emit("error",at,o),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof rt))try{ct=rt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,o),ot(lt)}return it.emit("data",ct,o),ot(null,ct)})}catch(st){it.emit("error",st,o),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function et(o){return this.rpcImpl&&(o||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(et){var o=et;o.Service=service$1})(rpc);var roots={};(function(et){var o=et;o.build="minimal",o.Writer=writer,o.BufferWriter=writer_buffer,o.Reader=reader,o.BufferReader=reader_buffer,o.util=requireMinimal(),o.rpc=rpc,o.roots=roots,o.configure=tt;function tt(){o.util._configure(),o.Writer._configure(o.BufferWriter),o.Reader._configure(o.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(et,o){typeof et=="string"&&(o=et,et=void 0);var tt=[];function rt(ot){if(typeof ot!="string"){var it=nt();if(codegen.verbose&&console.log("codegen: "+it),it="return "+it,ot){for(var st=Object.keys(ot),at=new Array(st.length+1),ct=new Array(st.length),lt=0;lt0&&it[ct-1]!==".."?it.splice(--ct,2):st?it.splice(ct,1):++ct:it[ct]==="."?it.splice(ct,1):++ct;return at+it.join("/")};o.resolve=function(ot,it,st){return st||(it=rt(it)),tt(it)?it:(st||(ot=rt(ot)),(ot=ot.replace(/(?:\/|^)[^/]+$/,"")).length?rt(ot+"/"+it):it)}})(path);var types$2={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(et){var o=et,tt=requireUtil(),rt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function nt(ot,it){var st=0,at={};for(it|=0;st-1&&this.oneof.splice(st,1),it.partOf=null,this},rt.prototype.onAdd=function(it){et.prototype.onAdd.call(this,it);for(var st=this,at=0;atht)return!0}return!1},at.isReservedName=function(dt,ht){if(dt){for(var mt=0;mt0;){var ft=dt.shift();if(mt.nested&&mt.nested[ft]){if(mt=mt.nested[ft],!(mt instanceof at))throw Error("path conflicts with non-namespace objects")}else mt.add(mt=new at(ft))}return ht&&mt.addJSON(ht),mt},at.prototype.resolveAll=function(){for(var dt=this.nestedArray,ht=0;ht-1)return ft}else if(ft instanceof at&&(ft=ft.lookup(dt.slice(1),ht,!0)))return ft}else for(var pt=0;pt>>3){");for(var st=0;st>>3){")("case 1: k=r.%s(); break",at.keyType)("case 2:"),o.basic[ct]===void 0?it("value=types[%i].decode(r,r.uint32())",st):it("value=r.%s()",ct),it("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),o.long[at.keyType]!==void 0?it('%s[typeof k==="object"?util.longToHash(k):k]=value',lt):it("%s[k]=value",lt)):at.repeated?(it("if(!(%s&&%s.length))",lt,lt)("%s=[]",lt),o.packed[ct]!==void 0&&it("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",ct,ct);break;case"int32":case"sint32":case"sfixed32":it("m%s=d%s|0",ct,ct);break;case"uint64":ft=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":it("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",ct,ct,ft)('else if(typeof d%s==="string")',ct)("m%s=parseInt(d%s,10)",ct,ct)('else if(typeof d%s==="number")',ct)("m%s=d%s",ct,ct)('else if(typeof d%s==="object")',ct)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",ct,ct,ct,ft?"true":"");break;case"bytes":it('if(typeof d%s==="string")',ct)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",ct,ct,ct)("else if(d%s.length >= 0)",ct)("m%s=d%s",ct,ct);break;case"string":it("m%s=String(d%s)",ct,ct);break;case"bool":it("m%s=Boolean(d%s)",ct,ct);break}}return it}o.fromObject=function(st){var at=st.fieldsArray,ct=rt.codegen(["d"],st.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!at.length)return ct("return new this.ctor");ct("var m=new this.ctor");for(var lt=0;lt>>0,m%s.high>>>0).toNumber(%s):m%s",ct,ct,ct,ct,lt?"true":"",ct);break;case"bytes":it("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",ct,ct,ct,ct,ct);break;default:it("d%s=m%s",ct,ct);break}}return it}o.toObject=function(st){var at=st.fieldsArray.slice().sort(rt.compareFieldsById);if(!at.length)return rt.codegen()("return {}");for(var ct=rt.codegen(["m","o"],st.name+"$toObject")("if(!o)")("o={}")("var d={}"),lt=[],dt=[],ht=[],mt=0;mt-1){var Nt=kt.substring(It);if(Nt in st)return Nt}return null}function vt(kt,It){try{if(nt.isString(It)&&It.charAt(0)==="{"&&(It=JSON.parse(It)),!nt.isString(It))yt.setOptions(It.options).addJSON(It.nested);else{it.filename=kt;var Nt=it(It,yt,ft),Lt,Mt=0;if(Nt.imports)for(;Mt-1)){if(yt.files.push(kt),kt in st){gt?vt(kt,st[kt]):(++Ct,setTimeout(function(){--Ct,vt(kt,st[kt])}));return}if(gt){var Nt;try{Nt=nt.fs.readFileSync(kt).toString("utf8")}catch(Lt){It||bt(Lt);return}vt(kt,Nt)}else++Ct,yt.fetch(kt,function(Lt,Mt){if(--Ct,!!pt){if(Lt){It?Ct||bt(null,yt):bt(Lt);return}vt(kt,Mt)}})}}var Ct=0;nt.isString(mt)&&(mt=[mt]);for(var St=0,At;St-1&&this.deferred.splice(ft,1)}}else if(mt instanceof tt)lt.test(mt.name)&&delete mt.parent[mt.name];else if(mt instanceof et){for(var pt=0;pt0)mt[yt]=ht(mt[yt]||{},ft,pt);else{var gt=mt[yt];gt&&(pt=[].concat(gt).concat(pt)),mt[yt]=pt}return mt}if(typeof ct!="object")throw TypeError("dst must be an object");if(!lt)throw TypeError("path must be specified");return lt=lt.split("."),ht(ct,lt,dt)},Object.defineProperty(et,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(requireRoot()))}}),util$2.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=tt,tt.className="ReflectionObject";var et=requireUtil(),o;function tt(rt,nt){if(!et.isString(rt))throw TypeError("name must be a string");if(nt&&!et.isObject(nt))throw TypeError("options must be an object");this.options=nt,this.parsedOptions=null,this.name=rt,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(tt.prototype,{root:{get:function(){for(var rt=this;rt.parent!==null;)rt=rt.parent;return rt}},fullName:{get:function(){for(var rt=[this.name],nt=this.parent;nt;)rt.unshift(nt.name),nt=nt.parent;return rt.join(".")}}}),tt.prototype.toJSON=function(){throw Error()},tt.prototype.onAdd=function(nt){this.parent&&this.parent!==nt&&this.parent.remove(this),this.parent=nt,this.resolved=!1;var ot=nt.root;ot instanceof o&&ot._handleAdd(this)},tt.prototype.onRemove=function(nt){var ot=nt.root;ot instanceof o&&ot._handleRemove(this),this.parent=null,this.resolved=!1},tt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof o&&(this.resolved=!0),this)},tt.prototype.getOption=function(nt){if(this.options)return this.options[nt]},tt.prototype.setOption=function(nt,ot,it){return(!it||!this.options||this.options[nt]===void 0)&&((this.options||(this.options={}))[nt]=ot),this},tt.prototype.setParsedOption=function(nt,ot,it){this.parsedOptions||(this.parsedOptions=[]);var st=this.parsedOptions;if(it){var at=st.find(function(dt){return Object.prototype.hasOwnProperty.call(dt,nt)});if(at){var ct=at[nt];et.setProperty(ct,it,ot)}else at={},at[nt]=et.setProperty({},it,ot),st.push(at)}else{var lt={};lt[nt]=ot,st.push(lt)}return this},tt.prototype.setOptions=function(nt,ot){if(nt)for(var it=Object.keys(nt),st=0;st>>0,(it.id<<3|4)>>>0):ot("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",st,at,(it.id<<3|2)>>>0)}function nt(ot){for(var it=tt.codegen(["m","w"],ot.name+"$encode")("if(!w)")("w=Writer.create()"),st,at,ct=ot.fieldsArray.slice().sort(tt.compareFieldsById),st=0;st>>0,8|o.mapKey[lt.keyType],lt.keyType),mt===void 0?it("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",dt,at):it(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|mt,ht,at),it("}")("}")):lt.repeated?(it("if(%s!=null&&%s.length){",at,at),lt.packed&&o.packed[ht]!==void 0?it("w.uint32(%i).fork()",(lt.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",at)("w.%s(%s[i])",ht,at)("w.ldelim()"):(it("for(var i=0;i<%s.length;++i)",at),mt===void 0?rt(it,lt,dt,at+"[i]"):it("w.uint32(%i).%s(%s[i])",(lt.id<<3|mt)>>>0,ht,at)),it("}")):(lt.optional&&it("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",at,lt.name),mt===void 0?rt(it,lt,dt,at):it("w.uint32(%i).%s(%s)",(lt.id<<3|mt)>>>0,ht,at))}return it("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(et,o,tt){return typeof o=="function"?(tt=o,o=new protobuf$2.Root):o||(o=new protobuf$2.Root),o.load(et,tt)}protobuf$2.load=load;function loadSync(et,o){return o||(o=new protobuf$2.Root),o.loadSync(et)}protobuf$2.loadSync=loadSync;protobuf$2.encoder=requireEncoder();protobuf$2.decoder=requireDecoder();protobuf$2.verifier=requireVerifier();protobuf$2.converter=requireConverter();protobuf$2.ReflectionObject=requireObject();protobuf$2.Namespace=requireNamespace();protobuf$2.Root=requireRoot();protobuf$2.Enum=require_enum();protobuf$2.Type=requireType();protobuf$2.Field=requireField();protobuf$2.OneOf=requireOneof();protobuf$2.MapField=requireMapfield();protobuf$2.Service=requireService();protobuf$2.Method=requireMethod();protobuf$2.Message=message;protobuf$2.wrappers=wrappers;protobuf$2.types=requireTypes();protobuf$2.util=requireUtil();protobuf$2.ReflectionObject._configure(protobuf$2.Root);protobuf$2.Namespace._configure(protobuf$2.Type,protobuf$2.Service,protobuf$2.Enum);protobuf$2.Root._configure(protobuf$2.Type);protobuf$2.Field._configure(protobuf$2.Type);var indexLightExports=indexLight.exports,tokenize_1=tokenize$1,delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:` @@ -4144,19 +4144,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${o.do `;)Et++;return Et}function pt(){if(st.length>0)return st.shift();if(at)return lt();var vt,Et,Ct,St,At,kt=tt===0;do{if(tt===rt)return null;for(vt=!1;whitespaceRe.test(Ct=dt(tt));)if(Ct===` `&&(kt=!0,++nt),++tt===rt)return null;if(dt(tt)==="/"){if(++tt===rt)throw ct("comment");if(dt(tt)==="/")if(o){if(St=tt,At=!1,mt(tt-1)){At=!0;do if(tt=ft(tt),tt===rt||(tt++,!kt))break;while(mt(tt))}else tt=Math.min(rt,ft(tt)+1);At&&(ht(St,tt,kt),kt=!0),nt++,vt=!0}else{for(At=dt(St=tt+1)==="/";dt(++tt)!==` `;)if(tt===rt)return null;++tt,At&&(ht(St,tt-1,kt),kt=!0),++nt,vt=!0}else if((Ct=dt(tt))==="*"){St=tt+1,At=o||dt(St)==="*";do{if(Ct===` -`&&++nt,++tt===rt)throw ct("comment");Et=Ct,Ct=dt(tt)}while(Et!=="*"||Ct!=="/");++tt,At&&(ht(St,tt-2,kt),kt=!0),vt=!0}else return"/"}}while(vt);var It=tt;delimRe.lastIndex=0;var Nt=delimRe.test(dt(It++));if(!Nt)for(;It");var Bt=ot();if(!nameRe$1.test(Bt))throw bt(Bt,"name");at("=");var Vt=new MapField(gt(Bt),St(ot()),tr,_t);Lt(Vt,function(ar){if(ar==="option")Pt(Vt,ar),at(";");else throw bt(ar)},function(){Gt(Vt)}),Jt.add(Vt)}function Wt(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var _t=new OneOf(gt(tr));Lt(_t,function(Vt){Vt==="option"?(Pt(_t,Vt),at(";")):(it(Vt),zt(_t,"optional"))}),Jt.add(_t)}function Ft(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var _t=new Enum(tr);Lt(_t,function(Vt){switch(Vt){case"option":Pt(_t,Vt),at(";");break;case"reserved":Et(_t.reserved||(_t.reserved=[]),!0);break;default:qt(_t,Vt)}}),Jt.add(_t)}function qt(Jt,tr){if(!nameRe$1.test(tr))throw bt(tr,"name");at("=");var _t=St(ot(),!0),Bt={options:void 0};Bt.setOption=function(Vt,er){this.options===void 0&&(this.options={}),this.options[Vt]=er},Lt(Bt,function(er){if(er==="option")Pt(Bt,er),at(";");else throw bt(er)},function(){Gt(Bt)}),Jt.add(tr,_t,Bt.comment,Bt.options)}function Pt(Jt,tr){var _t=at("(",!0);if(!typeRefRe.test(tr=ot()))throw bt(tr,"name");var Bt=tr,Vt=Bt,er;_t&&(at(")"),Bt="("+Bt+")",Vt=Bt,tr=st(),fqTypeRefRe.test(tr)&&(er=tr.slice(1),Bt+=tr,ot())),at("=");var ar=Yt(Jt,Bt);jt(Jt,Vt,ar,er)}function Yt(Jt,tr){if(at("{",!0)){for(var _t={};!at("}",!0);){if(!nameRe$1.test(Zt=ot()))throw bt(Zt,"name");if(Zt===null)throw bt(Zt,"end of input");var Bt,Vt=Zt;if(at(":",!0),st()==="{")Bt=Yt(Jt,tr+"."+Zt);else if(st()==="["){Bt=[];var er;if(at("[",!0)){do er=vt(),Bt.push(er);while(at(",",!0));at("]"),typeof er<"u"&&Qt(Jt,tr+"."+Zt,er)}}else Bt=vt(),Qt(Jt,tr+"."+Zt,Bt);var ar=_t[Vt];ar&&(Bt=[].concat(ar).concat(Bt)),_t[Vt]=Bt,at(",",!0),at(";",!0)}return _t}var ur=vt();return Qt(Jt,tr,ur),ur}function Qt(Jt,tr,_t){Jt.setOption&&Jt.setOption(tr,_t)}function jt(Jt,tr,_t,Bt){Jt.setParsedOption&&Jt.setParsedOption(tr,_t,Bt)}function Gt(Jt){if(at("[",!0)){do Pt(Jt,"option");while(at(",",!0));at("]")}return Jt}function rr(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"service name");var _t=new Service(tr);Lt(_t,function(Vt){if(!Nt(_t,Vt))if(Vt==="rpc")Ht(_t,Vt);else throw bt(Vt)}),Jt.add(_t)}function Ht(Jt,tr){var _t=ct(),Bt=tr;if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var Vt=tr,er,ar,ur,cr;if(at("("),at("stream",!0)&&(ar=!0),!typeRefRe.test(tr=ot())||(er=tr,at(")"),at("returns"),at("("),at("stream",!0)&&(cr=!0),!typeRefRe.test(tr=ot())))throw bt(tr);ur=tr,at(")");var hr=new Method(Vt,Bt,er,ur,ar,cr);hr.comment=_t,Lt(hr,function(pr){if(pr==="option")Pt(hr,pr),at(";");else throw bt(pr)}),Jt.add(hr)}function dr(Jt,tr){if(!typeRefRe.test(tr=ot()))throw bt(tr,"reference");var _t=tr;Lt(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,_t);break;case"optional":pt?zt(Jt,"proto3_optional",_t):zt(Jt,"optional",_t);break;default:if(!pt||!typeRefRe.test(Vt))throw bt(Vt);it(Vt),zt(Jt,"optional",_t);break}})}for(var Zt;(Zt=ot())!==null;)switch(Zt){case"package":if(!lt)throw bt(Zt);At();break;case"import":if(!lt)throw bt(Zt);kt();break;case"syntax":if(!lt)throw bt(Zt);It();break;case"option":Pt(yt,Zt),at(";");break;default:if(Nt(yt,Zt)){lt=!1;continue}throw bt(Zt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:mt,syntax:ft,root:o}}var common_1=common,commonRe=/\/|\./;function common(et,o){commonRe.test(et)||(et="google/protobuf/"+et+".proto",o={nested:{google:{nested:{protobuf:{nested:o}}}}}),common[et]=o}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function et(o){return common[o]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs),contentTopic="/buddybook-dogfood/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:et,blockUUID:o,title:tt,description:rt,signedMessage:nt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:et,blockUUID:o,title:tt,description:rt,signedMessage:nt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(et){console.time("getMessagesFromStore");for await(const o of et.store.queryGenerator([decoder])){const tt=await Promise.all(o);for(const rt of tt){if(console.log(rt),!(rt!=null&&rt.payload))continue;const nt=block.decode(rt.payload);nt.signatures=nt.signatures.map(ot=>JSON.parse(ot)),yield nt}}console.timeEnd("getMessagesFromStore")}async function subscribeToFilter(et,o){const{error:tt,subscription:rt,results:nt}=await et.filter.subscribe([decoder],ot=>{if(console.log("message received from filter",ot),ot.payload){const it=block.decode(ot.payload);it.signatures=it.signatures.map(st=>JSON.parse(st)),o(it)}},{forceUseAllPeers:!0});if(console.log("results",nt),tt&&console.log("Error subscribing to filter",tt),!rt||tt||nt.successes.length===0||nt.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:et}=useAccount(),{connect:o,connectors:tt}=useConnect$1();return{ensureWalletConnected:()=>{if(!et){const nt=tt[0];return nt&&o({connector:nt}),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[et,o]=reactExports.useState(DEFAULT_FORM_DATA),[tt,rt]=reactExports.useState({}),[nt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,mt]=reactExports.useState(null),[ft,pt]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:bt}=useSignMessage({mutation:{async onSuccess(kt){if(!gt||!yt)return;mt(kt);const It=v4();pt(It);const Nt=createMessage({chainUUID:et.uuid,blockUUID:It,title:et.title,description:et.description,signedMessage:kt,timestamp:Date.now(),signatures:[{address:gt,signature:kt}],parentBlockUUID:null});await(yt==null?void 0:yt.lightPush.send(encoder,Nt)),ct(!0),st(!1)},onError(kt){console.error("Error signing message:",kt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:xt}=useWalletPrompt(),vt=kt=>{const{name:It,value:Nt}=kt.target;o(Lt=>({...Lt,[It]:Nt})),tt[It]&&rt(Lt=>({...Lt,[It]:void 0}))},Et=()=>{const kt={};return et.title.trim()||(kt.title="Title is required"),et.description.trim()||(kt.description="Description is required"),rt(kt),Object.keys(kt).length===0},Ct=kt=>{kt.preventDefault(),xt()&&Et()&&ot(!0)},St=async()=>{st(!0),dt(null);const kt=`Create Chain: +`&&++nt,++tt===rt)throw ct("comment");Et=Ct,Ct=dt(tt)}while(Et!=="*"||Ct!=="/");++tt,At&&(ht(St,tt-2,kt),kt=!0),vt=!0}else return"/"}}while(vt);var It=tt;delimRe.lastIndex=0;var Nt=delimRe.test(dt(It++));if(!Nt)for(;It");var Bt=ot();if(!nameRe$1.test(Bt))throw bt(Bt,"name");at("=");var Vt=new MapField(gt(Bt),St(ot()),tr,_t);Lt(Vt,function(ar){if(ar==="option")Pt(Vt,ar),at(";");else throw bt(ar)},function(){Gt(Vt)}),Jt.add(Vt)}function Wt(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var _t=new OneOf(gt(tr));Lt(_t,function(Vt){Vt==="option"?(Pt(_t,Vt),at(";")):(it(Vt),zt(_t,"optional"))}),Jt.add(_t)}function Ft(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var _t=new Enum(tr);Lt(_t,function(Vt){switch(Vt){case"option":Pt(_t,Vt),at(";");break;case"reserved":Et(_t.reserved||(_t.reserved=[]),!0);break;default:qt(_t,Vt)}}),Jt.add(_t)}function qt(Jt,tr){if(!nameRe$1.test(tr))throw bt(tr,"name");at("=");var _t=St(ot(),!0),Bt={options:void 0};Bt.setOption=function(Vt,er){this.options===void 0&&(this.options={}),this.options[Vt]=er},Lt(Bt,function(er){if(er==="option")Pt(Bt,er),at(";");else throw bt(er)},function(){Gt(Bt)}),Jt.add(tr,_t,Bt.comment,Bt.options)}function Pt(Jt,tr){var _t=at("(",!0);if(!typeRefRe.test(tr=ot()))throw bt(tr,"name");var Bt=tr,Vt=Bt,er;_t&&(at(")"),Bt="("+Bt+")",Vt=Bt,tr=st(),fqTypeRefRe.test(tr)&&(er=tr.slice(1),Bt+=tr,ot())),at("=");var ar=Yt(Jt,Bt);jt(Jt,Vt,ar,er)}function Yt(Jt,tr){if(at("{",!0)){for(var _t={};!at("}",!0);){if(!nameRe$1.test(Zt=ot()))throw bt(Zt,"name");if(Zt===null)throw bt(Zt,"end of input");var Bt,Vt=Zt;if(at(":",!0),st()==="{")Bt=Yt(Jt,tr+"."+Zt);else if(st()==="["){Bt=[];var er;if(at("[",!0)){do er=vt(),Bt.push(er);while(at(",",!0));at("]"),typeof er<"u"&&Qt(Jt,tr+"."+Zt,er)}}else Bt=vt(),Qt(Jt,tr+"."+Zt,Bt);var ar=_t[Vt];ar&&(Bt=[].concat(ar).concat(Bt)),_t[Vt]=Bt,at(",",!0),at(";",!0)}return _t}var ur=vt();return Qt(Jt,tr,ur),ur}function Qt(Jt,tr,_t){Jt.setOption&&Jt.setOption(tr,_t)}function jt(Jt,tr,_t,Bt){Jt.setParsedOption&&Jt.setParsedOption(tr,_t,Bt)}function Gt(Jt){if(at("[",!0)){do Pt(Jt,"option");while(at(",",!0));at("]")}return Jt}function rr(Jt,tr){if(!nameRe$1.test(tr=ot()))throw bt(tr,"service name");var _t=new Service(tr);Lt(_t,function(Vt){if(!Nt(_t,Vt))if(Vt==="rpc")Ht(_t,Vt);else throw bt(Vt)}),Jt.add(_t)}function Ht(Jt,tr){var _t=ct(),Bt=tr;if(!nameRe$1.test(tr=ot()))throw bt(tr,"name");var Vt=tr,er,ar,ur,cr;if(at("("),at("stream",!0)&&(ar=!0),!typeRefRe.test(tr=ot())||(er=tr,at(")"),at("returns"),at("("),at("stream",!0)&&(cr=!0),!typeRefRe.test(tr=ot())))throw bt(tr);ur=tr,at(")");var hr=new Method(Vt,Bt,er,ur,ar,cr);hr.comment=_t,Lt(hr,function(pr){if(pr==="option")Pt(hr,pr),at(";");else throw bt(pr)}),Jt.add(hr)}function dr(Jt,tr){if(!typeRefRe.test(tr=ot()))throw bt(tr,"reference");var _t=tr;Lt(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,_t);break;case"optional":pt?zt(Jt,"proto3_optional",_t):zt(Jt,"optional",_t);break;default:if(!pt||!typeRefRe.test(Vt))throw bt(Vt);it(Vt),zt(Jt,"optional",_t);break}})}for(var Zt;(Zt=ot())!==null;)switch(Zt){case"package":if(!lt)throw bt(Zt);At();break;case"import":if(!lt)throw bt(Zt);kt();break;case"syntax":if(!lt)throw bt(Zt);It();break;case"option":Pt(yt,Zt),at(";");break;default:if(Nt(yt,Zt)){lt=!1;continue}throw bt(Zt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:mt,syntax:ft,root:o}}var common_1=common,commonRe=/\/|\./;function common(et,o){commonRe.test(et)||(et="google/protobuf/"+et+".proto",o={nested:{google:{nested:{protobuf:{nested:o}}}}}),common[et]=o}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function et(o){return common[o]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs),contentTopic="/buddybook-dogfood/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:et,blockUUID:o,title:tt,description:rt,signedMessage:nt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:et,blockUUID:o,title:tt,description:rt,signedMessage:nt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(et){console.time("getMessagesFromStore");for await(const o of et.store.queryGenerator([decoder])){const tt=await Promise.all(o);for(const rt of tt){if(console.log(rt),!(rt!=null&&rt.payload))continue;const nt=block.decode(rt.payload);nt.signatures=nt.signatures.map(ot=>JSON.parse(ot)),yield nt}}console.timeEnd("getMessagesFromStore")}async function subscribeToFilter(et,o){const{error:tt,subscription:rt,results:nt}=await et.filter.subscribe([decoder],ot=>{if(console.log("message received from filter",ot),ot.payload){const it=block.decode(ot.payload);it.signatures=it.signatures.map(st=>JSON.parse(st)),o(it)}},{forceUseAllPeers:!0});if(console.log("results",nt),tt&&console.log("Error subscribing to filter",tt),!rt||tt||nt.successes.length===0||nt.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:et}=useAccount(),{connect:o,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!et)try{const nt=tt[0];return nt&&await o({connector:nt}),await new Promise(ot=>setTimeout(ot,1e3)),!0}catch(nt){return console.error("Error connecting wallet:",nt),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[et,o]=reactExports.useState(DEFAULT_FORM_DATA),[tt,rt]=reactExports.useState({}),[nt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,mt]=reactExports.useState(null),[ft,pt]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:bt}=useSignMessage({mutation:{async onSuccess(kt){if(!gt||!yt)return;mt(kt);const It=v4();pt(It);const Nt=createMessage({chainUUID:et.uuid,blockUUID:It,title:et.title,description:et.description,signedMessage:kt,timestamp:Date.now(),signatures:[{address:gt,signature:kt}],parentBlockUUID:null});await(yt==null?void 0:yt.lightPush.send(encoder,Nt)),ct(!0),st(!1)},onError(kt){console.error("Error signing message:",kt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:xt}=useWalletPrompt(),vt=kt=>{const{name:It,value:Nt}=kt.target;o(Lt=>({...Lt,[It]:Nt})),tt[It]&&rt(Lt=>({...Lt,[It]:void 0}))},Et=()=>{const kt={};return et.title.trim()||(kt.title="Title is required"),et.description.trim()||(kt.description="Description is required"),rt(kt),Object.keys(kt).length===0},Ct=kt=>{kt.preventDefault(),xt()&&Et()&&ot(!0)},St=async()=>{st(!0),dt(null);const kt=`Create Chain: Chain UUID: ${et.uuid} Title: ${et.title} Description: ${et.description} Timestamp: ${new Date().getTime()} - Signed by: ${gt}`;bt({message:kt})},At=()=>{ot(!1),ct(!1),st(!1),dt(null),pt(null)};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Create a New Chain"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:Ct,className:"space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"title",children:"Chain Title"}),jsxRuntimeExports.jsx(Input,{type:"text",id:"title",name:"title",value:et.title,onChange:vt,maxLength:50}),tt.title&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.title})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"description",children:"Chain Description"}),jsxRuntimeExports.jsx(Textarea,{id:"description",name:"description",value:et.description,onChange:vt,maxLength:500}),tt.description&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.description})]}),jsxRuntimeExports.jsx(Button,{type:"submit",className:"w-full",children:"Create Chain"})]})}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:At,children:jsxRuntimeExports.jsxs(DialogContent,{children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Chain Created":"Chain Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&ft&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${et.uuid}/${ft}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/sign/${et.uuid}/${ft}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/sign/${et.uuid}/${ft}`),variant:"outline",children:"Copy Link"})]})})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-semibold",children:et.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:et.description}),lt&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:lt})]}),jsxRuntimeExports.jsxs(DialogFooter,{className:"sm:justify-start",children:[jsxRuntimeExports.jsx(Button,{type:"button",variant:"secondary",onClick:At,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:St,disabled:it,children:it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):"Sign"})]})]})]})})]})},SignChain=({block:et,chainsData:o,onSuccess:tt})=>{const[rt,nt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),{address:dt}=useAccount(),{data:ht}=useEnsName({address:dt}),{node:mt}=useWaku(),{ensureWalletConnected:ft}=useWalletPrompt();reactExports.useEffect(()=>{if(dt){const gt=xt=>{if(xt.signatures.some(Ct=>Ct.address.toLowerCase()===dt.toLowerCase()))return!0;const vt=o.find(Ct=>Ct.blockUUID===xt.parentBlockUUID);return vt&>(vt)?!0:o.filter(Ct=>Ct.parentBlockUUID===xt.blockUUID).some(Ct=>gt(Ct))},bt=gt(et);lt(bt)}},[dt,et,o]);const{signMessage:pt}=useSignMessage({mutation:{async onSuccess(gt){if(!dt||!mt)return;if(et.signatures.some(xt=>xt.address.toLowerCase()===dt.toLowerCase())){at("You have already signed this chain."),it(!1);return}const bt={chainUUID:et.chainUUID,blockUUID:v4(),title:et.title,description:et.description,signedMessage:gt,timestamp:Date.now(),signatures:[{address:dt,signature:gt}],parentBlockUUID:et.blockUUID};try{const xt=createMessage(bt),{failures:vt,successes:Et}=await mt.lightPush.send(encoder,xt);if(vt.length>0||Et.length===0)throw new Error("Failed to send message to Waku network");tt(bt),nt(!1)}catch(xt){console.error("Error creating new block:",xt),at("Failed to create new block. Please try again.")}finally{it(!1)}},onError(gt){console.error("Error signing message:",gt),at("Error signing message. Please try again."),it(!1)}}}),yt=()=>{if(!ft())return;if(ct){at("You have already signed this chain.");return}it(!0),at(null);const gt=`Sign Block: - Chain UUID: ${et.chainUUID} - Block UUID: ${et.blockUUID} - Title: ${et.title} - Description: ${et.description} - Timestamp: ${new Date().getTime()} - Parent Block UUID: ${et.parentBlockUUID} - Signed by: ${ht||dt}`;pt({message:gt})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>nt(!0),disabled:ct,children:ct?"Already Signed":"Sign Chain"}),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":"Sign"})]})]})})]})},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}/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: ${gt}`;bt({message:kt})},At=()=>{ot(!1),ct(!1),st(!1),dt(null),pt(null)};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Create a New Chain"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:Ct,className:"space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"title",children:"Chain Title"}),jsxRuntimeExports.jsx(Input,{type:"text",id:"title",name:"title",value:et.title,onChange:vt,maxLength:50,className:"text-base sm:text-sm"}),tt.title&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.title})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"description",children:"Chain Description"}),jsxRuntimeExports.jsx(Textarea,{id:"description",name:"description",value:et.description,onChange:vt,maxLength:500,className:"min-h-[100px] text-base sm:text-sm"}),tt.description&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.description})]}),jsxRuntimeExports.jsx(Button,{type:"submit",className:"w-full py-6 text-base sm:py-2 sm:text-sm",children:"Create Chain"})]})}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:At,children:jsxRuntimeExports.jsxs(DialogContent,{children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Chain Created":"Chain Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&ft&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/buddybook/sign/${et.uuid}/${ft}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/buddybook/sign/${et.uuid}/${ft}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/buddybook/sign/${et.uuid}/${ft}`),variant:"outline",children:"Copy Link"})]})})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-semibold",children:et.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:et.description}),lt&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:lt})]}),jsxRuntimeExports.jsxs(DialogFooter,{className:"sm:justify-start",children:[jsxRuntimeExports.jsx(Button,{type:"button",variant:"secondary",onClick:At,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:St,disabled:it,children:it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):"Sign"})]})]})]})})]})},SignChain=({block:et,chainsData:o,onSuccess:tt})=>{const[rt,nt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),{address:dt}=useAccount(),{data:ht}=useEnsName({address:dt}),{node:mt}=useWaku(),{ensureWalletConnected:ft}=useWalletPrompt();reactExports.useEffect(()=>{if(dt){const gt=xt=>{if(xt.signatures.some(Ct=>Ct.address.toLowerCase()===dt.toLowerCase()))return!0;const vt=o.find(Ct=>Ct.blockUUID===xt.parentBlockUUID);return vt&>(vt)?!0:o.filter(Ct=>Ct.parentBlockUUID===xt.blockUUID).some(Ct=>gt(Ct))},bt=gt(et);lt(bt)}},[dt,et,o]);const{signMessage:pt}=useSignMessage({mutation:{onMutate(){at(null),it(!0)},async onSuccess(gt){if(!(!dt||!mt))try{if(et.signatures.some(Ct=>Ct.address.toLowerCase()===dt.toLowerCase())){at("You have already signed this chain.");return}const bt={chainUUID:et.chainUUID,blockUUID:v4(),title:et.title,description:et.description,signedMessage:gt,timestamp:Date.now(),signatures:[{address:dt,signature:gt}],parentBlockUUID:et.blockUUID},xt=createMessage(bt),{failures:vt,successes:Et}=await mt.lightPush.send(encoder,xt);if(vt.length>0||Et.length===0)throw new Error("Failed to send message to Waku network");tt(bt),nt(!1)}catch(bt){console.error("Error creating new block:",bt),at("Failed to create new block. Please try again.")}},onError(gt){console.error("Error signing message:",gt),at("Error signing message. Please try again. If using a mobile wallet, please ensure your wallet app is open.")},onSettled(){it(!1)}}}),yt=async()=>{try{if(!dt&&!await ft())return;if(ct){at("You have already signed this chain.");return}const gt=`Sign Block: +Chain UUID: ${et.chainUUID} +Block UUID: ${et.blockUUID} +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:` [data-radix-scroll-area-viewport] { scrollbar-width: none; -ms-overflow-style: none; @@ -4269,4 +4269,4 @@ This document is licensed under CC-BY-SA. `});++rt0&&tt.push({type:"text",value:` `}),tt}function trimMarkdownSpaceStart(et){let o=0,tt=et.charCodeAt(o);for(;tt===9||tt===32;)o++,tt=et.charCodeAt(o);return et.slice(o)}function toHast(et,o){const tt=createState(et,o),rt=tt.one(et,void 0),nt=footer(tt),ot=Array.isArray(rt)?{type:"root",children:rt}:rt||{type:"root",children:[]};return nt&&ot.children.push({type:"text",value:` -`},nt),ot}function remarkRehype(et,o){return et&&"run"in et?async function(tt,rt){const nt=toHast(tt,{file:rt,...o});await et.run(nt,rt)}:function(tt,rt){return toHast(tt,{file:rt,...et||o})}}function bail(et){if(et)throw et}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function et(o){return typeof Array.isArray=="function"?Array.isArray(o):toStr.call(o)==="[object Array]"},isPlainObject$1=function et(o){if(!o||toStr.call(o)!=="[object Object]")return!1;var tt=hasOwn.call(o,"constructor"),rt=o.constructor&&o.constructor.prototype&&hasOwn.call(o.constructor.prototype,"isPrototypeOf");if(o.constructor&&!tt&&!rt)return!1;var nt;for(nt in o);return typeof nt>"u"||hasOwn.call(o,nt)},setProperty=function et(o,tt){defineProperty&&tt.name==="__proto__"?defineProperty(o,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):o[tt.name]=tt.newValue},getProperty=function et(o,tt){if(tt==="__proto__")if(hasOwn.call(o,tt)){if(gOPD)return gOPD(o,tt).value}else return;return o[tt]},extend=function et(){var o,tt,rt,nt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(nt);try{at=et.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return nt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,nt):at instanceof Error?nt(at):ot(at))}function nt(it,...st){tt||(tt=!0,o(it,...st))}function ot(it){nt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(et,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(et);let tt=0,rt=-1,nt=et.length,ot;if(o===void 0||o.length===0||o.length>et.length){for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else rt<0&&(ot=!0,rt=nt+1);return rt<0?"":et.slice(tt,rt)}if(o===et)return"";let it=-1,st=o.length-1;for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else it<0&&(ot=!0,it=nt+1),st>-1&&(et.codePointAt(nt)===o.codePointAt(st--)?st<0&&(rt=nt):(st=-1,rt=it));return tt===rt?rt=it:rt<0&&(rt=et.length),et.slice(tt,rt)}function dirname(et){if(assertPath$1(et),et.length===0)return".";let o=-1,tt=et.length,rt;for(;--tt;)if(et.codePointAt(tt)===47){if(rt){o=tt;break}}else rt||(rt=!0);return o<0?et.codePointAt(0)===47?"/":".":o===1&&et.codePointAt(0)===47?"//":et.slice(0,o)}function extname(et){assertPath$1(et);let o=et.length,tt=-1,rt=0,nt=-1,ot=0,it;for(;o--;){const st=et.codePointAt(o);if(st===47){if(it){rt=o+1;break}continue}tt<0&&(it=!0,tt=o+1),st===46?nt<0?nt=o:ot!==1&&(ot=1):nt>-1&&(ot=-1)}return nt<0||tt<0||ot===0||ot===1&&nt===tt-1&&nt===rt+1?"":et.slice(nt,tt)}function join(...et){let o=-1,tt;for(;++o0&&et.codePointAt(et.length-1)===47&&(tt+="/"),o?"/"+tt:tt}function normalizeString(et,o){let tt="",rt=0,nt=-1,ot=0,it=-1,st,at;for(;++it<=et.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",rt=0):(tt=tt.slice(0,at),rt=tt.length-1-tt.lastIndexOf("/")),nt=it,ot=0;continue}}else if(tt.length>0){tt="",rt=0,nt=it,ot=0;continue}}o&&(tt=tt.length>0?tt+"/..":"..",rt=2)}else tt.length>0?tt+="/"+et.slice(nt+1,it):tt=et.slice(nt+1,it),rt=it-nt-1;nt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(et){if(typeof et!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(et))}const minproc={cwd};function cwd(){return"/"}function isUrl(et){return!!(et!==null&&typeof et=="object"&&"href"in et&&et.href&&"protocol"in et&&et.protocol&&et.auth===void 0)}function urlToPath(et){if(typeof et=="string")et=new URL(et);else if(!isUrl(et)){const o=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+et+"`");throw o.code="ERR_INVALID_ARG_TYPE",o}if(et.protocol!=="file:"){const o=new TypeError("The URL must be of scheme file");throw o.code="ERR_INVALID_URL_SCHEME",o}return getPathFromURLPosix(et)}function getPathFromURLPosix(et){if(et.hostname!==""){const rt=new TypeError('File URL host must be "localhost" or empty on darwin');throw rt.code="ERR_INVALID_FILE_URL_HOST",rt}const o=et.pathname;let tt=-1;for(;++tt0){let[mt,...ft]=lt;const pt=rt[ht][1];isPlainObject(pt)&&isPlainObject(mt)&&(mt=extend$1(!0,pt,mt)),rt[ht]=[ct,mt,...ft]}}}}const unified=new Processor().freeze();function assertParser(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `parser`")}function assertCompiler(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `compiler`")}function assertUnfrozen(et,o){if(o)throw new Error("Cannot call `"+et+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(et){if(!isPlainObject(et)||typeof et.type!="string")throw new TypeError("Expected node, got `"+et+"`")}function assertDone(et,o,tt){if(!tt)throw new Error("`"+et+"` finished async. Use `"+o+"` instead")}function vfile(et){return looksLikeAVFile(et)?et:new VFile(et)}function looksLikeAVFile(et){return!!(et&&typeof et=="object"&&"message"in et&&"messages"in et)}function looksLikeAValue(et){return typeof et=="string"||isUint8Array(et)}function isUint8Array(et){return!!(et&&typeof et=="object"&&"byteLength"in et&&"byteOffset"in et)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(et){const o=et.allowedElements,tt=et.allowElement,rt=et.children||"",nt=et.className,ot=et.components,it=et.disallowedElements,st=et.rehypePlugins||emptyPlugins,at=et.remarkPlugins||emptyPlugins,ct=et.remarkRehypeOptions?{...et.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=et.skipHtml,dt=et.unwrapDisallowed,ht=et.urlTransform||defaultUrlTransform,mt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),ft=new VFile;typeof rt=="string"&&(ft.value=rt);for(const bt of deprecations)Object.hasOwn(et,bt.from)&&(""+bt.from+(bt.to?"use `"+bt.to+"` instead":"remove it")+changelog+bt.id,void 0);const pt=mt.parse(ft);let yt=mt.runSync(pt,ft);return nt&&(yt={type:"element",tagName:"div",properties:{className:nt},children:yt.type==="root"?yt.children:[yt]}),visit(yt,gt),toJsxRuntime(yt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function gt(bt,xt,vt){if(bt.type==="raw"&&vt&&typeof xt=="number")return lt?vt.children.splice(xt,1):vt.children[xt]={type:"text",value:bt.value},xt;if(bt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(bt.properties,Et)){const Ct=bt.properties[Et],St=urlAttributes[Et];(St===null||St.includes(bt.tagName))&&(bt.properties[Et]=ht(String(Ct||""),Et,bt))}}if(bt.type==="element"){let Et=o?!o.includes(bt.tagName):it?it.includes(bt.tagName):!1;if(!Et&&tt&&typeof xt=="number"&&(Et=!tt(bt,xt,vt)),Et&&vt&&typeof xt=="number")return dt&&bt.children?vt.children.splice(xt,1,...bt.children):vt.children.splice(xt,1),xt}}}function defaultUrlTransform(et){const o=et.indexOf(":"),tt=et.indexOf("?"),rt=et.indexOf("#"),nt=et.indexOf("/");return o<0||nt>-1&&o>nt||tt>-1&&o>tt||rt>-1&&o>rt||safeProtocol.test(et.slice(0,o))?et:""}const PrivacyPolicyOptIn=({onOptIn:et})=>{const[o,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>et(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>et(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:o,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[et,o]=reactExports.useState(!1);reactExports.useEffect(()=>{const rt=localStorage.getItem("privacyPolicyOptIn");rt!==null&&o(rt==="true")},[]);const tt=()=>{const rt=!et;o(rt),localStorage.setItem("privacyPolicyOptIn",rt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",et?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:et?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const{chainUUID:rt,blockUUID:nt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=et.find(ct=>ct.chainUUID===rt&&ct.blockUUID===nt);at&&it(at)},[et,rt,nt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:et,onSuccess:o})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})};function App(){const[et,o]=reactExports.useState(!1),[tt,rt]=reactExports.useState([]),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"}),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{nt||!it||it.libp2p.getConnections().length===0||tt.length>0||et||(o(!0),ft())},[it,nt,st]);const mt=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(nt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const ft=async()=>{console.log("Starting message listening");try{at(gt=>({...gt,store:"in-progress"})),ht(!0);const yt=getMessagesFromStore(it);for await(const gt of yt)rt(bt=>bt.some(vt=>vt.blockUUID===gt.blockUUID)?bt:[...bt,gt]);at(gt=>({...gt,store:"success"}))}catch(yt){console.error("Error fetching messages from store:",yt),at(gt=>({...gt,store:"error"}))}finally{ht(!1)}try{at(yt=>({...yt,filter:"in-progress"})),await subscribeToFilter(it,yt=>{pt(yt)}),at(yt=>({...yt,filter:"success"}))}catch(yt){console.error("Error subscribing to filter:",yt),at(gt=>({...gt,filter:"error"}))}};if(ot)return console.error("Waku error:",ot),jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const pt=yt=>{rt(gt=>gt.some(xt=>xt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:mt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]}),projectId="1d93edc21291f98e3bed6ff7617ff539",config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:projectId,chains:[mainnet],transports:{[mainnet.id]:http()}})),WAKU_NODE_OPTIONS={defaultBootstrap:!0,libp2p:{addresses:{listen:[]},connectionManager:{minConnections:2}},protocols:[Protocols.Store,Protocols.Filter,Protocols.LightPush]};typeof globalThis>"u"&&(window.global=window);typeof buffer$2.Buffer>"u"&&(window.Buffer=buffer$2.Buffer);const queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/buddybook/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BytesSizeMismatchError as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,stringToHex as a,bytesToHex$3 as b,concat$6 as c,commonjsGlobal as d,encodeAbiParameters as e,encodeFunctionData as f,getAugmentedNamespace as g,getDefaultExportFromCjs as h,isAddress as i,browserExports as j,keccak256$1 as k,tslib_es6$1 as l,buffer$2 as m,numberToHex as n,allocUnsafe$h as o,BASES$1 as p,fromString$2 as q,detect as r,size$2 as s,toHex as t,__viteBrowserExternal$1 as u,BaseError$3 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; +`},nt),ot}function remarkRehype(et,o){return et&&"run"in et?async function(tt,rt){const nt=toHast(tt,{file:rt,...o});await et.run(nt,rt)}:function(tt,rt){return toHast(tt,{file:rt,...et||o})}}function bail(et){if(et)throw et}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function et(o){return typeof Array.isArray=="function"?Array.isArray(o):toStr.call(o)==="[object Array]"},isPlainObject$1=function et(o){if(!o||toStr.call(o)!=="[object Object]")return!1;var tt=hasOwn.call(o,"constructor"),rt=o.constructor&&o.constructor.prototype&&hasOwn.call(o.constructor.prototype,"isPrototypeOf");if(o.constructor&&!tt&&!rt)return!1;var nt;for(nt in o);return typeof nt>"u"||hasOwn.call(o,nt)},setProperty=function et(o,tt){defineProperty&&tt.name==="__proto__"?defineProperty(o,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):o[tt.name]=tt.newValue},getProperty=function et(o,tt){if(tt==="__proto__")if(hasOwn.call(o,tt)){if(gOPD)return gOPD(o,tt).value}else return;return o[tt]},extend=function et(){var o,tt,rt,nt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(nt);try{at=et.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return nt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,nt):at instanceof Error?nt(at):ot(at))}function nt(it,...st){tt||(tt=!0,o(it,...st))}function ot(it){nt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(et,o){if(o!==void 0&&typeof o!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(et);let tt=0,rt=-1,nt=et.length,ot;if(o===void 0||o.length===0||o.length>et.length){for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else rt<0&&(ot=!0,rt=nt+1);return rt<0?"":et.slice(tt,rt)}if(o===et)return"";let it=-1,st=o.length-1;for(;nt--;)if(et.codePointAt(nt)===47){if(ot){tt=nt+1;break}}else it<0&&(ot=!0,it=nt+1),st>-1&&(et.codePointAt(nt)===o.codePointAt(st--)?st<0&&(rt=nt):(st=-1,rt=it));return tt===rt?rt=it:rt<0&&(rt=et.length),et.slice(tt,rt)}function dirname(et){if(assertPath$1(et),et.length===0)return".";let o=-1,tt=et.length,rt;for(;--tt;)if(et.codePointAt(tt)===47){if(rt){o=tt;break}}else rt||(rt=!0);return o<0?et.codePointAt(0)===47?"/":".":o===1&&et.codePointAt(0)===47?"//":et.slice(0,o)}function extname(et){assertPath$1(et);let o=et.length,tt=-1,rt=0,nt=-1,ot=0,it;for(;o--;){const st=et.codePointAt(o);if(st===47){if(it){rt=o+1;break}continue}tt<0&&(it=!0,tt=o+1),st===46?nt<0?nt=o:ot!==1&&(ot=1):nt>-1&&(ot=-1)}return nt<0||tt<0||ot===0||ot===1&&nt===tt-1&&nt===rt+1?"":et.slice(nt,tt)}function join(...et){let o=-1,tt;for(;++o0&&et.codePointAt(et.length-1)===47&&(tt+="/"),o?"/"+tt:tt}function normalizeString(et,o){let tt="",rt=0,nt=-1,ot=0,it=-1,st,at;for(;++it<=et.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",rt=0):(tt=tt.slice(0,at),rt=tt.length-1-tt.lastIndexOf("/")),nt=it,ot=0;continue}}else if(tt.length>0){tt="",rt=0,nt=it,ot=0;continue}}o&&(tt=tt.length>0?tt+"/..":"..",rt=2)}else tt.length>0?tt+="/"+et.slice(nt+1,it):tt=et.slice(nt+1,it),rt=it-nt-1;nt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(et){if(typeof et!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(et))}const minproc={cwd};function cwd(){return"/"}function isUrl(et){return!!(et!==null&&typeof et=="object"&&"href"in et&&et.href&&"protocol"in et&&et.protocol&&et.auth===void 0)}function urlToPath(et){if(typeof et=="string")et=new URL(et);else if(!isUrl(et)){const o=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+et+"`");throw o.code="ERR_INVALID_ARG_TYPE",o}if(et.protocol!=="file:"){const o=new TypeError("The URL must be of scheme file");throw o.code="ERR_INVALID_URL_SCHEME",o}return getPathFromURLPosix(et)}function getPathFromURLPosix(et){if(et.hostname!==""){const rt=new TypeError('File URL host must be "localhost" or empty on darwin');throw rt.code="ERR_INVALID_FILE_URL_HOST",rt}const o=et.pathname;let tt=-1;for(;++tt0){let[mt,...ft]=lt;const pt=rt[ht][1];isPlainObject(pt)&&isPlainObject(mt)&&(mt=extend$1(!0,pt,mt)),rt[ht]=[ct,mt,...ft]}}}}const unified=new Processor().freeze();function assertParser(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `parser`")}function assertCompiler(et,o){if(typeof o!="function")throw new TypeError("Cannot `"+et+"` without `compiler`")}function assertUnfrozen(et,o){if(o)throw new Error("Cannot call `"+et+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(et){if(!isPlainObject(et)||typeof et.type!="string")throw new TypeError("Expected node, got `"+et+"`")}function assertDone(et,o,tt){if(!tt)throw new Error("`"+et+"` finished async. Use `"+o+"` instead")}function vfile(et){return looksLikeAVFile(et)?et:new VFile(et)}function looksLikeAVFile(et){return!!(et&&typeof et=="object"&&"message"in et&&"messages"in et)}function looksLikeAValue(et){return typeof et=="string"||isUint8Array(et)}function isUint8Array(et){return!!(et&&typeof et=="object"&&"byteLength"in et&&"byteOffset"in et)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(et){const o=et.allowedElements,tt=et.allowElement,rt=et.children||"",nt=et.className,ot=et.components,it=et.disallowedElements,st=et.rehypePlugins||emptyPlugins,at=et.remarkPlugins||emptyPlugins,ct=et.remarkRehypeOptions?{...et.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=et.skipHtml,dt=et.unwrapDisallowed,ht=et.urlTransform||defaultUrlTransform,mt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),ft=new VFile;typeof rt=="string"&&(ft.value=rt);for(const bt of deprecations)Object.hasOwn(et,bt.from)&&(""+bt.from+(bt.to?"use `"+bt.to+"` instead":"remove it")+changelog+bt.id,void 0);const pt=mt.parse(ft);let yt=mt.runSync(pt,ft);return nt&&(yt={type:"element",tagName:"div",properties:{className:nt},children:yt.type==="root"?yt.children:[yt]}),visit(yt,gt),toJsxRuntime(yt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function gt(bt,xt,vt){if(bt.type==="raw"&&vt&&typeof xt=="number")return lt?vt.children.splice(xt,1):vt.children[xt]={type:"text",value:bt.value},xt;if(bt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(bt.properties,Et)){const Ct=bt.properties[Et],St=urlAttributes[Et];(St===null||St.includes(bt.tagName))&&(bt.properties[Et]=ht(String(Ct||""),Et,bt))}}if(bt.type==="element"){let Et=o?!o.includes(bt.tagName):it?it.includes(bt.tagName):!1;if(!Et&&tt&&typeof xt=="number"&&(Et=!tt(bt,xt,vt)),Et&&vt&&typeof xt=="number")return dt&&bt.children?vt.children.splice(xt,1,...bt.children):vt.children.splice(xt,1),xt}}}function defaultUrlTransform(et){const o=et.indexOf(":"),tt=et.indexOf("?"),rt=et.indexOf("#"),nt=et.indexOf("/");return o<0||nt>-1&&o>nt||tt>-1&&o>tt||rt>-1&&o>rt||safeProtocol.test(et.slice(0,o))?et:""}const PrivacyPolicyOptIn=({onOptIn:et})=>{const[o,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>et(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>et(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:o,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[et,o]=reactExports.useState(!1);reactExports.useEffect(()=>{const rt=localStorage.getItem("privacyPolicyOptIn");rt!==null&&o(rt==="true")},[]);const tt=()=>{const rt=!et;o(rt),localStorage.setItem("privacyPolicyOptIn",rt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",et?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:et?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:et,onChainUpdate:o,isLoading:tt})=>{const{chainUUID:rt,blockUUID:nt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=et.find(ct=>ct.chainUUID===rt&&ct.blockUUID===nt);at&&it(at)},[et,rt,nt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:et,onSuccess:o})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})};function App(){const[et,o]=reactExports.useState(!1),[tt,rt]=reactExports.useState([]),{isLoading:nt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"}),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{nt||!it||it.libp2p.getConnections().length===0||tt.length>0||et||(o(!0),ft())},[it,nt,st]);const mt=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(nt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const ft=async()=>{console.log("Starting message listening");try{at(gt=>({...gt,store:"in-progress"})),ht(!0);const yt=getMessagesFromStore(it);try{for await(const gt of yt)rt(bt=>bt.some(vt=>vt.blockUUID===gt.blockUUID)?bt:[...bt,gt])}catch(gt){console.error("Error processing message:",gt)}at(gt=>({...gt,store:"success"}))}catch(yt){console.error("Error fetching messages from store:",yt),at(gt=>({...gt,store:"error"}))}finally{ht(!1)}try{at(yt=>({...yt,filter:"in-progress"})),await subscribeToFilter(it,yt=>{pt(yt)}),at(yt=>({...yt,filter:"success"}))}catch(yt){console.error("Error subscribing to filter:",yt),at(gt=>({...gt,filter:"error"}))}};if(ot)return console.error("Waku error:",ot),jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const pt=yt=>{rt(gt=>gt.some(xt=>xt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:mt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:pt,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]}),projectId="1d93edc21291f98e3bed6ff7617ff539",config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:projectId,chains:[mainnet],transports:{[mainnet.id]:http()}})),WAKU_NODE_OPTIONS={defaultBootstrap:!0,libp2p:{addresses:{listen:[]},connectionManager:{minConnections:2}},protocols:[Protocols.Store,Protocols.Filter,Protocols.LightPush]};typeof globalThis>"u"&&(window.global=window);typeof buffer$2.Buffer>"u"&&(window.Buffer=buffer$2.Buffer);const queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/buddybook/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BytesSizeMismatchError as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,stringToHex as a,bytesToHex$3 as b,concat$6 as c,commonjsGlobal as d,encodeAbiParameters as e,encodeFunctionData as f,getAugmentedNamespace as g,getDefaultExportFromCjs as h,isAddress as i,browserExports as j,keccak256$1 as k,tslib_es6$1 as l,buffer$2 as m,numberToHex as n,allocUnsafe$h as o,BASES$1 as p,fromString$2 as q,detect as r,size$2 as s,toHex as t,__viteBrowserExternal$1 as u,BaseError$3 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; diff --git a/buddybook/assets/index-DYQzbCPl.css b/buddybook/assets/index-DYQzbCPl.css deleted file mode 100644 index e647c84..0000000 --- a/buddybook/assets/index-DYQzbCPl.css +++ /dev/null @@ -1 +0,0 @@ -#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem }*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.container{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1024px){.container{padding-left:2rem;padding-right:2rem}}h1{font-size:1.5rem;line-height:2rem;font-weight:700}@media (min-width: 768px){h1{font-size:2.25rem;line-height:2.5rem}}h2{font-size:1.25rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h2{font-size:1.875rem;line-height:2.25rem}}h3{font-size:1.125rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h3{font-size:1.5rem;line-height:2rem}}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.left-\[50\%\]{left:50%}.right-4{right:1rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.\!block{display:block!important}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[50vh\]{height:50vh}.h-full{height:100%}.max-h-\[90vh\]{max-height:90vh}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[95vw\]{width:95vw}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[120px\]{max-width:120px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-grow{flex-grow:1}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0{padding-left:0;padding-right:0}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pt-0{padding-top:0}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.dark\:prose-invert:is(.dark *){--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}@media (min-width: 640px){.sm\:h-\[60vh\]{height:60vh}.sm\:w-auto{width:auto}.sm\:max-w-md{max-width:28rem}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:inline{display:inline}.md\:h-3{height:.75rem}.md\:w-3{width:.75rem}.md\:w-auto{width:auto}.md\:max-w-none{max-width:none}.md\:flex-row{flex-direction:row}.md\:justify-start{justify-content:flex-start}.md\:justify-end{justify-content:flex-end}.md\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.md\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:p-6{padding:1.5rem}.md\:py-8{padding-top:2rem;padding-bottom:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/buddybook/assets/index-Cmis2wXV.js b/buddybook/assets/index-DY_rTz6S.js similarity index 98% rename from buddybook/assets/index-Cmis2wXV.js rename to buddybook/assets/index-DY_rTz6S.js index 4789aa9..9decd27 100644 --- a/buddybook/assets/index-Cmis2wXV.js +++ b/buddybook/assets/index-DY_rTz6S.js @@ -1 +1 @@ -import{e as p}from"./events-D77cZ0Dd.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-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}; diff --git a/buddybook/assets/index-C7D_Vv5-.js b/buddybook/assets/index-DbFRd9te.js similarity index 99% rename from buddybook/assets/index-C7D_Vv5-.js rename to buddybook/assets/index-DbFRd9te.js index 4784cd0..c5a8365 100644 --- a/buddybook/assets/index-C7D_Vv5-.js +++ b/buddybook/assets/index-DbFRd9te.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-CENwOupW.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-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: `;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-nTxWlJlB.js b/buddybook/assets/index-DrKwSPd8.js similarity index 99% rename from buddybook/assets/index-nTxWlJlB.js rename to buddybook/assets/index-DrKwSPd8.js index d5f43c4..cc59387 100644 --- a/buddybook/assets/index-nTxWlJlB.js +++ b/buddybook/assets/index-DrKwSPd8.js @@ -1 +1 @@ -import{d as M,g as sr,h as ir}from"./index-CENwOupW.js";import{j as ar,s as or,r as _t,a as cr,b as dr}from"./hooks.module-BU4-HDYb.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-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}; diff --git a/buddybook/assets/index-DSPCU2Te.js b/buddybook/assets/index-jQUXy-RB.js similarity index 99% rename from buddybook/assets/index-DSPCU2Te.js rename to buddybook/assets/index-jQUXy-RB.js index 050a54a..3b2171f 100644 --- a/buddybook/assets/index-DSPCU2Te.js +++ b/buddybook/assets/index-jQUXy-RB.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-lBZeKVJT.js";import{C as Wo}from"./index-CENwOupW.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-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}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/buddybook/assets/index-qdeI_DrH.css b/buddybook/assets/index-qdeI_DrH.css new file mode 100644 index 0000000..db30029 --- /dev/null +++ b/buddybook/assets/index-qdeI_DrH.css @@ -0,0 +1 @@ +#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem}*{border-color:hsl(var(--border))}html{-webkit-tap-highlight-color:transparent}body{background-color:hsl(var(--background));color:hsl(var(--foreground));overscroll-behavior-y:none}button,a{cursor:pointer;touch-action:manipulation}.container{padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.container{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1024px){.container{padding-left:2rem;padding-right:2rem}}h1{font-size:1.5rem;line-height:2rem;font-weight:700}@media (min-width: 768px){h1{font-size:2.25rem;line-height:2.5rem}}h2{font-size:1.25rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h2{font-size:1.875rem;line-height:2.25rem}}h3{font-size:1.125rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h3{font-size:1.5rem;line-height:2rem}}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.top-0{top:0}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.\!block{display:block!important}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[50vh\]{height:50vh}.h-full{height:100%}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[100px\]{min-height:100px}.min-h-\[44px\]{min-height:44px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[95vw\]{width:95vw}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[300px\]{max-width:300px}.max-w-\[80px\]{max-width:80px}.max-w-\[95vw\]{max-width:95vw}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.touch-none{touch-action:none}.touch-manipulation{touch-action:manipulation}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0{padding-left:0;padding-right:0}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pt-0{padding-top:0}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.dark\:prose-invert:is(.dark *){--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=open\]\:fade-in-90[data-state=open]{--tw-enter-opacity: .9}.data-\[state\=open\]\:slide-in-from-bottom-10[data-state=open]{--tw-enter-translate-y: 2.5rem}@supports ((-webkit-backdrop-filter: var(--tw)) or (backdrop-filter: var(--tw))){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}@media (min-width: 640px){.sm\:h-\[60vh\]{height:60vh}.sm\:w-auto{width:auto}.sm\:max-w-lg{max-width:32rem}.sm\:max-w-md{max-width:28rem}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:zoom-in-90{--tw-enter-scale: .9}.data-\[state\=open\]\:sm\:slide-in-from-bottom-0[data-state=open]{--tw-enter-translate-y: 0px}}@media (min-width: 768px){.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-3{height:.75rem}.md\:min-h-\[36px\]{min-height:36px}.md\:w-3{width:.75rem}.md\:max-w-\[120px\]{max-width:120px}.md\:gap-4{gap:1rem}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:p-6{padding:1.5rem}.md\:px-3{padding-left:.75rem;padding-right:.75rem}.md\:py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.md\:py-8{padding-top:2rem;padding-bottom:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/buddybook/assets/index.es-Cm56O0-c.js b/buddybook/assets/index.es-Bushv2uZ.js similarity index 99% rename from buddybook/assets/index.es-Cm56O0-c.js rename to buddybook/assets/index.es-Bushv2uZ.js index 5f190b4..2a181bc 100644 --- a/buddybook/assets/index.es-Cm56O0-c.js +++ b/buddybook/assets/index.es-Bushv2uZ.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-lBZeKVJT.js","assets/index-CENwOupW.js","assets/index-DYQzbCPl.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-CENwOupW.js";import{e as Fi,J as Id}from"./events-D77cZ0Dd.js";import{r as Md,i as xh}from"./inherits_browser-BkM0a8tS.js";var xe={};/*! ***************************************************************************** +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={};/*! ***************************************************************************** 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-lBZeKVJT.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-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}; diff --git a/buddybook/assets/inherits_browser-BkM0a8tS.js b/buddybook/assets/inherits_browser-Cg-Az14D.js similarity index 85% rename from buddybook/assets/inherits_browser-BkM0a8tS.js rename to buddybook/assets/inherits_browser-Cg-Az14D.js index 7f4e21e..7ed128d 100644 --- a/buddybook/assets/inherits_browser-BkM0a8tS.js +++ b/buddybook/assets/inherits_browser-Cg-Az14D.js @@ -1 +1 @@ -import{g as n,u as s}from"./index-CENwOupW.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-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}; diff --git a/buddybook/index.html b/buddybook/index.html index 761fd9a..7e49bef 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -20,8 +20,8 @@ browser: true }; - - + +
diff --git a/flush-notes/404.html b/flush-notes/404.html index 28917db..6b93161 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/D7jrosl9_Zxnutu9GbIPH/_buildManifest.js b/flush-notes/_next/static/D0ksWo2E2oITf_v20vm5B/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/D7jrosl9_Zxnutu9GbIPH/_buildManifest.js rename to flush-notes/_next/static/D0ksWo2E2oITf_v20vm5B/_buildManifest.js diff --git a/flush-notes/_next/static/D7jrosl9_Zxnutu9GbIPH/_ssgManifest.js b/flush-notes/_next/static/D0ksWo2E2oITf_v20vm5B/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/D7jrosl9_Zxnutu9GbIPH/_ssgManifest.js rename to flush-notes/_next/static/D0ksWo2E2oITf_v20vm5B/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index 0225b27..a922d6c 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 b223fd8..593b6b9 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:["D7jrosl9_Zxnutu9GbIPH",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["D0ksWo2E2oITf_v20vm5B",[[["",{"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 a9b41b1..0c6a078 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 a9de16e..8d5b194 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:["D7jrosl9_Zxnutu9GbIPH",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["D0ksWo2E2oITf_v20vm5B",[[["",{"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,[],""]